> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gmicloud.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Templates

> Lists Templates visible to the authenticated organization. Results are
sorted by creation time in descending order. Provider artifact IDs are
never returned.




## OpenAPI

````yaml /api-spec/sandbox_api.yaml get /templates
openapi: 3.0.3
info:
  title: GMI Sandbox API
  description: >-
    REST API for GMI Sandbox: create isolated execution environments from
    templates, manage their lifecycle on the control plane, and run commands or
    transfer files through each sandbox's own data plane.
  contact:
    name: GMI Cloud Support
    email: support@gmicloud.ai
  version: '2.0'
servers:
  - url: https://console.gmicloud.ai/api/v2
    description: Control plane
security:
  - bearerAuth: []
tags:
  - name: Sandbox
    description: |
      Sandbox instance lifecycle management (Sandbox v2, /api/v2/sandboxes)
  - name: SandboxTemplate
    description: Sandbox template management (Sandbox v2, `/api/v2/templates`)
  - name: Sandbox-Exec
    description: >
      Sandbox execution data plane (accessed via the sandbox host and sandbox
      access token). These endpoints are not under the control plane's `/api/v2`
      path; clients connect directly to `https://{sandbox_key}.{domain}` and
      authenticate with `X-Access-Token`.
  - name: Sandbox-Files
    description: >
      Sandbox file data plane (`/files`). **These endpoints are not under
      `/api/v2`** and do not use `Authorization: Bearer`: they are served by the
      sandbox's own data-plane entry point — clients connect directly to
      `https://{sandbox_key}.{domain}` and authenticate with `X-Access-Token`.
      `{sandbox_key}` is the `sandbox_key` returned by the create/connect
      endpoints, used for data-plane host addressing. `{domain}` and
      `X-Access-Token` are the `domain` and `sandbox_access_token` from the same
      responses — no extra endpoint is needed to obtain them.


      This split is not historical baggage but the nature of a data plane: file
      transfer is long-lived, high-volume, and addressed per sandbox, differing
      from the control plane's short requests in both capacity model and failure
      domain, so they do not share an entry point.


      **One unified abstraction.** The same contract is served by two backend
      kinds (an in-sandbox file service / a data-center data-plane proxy);
      clients need not — and cannot — tell them apart. The cost is that the
      contract is their intersection: `Content-Length` on download and resumable
      download (`Range`/`206`) are **optional capabilities** that vary by data
      center, and clients must work correctly when they are absent. See the
      per-operation notes below.
paths:
  /templates:
    get:
      tags:
        - SandboxTemplate
      summary: List Templates
      description: |
        Lists Templates visible to the authenticated organization. Results are
        sorted by creation time in descending order. Provider artifact IDs are
        never returned.
      operationId: listTemplates
      parameters:
        - $ref: '#/components/parameters/IdcNameQueryParam'
        - $ref: '#/components/parameters/PageParam'
        - $ref: '#/components/parameters/PageSizeParam'
      responses:
        '200':
          description: Templates were returned successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplatePage'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    IdcNameQueryParam:
      name: idc_name
      in: query
      description: Filter by data center name, e.g. us-denver-1
      schema:
        type: string
    PageParam:
      name: page
      in: query
      description: Page number, starting from 1; default 1
      schema:
        type: integer
        minimum: 1
        default: 1
    PageSizeParam:
      name: page_size
      in: query
      description: Items per page; default 20, maximum 100
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
  schemas:
    TemplatePage:
      type: object
      additionalProperties: false
      required:
        - request_id
        - total
        - page
        - page_size
        - items
      properties:
        request_id:
          type: string
          description: HTTP request correlation identifier.
        total:
          type: integer
          format: int64
          minimum: 0
          description: Total number of matching Templates.
        page:
          type: integer
          minimum: 1
          description: One-based page number.
        page_size:
          type: integer
          minimum: 1
          maximum: 100
          description: Requested number of Templates per page.
        items:
          type: array
          items:
            $ref: '#/components/schemas/Template'
    Template:
      type: object
      additionalProperties: false
      required:
        - id
        - name
        - idc_name
        - source_type
        - resources
        - latest_build_id
        - latest_build_status
        - created_at
        - updated_at
      properties:
        id:
          type: string
          description: Immutable GMI Template identifier.
        name:
          type: string
          description: Organization-scoped display name.
        description:
          type: string
          description: Human-readable Template description.
        idc_name:
          type: string
          description: Immutable owning IDC identifier.
        source_type:
          $ref: '#/components/schemas/BuildSourceType'
        product:
          type: string
          nullable: true
          description: Catalog SKU when created from a preset; null for custom resources.
        product_name:
          allOf:
            - $ref: '#/components/schemas/ResourceSpecName'
          nullable: true
          description: Preset label when created from a preset; null for custom resources.
        resources:
          $ref: '#/components/schemas/EffectiveResources'
        labels:
          type: object
          additionalProperties:
            type: string
        current_build_id:
          type: string
          nullable: true
          description: Latest successful Build used to create new Sandboxes.
        latest_build_id:
          type: string
          description: Most recently created Build, including a failed Build.
        latest_build_status:
          $ref: '#/components/schemas/BuildStatus'
        rebuildable:
          type: boolean
          description: False for snapshot-created Templates.
        deleted_at:
          type: string
          format: date-time
          nullable: true
          description: Logical deletion time in UTC.
        created_at:
          type: string
          format: date-time
          description: Template creation time in UTC.
        updated_at:
          type: string
          format: date-time
          description: Template update time in UTC.
    ErrorResponse:
      type: object
      required:
        - code
        - message
        - request_id
      properties:
        code:
          type: string
          description: Machine-readable business error code
          example: Resource.QuotaExceeded
        message:
          type: string
          description: Human-readable error description
          example: The resource quota is not enough.
        request_id:
          type: string
          description: Tracing ID
          example: req-xxxx
        details:
          type: object
          description: Field-level error details
          additionalProperties: true
    BuildSourceType:
      type: string
      enum:
        - image
        - template
        - sandbox
      description: Provider-neutral Build lineage type.
    ResourceSpecName:
      type: string
      enum:
        - X_SMALL
        - SMALL
        - MEDIUM
        - LARGE
        - X_LARGE
      description: Stable human-readable Sandbox resource specification label.
    EffectiveResources:
      type: object
      additionalProperties: false
      required:
        - cpu_count
        - memory_mb
        - disk_size_mb
        - architecture
      properties:
        cpu_count:
          type: integer
          minimum: 1
          description: |
            Effective integer vCPU count. Operator-managed presets do not use
            the custom-resource maximum.
        memory_mb:
          type: integer
          minimum: 1
          description: |
            Effective memory size in MiB. Operator-managed presets are not
            constrained by custom-resource limits.
        disk_size_mb:
          type: integer
          minimum: 1
          description: |
            Effective boot disk size in MiB. Operator-managed presets are not
            constrained by custom-resource limits.
        architecture:
          type: string
          enum:
            - x86_64
            - arm64
          description: |
            CPU architecture resolved for the selected IDC.
    BuildStatus:
      type: string
      enum:
        - waiting
        - building
        - ready
        - error
      description: Normalized Template Build status.
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: Parameter.Invalid
            message: Invalid request parameters
            request_id: req-xxxx
    Unauthorized:
      description: Unauthenticated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: Auth.Unauthorized
            message: Authentication required
            request_id: req-xxxx
    Forbidden:
      description: The caller cannot access the organization-scoped resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: Internal.ServerError
            message: An internal server error occurred
            request_id: req-xxxx
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        API Key or Access Token, always sent as `Authorization: Bearer <token>`.
        The gateway recognizes the token type automatically.

````