The San Francisco Compute Company Instance Templates API

Reusable instance configuration.

Documentation

Specifications

Other Resources

OpenAPI Specification

the-san-francisco-compute-company-instance-templates-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: sfc-api Account Instance Templates API
  description: Public preview API - subject to change. See https://docs.sfcompute.com/preview/roadmap for details.
  version: 0.1.0
  x-apievangelist:
    method: searched
    generated: '2026-07-21'
    source: Reconstructed from per-operation OpenAPI blocks published on https://docs.sfcompute.com/preview/api-reference/* (Mintlify). 65 pages merged; paths + components unioned verbatim.
    note: Public preview API (subject to change). Base path /preview/v2 under server https://api.sfcompute.com.
servers:
- url: https://api.sfcompute.com
security:
- bearer_auth: []
tags:
- name: Instance Templates
  description: Reusable instance configuration.
paths:
  /preview/v2/instance_templates:
    post:
      tags:
      - Instance Templates
      summary: Create instance template
      description: '> ⚠️ This endpoint is in [public preview](/preview/roadmap).


        Create a reusable instance template.'
      operationId: create_instance_template
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInstanceTemplateRequest'
        required: true
      responses:
        '201':
          description: Instance template created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstanceTemplateResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '422':
          description: Validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
    get:
      tags:
      - Instance Templates
      summary: List instance templates
      description: '> ⚠️ This endpoint is in [public preview](/preview/roadmap).


        List all instance templates.'
      operationId: list_instance_templates
      parameters:
      - name: workspace
        in: query
        description: Scope the returned list to a single workspace (ID, resource path, or name). Without it, the returned list spans every workspace the caller has requisite permissions on.
        required: false
        schema:
          $ref: '#/components/schemas/ResourcePathOrId_WorkspaceId'
      - name: id
        in: query
        description: Filter by instance template ID or name (repeatable).
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/ResourcePathOrId_InstanceTemplateId'
        style: form
        explode: true
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          format: u-int32
          default: 50
          maximum: 50
          minimum: 1
      - name: starting_after
        in: query
        description: Set to the response's `cursor` to fetch the next page.
        required: false
        schema:
          $ref: '#/components/schemas/InstanceTemplatesCursor'
      - name: ending_before
        in: query
        description: Set to the response's `cursor` to fetch the previous page.
        required: false
        schema:
          $ref: '#/components/schemas/InstanceTemplatesCursor'
      - name: include
        in: query
        description: Additional fields to include in the response.
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/InstanceTemplateInclude'
      responses:
        '200':
          description: Paginated list of instance templates.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListInstanceTemplatesResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '422':
          description: Validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
  /preview/v2/instance_templates/{id}:
    delete:
      tags:
      - Instance Templates
      summary: Delete instance template
      description: '> ⚠️ This endpoint is in [public preview](/preview/roadmap).


        Delete an instance template. The template must not be in use by any capacity.'
      operationId: delete_instance_template
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          description: A resource path like 'sfc:instance_template:acme:prod:my-instance_template' _or_ an ID. Resource paths are human-readable but not stable - they change when resources are renamed or moved. IDs are stable and permanent.
          examples:
          - itmpl_k3R-nX9vLm7Qp2Yw5Jd8F
          pattern: (itmpl_[0-9a-zA-Z_-]{1,21}|ntmpl_[0-9a-zA-Z_-]{1,21})|(sfc:instance_template:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
      responses:
        '204':
          description: Instance template deleted.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Instance template not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '422':
          description: Instance template is in use.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
    get:
      tags:
      - Instance Templates
      summary: Get instance template
      description: '> ⚠️ This endpoint is in [public preview](/preview/roadmap).


        Retrieve an instance template by ID or resource path.'
      operationId: fetch_instance_template
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          description: A resource path like 'sfc:instance_template:acme:prod:my-instance_template' _or_ an ID. Resource paths are human-readable but not stable - they change when resources are renamed or moved. IDs are stable and permanent.
          examples:
          - itmpl_k3R-nX9vLm7Qp2Yw5Jd8F
          pattern: (itmpl_[0-9a-zA-Z_-]{1,21}|ntmpl_[0-9a-zA-Z_-]{1,21})|(sfc:instance_template:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
      responses:
        '200':
          description: Instance template details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstanceTemplateResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Instance template not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    InternalServerError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - type
          - message
          properties:
            type:
              type: string
              const: api_error
              default: api_error
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
    instance_templateResourcePath_InstanceTemplateId:
      type: string
      description: 'A resource path for a instance_template resource. Format: sfc:instance_template:<account>:<workspace>:<name>.'
      examples:
      - sfc:instance_template:<account_id>:<workspace>:<name>
      pattern: sfc:instance_template:([a-zA-Z0-9._-]+:){2}[a-zA-Z0-9._-]+
    UnprocessableEntityError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - type
          - message
          properties:
            type:
              type: string
              const: unprocessable_entity
              default: unprocessable_entity
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
            details:
              type: array
              items:
                $ref: '#/components/schemas/ErrorDetail'
    ErrorDetail:
      type: object
      required:
      - code
      - message
      properties:
        field:
          type:
          - string
          - 'null'
          description: The field that caused the error (for validation errors)
        code:
          type: string
          description: Specific error code for this detail
        message:
          type: string
          description: Human-readable error message
    WorkspaceId:
      type: string
      examples:
      - wksp_k3R-nX9vLm7Qp2Yw5Jd8F
      pattern: wksp_[0-9a-zA-Z_-]{1,21}
    InstanceTemplateScope:
      type: object
      required:
      - id
      - resource_path
      - owner
      - workspace
      - workspace_id
      - name
      properties:
        id:
          $ref: '#/components/schemas/InstanceTemplateId'
        resource_path:
          $ref: '#/components/schemas/instance_templateResourcePath_InstanceTemplateId'
        owner:
          $ref: '#/components/schemas/Name'
        workspace:
          $ref: '#/components/schemas/Name'
        workspace_id:
          $ref: '#/components/schemas/WorkspaceId'
        name:
          $ref: '#/components/schemas/Name'
    InstanceTemplateInclude:
      type: string
      const: cloud_init_user_data
      default: cloud_init_user_data
      readOnly: true
    ImageId:
      oneOf:
      - type: string
        examples:
        - image_k3R-nX9vLm7Qp2Yw5Jd8F
        pattern: image_[0-9a-zA-Z_-]{1,21}
      - type: string
        description: Legacy alias prefix; accepted on read, never emitted on write.
        pattern: vmi_[0-9a-zA-Z_-]{1,21}
      description: Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.
    UnauthorizedError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - type
          - message
          properties:
            type:
              type: string
              const: authentication_error
              default: authentication_error
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
    NotFoundError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - type
          - message
          properties:
            type:
              type: string
              const: not_found
              default: not_found
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
    ResourcePathOrId_ImageId:
      type: string
      description: A resource path like 'sfc:image:acme:prod:my-image' _or_ an ID. Resource paths are human-readable but not stable - they change when resources are renamed or moved. IDs are stable and permanent.
      examples:
      - image_k3R-nX9vLm7Qp2Yw5Jd8F
      pattern: (image_[0-9a-zA-Z_-]{1,21}|vmi_[0-9a-zA-Z_-]{1,21})|(sfc:image:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
    ImageSummary:
      type: object
      required:
      - id
      - name
      properties:
        id:
          $ref: '#/components/schemas/ImageId'
        name:
          $ref: '#/components/schemas/Name'
    CreateInstanceTemplateRequest:
      type: object
      required:
      - workspace
      - image
      properties:
        name:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/Name'
        workspace:
          $ref: '#/components/schemas/ResourcePathOrId_WorkspaceId'
          description: Workspace to create this template in.
        image:
          $ref: '#/components/schemas/ResourcePathOrId_ImageId'
          description: Machine image to use when starting instances with this template. Accepts name or ID.
        tags:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/Tags'
            description: Metadata tags to attach to this instance template.
        cloud_init_user_data:
          type: string
          format: byte
          description: Base64-encoded [cloud-init user data](https://cloudinit.readthedocs.io/en/latest/explanation/format/index.html). Maximum 64KB.
          example: IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo=
          contentEncoding: base64
    Tags:
      type: object
      additionalProperties:
        type: string
        examples:
        - prod
        maxLength: 256
        pattern: ^[^,=]{0,256}$
      propertyNames:
        type: string
        examples:
        - env
        maxLength: 128
        minLength: 1
        pattern: ^[^_,= ][^,= ]{0,127}$
      examples:
      - env: prod
        team: infra
      maxProperties: 50
    Name:
      type: string
      examples:
      - my-resource-name
      maxLength: 255
      minLength: 1
      pattern: '[a-zA-Z0-9][a-zA-Z0-9._-]{0,254}'
    InstanceTemplatesCursor:
      type: string
      examples:
      - itmplc_gqXR7s0Kj5mHvE2wNpLc4Q
      pattern: ^itmplc_[A-Za-z0-9_-]+$
    InstanceTemplateId:
      oneOf:
      - type: string
        examples:
        - itmpl_k3R-nX9vLm7Qp2Yw5Jd8F
        pattern: itmpl_[0-9a-zA-Z_-]{1,21}
      - type: string
        description: Legacy alias prefix; accepted on read, never emitted on write.
        pattern: ntmpl_[0-9a-zA-Z_-]{1,21}
      description: Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.
    InstanceTemplateResponse:
      allOf:
      - $ref: '#/components/schemas/InstanceTemplateScope'
      - type: object
        required:
        - object
        - image
        - cloud_init_user_data_used
        - created_at
        properties:
          object:
            type: string
            const: instance_template
            default: instance_template
            readOnly: true
          image:
            $ref: '#/components/schemas/ImageSummary'
            description: Machine image to use when starting instances with this template.
          cloud_init_user_data_used:
            type: boolean
            description: Whether cloud-init user data is configured for this template.
          tags:
            oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Tags'
              description: Metadata tags attached to this instance template.
          created_at:
            $ref: '#/components/schemas/UnixEpoch'
          cloud_init_user_data:
            type: string
            format: byte
            description: Base64-encoded [cloud-init user data](https://cloudinit.readthedocs.io/en/latest/explanation/format/index.html).
            example: IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo=
            contentEncoding: base64
    ResourcePathOrId_WorkspaceId:
      type: string
      description: A resource path like 'sfc:workspace:acme:my-workspace' _or_ an ID. Resource paths are human-readable but not stable - they change when resources are renamed or moved. IDs are stable and permanent.
      examples:
      - wksp_k3R-nX9vLm7Qp2Yw5Jd8F
      pattern: (wksp_[0-9a-zA-Z_-]{1,21})|(sfc:workspace:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){1,1})
    ResourcePathOrId_InstanceTemplateId:
      type: string
      description: A resource path like 'sfc:instance_template:acme:prod:my-instance_template' _or_ an ID. Resource paths are human-readable but not stable - they change when resources are renamed or moved. IDs are stable and permanent.
      examples:
      - itmpl_k3R-nX9vLm7Qp2Yw5Jd8F
      pattern: (itmpl_[0-9a-zA-Z_-]{1,21}|ntmpl_[0-9a-zA-Z_-]{1,21})|(sfc:instance_template:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
    ListInstanceTemplatesResponse:
      type: object
      required:
      - object
      - has_more
      - data
      properties:
        object:
          type: string
          const: list
          default: list
          readOnly: true
        cursor:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/InstanceTemplatesCursor'
            description: Pass as `starting_after` or `ending_before` to paginate.
        has_more:
          type: boolean
        data:
          type: array
          items:
            $ref: '#/components/schemas/InstanceTemplateResponse'
    UnixEpoch:
      type: integer
      format: int64
      description: Unix timestamp.
      example: 1738972800
    ForbiddenError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - type
          - message
          properties:
            type:
              type: string
              const: forbidden
              default: forbidden
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Create an API token using `sf tokens create` or at https://sfcompute.com/account/api-keys.