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

# Snapshot instance

> Take a snapshot of an instance and create an image from it.



## OpenAPI

````yaml /openapi/compute-openapi.yaml post /api/v2/instances/{instanceID}/snapshot
openapi: 3.0.3
info:
  title: Compute Service API
  description: >-
    The Compute Service API provides services that allows provisioning and life
    cycle

    management of Compute clusters.
  version: 1.13.0
servers:
  - url: https://compute.nks.europe-west4.nscale.com
security: []
paths:
  /api/v2/instances/{instanceID}/snapshot:
    description: Create an image from a compute instance.
    parameters:
      - $ref: '#/components/parameters/instanceIDParameter'
    post:
      tags:
        - Instances
      summary: Snapshot instance
      description: Take a snapshot of an instance and create an image from it.
      requestBody:
        $ref: '#/components/requestBodies/instanceSnapshotRequest'
      responses:
        '201':
          $ref: '#/components/responses/imageResponse'
        '400':
          $ref: '#/components/responses/badRequestResponse'
        '401':
          $ref: '#/components/responses/unauthorizedResponse'
        '403':
          $ref: '#/components/responses/forbiddenResponse'
        '404':
          $ref: '#/components/responses/notFoundResponse'
        '500':
          $ref: '#/components/responses/internalServerErrorResponse'
      security:
        - oauth2Authentication: []
components:
  parameters:
    instanceIDParameter:
      name: instanceID
      in: path
      description: The instance ID.
      required: true
      schema:
        $ref: '#/components/schemas/kubernetesNameParameter'
  requestBodies:
    instanceSnapshotRequest:
      description: A request to snapshot an instance.
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/instanceSnapshotCreate'
          example:
            metadata:
              name: my-instance-snapshot
  responses:
    imageResponse:
      description: An image that can be used on this platform.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/image'
          example:
            metadata:
              id: a64f9269-36e0-4312-b8d1-52d93d569b7b
              name: ubu2204-v1.25.6-gpu-525.85.05-7ced4154
              creationTime: '2023-02-22T12:04:13Z'
            spec:
              architecture: x86_64
              sizeGiB: 10
              virtualization: virtualized
              os:
                kernel: linux
                family: debian
                distro: ubuntu
                variant: server
                codename: noble
                version: '24.04'
              softwareVersions:
                kubernetes: v1.25.6
              gpu:
                vendor: NVIDIA
                driver: 525.85.05
                models:
                  - A100
                  - H100
                  - H200
            status:
              state: ready
    badRequestResponse:
      description: |-
        Request body failed schema validation, or the request does not contain
        all the required fields.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            error: invalid_request
            error_description: request body invalid
    unauthorizedResponse:
      description: Authentication failed or the access token has expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            error: access_denied
            error_description: authentication failed
    forbiddenResponse:
      description: >-
        Request was denied by authorization, this may be caused by the
        authorization

        token not having the required scope for an API, or the user doesn't have
        the

        necessary privileges on the provider platform.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            error: forbidden
            error_description: user credentials do not have the required privileges
    notFoundResponse:
      description: Unable to find a resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            error: not_found
            error_description: the requested resource does not exist
    internalServerErrorResponse:
      description: >-
        An unexpected or unhandled error occurred. This may be a transient error
        and

        may succeed on a retry.  If this isn't the case, please report it as an
        issue.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            error: server_error
            error_description: failed to token claim
  schemas:
    kubernetesNameParameter:
      description: >-
        A Kubernetes name. Must be a valid DNS containing only lower case
        characters, numbers or hyphens, start and end with a character or
        number, and be at most 63 characters in length.
      type: string
      minLength: 1
      maxLength: 63
    instanceSnapshotCreate:
      description: A compute instance snapshot request.
      type: object
      required:
        - metadata
      properties:
        metadata:
          $ref: '#/components/schemas/resourceMetadata'
    image:
      description: An image.
      type: object
      required:
        - metadata
        - spec
        - status
      properties:
        metadata:
          $ref: '#/components/schemas/staticResourceMetadata'
        spec:
          $ref: '#/components/schemas/imageSpec'
        status:
          $ref: '#/components/schemas/imageStatus'
    error:
      description: Generic error message, compatible with oauth2.
      type: object
      required:
        - error
        - error_description
      properties:
        error:
          description: >-
            A terse error string expanding on the HTTP error code. Errors are
            based on the OAuth 2.02 specification, but are expanded with
            proprietary status codes for APIs other than those specified by
            OAuth 2.02.
          type: string
          enum:
            - invalid_request
            - server_error
            - access_denied
            - not_found
            - conflict
            - method_not_allowed
            - unsupported_media_type
            - request_entity_too_large
            - unprocessable_content
            - forbidden
        error_description:
          description: Verbose message describing the error.
          type: string
    resourceMetadata:
      description: Metadata required for all API resource reads and writes.
      required:
        - name
      properties:
        name:
          $ref: '#/components/schemas/kubernetesLabelValue'
        description:
          description: >-
            The resource description, this optionally augments the name with
            more context.
          type: string
        tags:
          $ref: '#/components/schemas/tagList'
    staticResourceMetadata:
      description: |
        This metadata is for resources that just exist, and don't require
        any provisioning and health status, but benefit from a standardized
        metadata format.
      type: object
      allOf:
        - $ref: '#/components/schemas/resourceMetadata'
        - type: object
          required:
            - id
            - creationTime
          properties:
            id:
              description: The unique resource ID.
              type: string
            creationTime:
              description: The time the resource was created.
              type: string
              format: date-time
            createdBy:
              description: The user who created the resource.
              type: string
            modifiedTime:
              description: The time a resource was updated.
              type: string
              format: date-time
            modifiedBy:
              description: The user who updated the resource.
              type: string
    imageSpec:
      description: An image.
      type: object
      required:
        - sizeGiB
        - virtualization
        - os
        - architecture
      properties:
        architecture:
          $ref: '#/components/schemas/architecture'
        sizeGiB:
          description: Minimum disk size required to use the image in GiB.
          type: integer
        virtualization:
          $ref: '#/components/schemas/imageVirtualization'
        os:
          $ref: '#/components/schemas/imageOS'
        softwareVersions:
          $ref: '#/components/schemas/softwareVersions'
        gpu:
          $ref: '#/components/schemas/imageGpu'
    imageStatus:
      description: The image's status.
      type: object
      required:
        - state
      properties:
        state:
          $ref: '#/components/schemas/imageState'
    kubernetesLabelValue:
      description: >-
        A valid Kubernetes label value, typically used for resource names that
        can be

        indexed in the database.
      type: string
      pattern: ^[0-9A-Za-z](?:[0-9A-Za-z-_.]{0,61}[0-9A-Za-z])?$
    tagList:
      description: A list of tags.
      type: array
      items:
        $ref: '#/components/schemas/tag'
    architecture:
      type: string
      description: CPU architecture.
      enum:
        - x86_64
        - aarch64
    imageVirtualization:
      description: What type of machine the image is for.
      type: string
      enum:
        - virtualized
        - baremetal
        - any
    imageOS:
      description: An operating system description.
      type: object
      required:
        - kernel
        - family
        - distro
        - version
      properties:
        kernel:
          $ref: '#/components/schemas/osKernel'
        family:
          $ref: '#/components/schemas/osFamily'
        distro:
          $ref: '#/components/schemas/osDistro'
        variant:
          description: A free form variant e.g. desktop/server.
          type: string
        codename:
          description: A free form code name e.g. warty/bionic.
          type: string
        version:
          description: Version of the operating system e.g. "24.04".
          type: string
    softwareVersions:
      description: Image preinstalled version version metadata.
      type: object
      additionalProperties:
        $ref: '#/components/schemas/semver'
    imageGpu:
      description: The GPU driver if installed.
      type: object
      required:
        - vendor
        - driver
      properties:
        vendor:
          $ref: '#/components/schemas/gpuVendor'
        driver:
          description: The GPU driver version, this is vendor specific.
          type: string
        models:
          $ref: '#/components/schemas/gpuModelList'
    imageState:
      description: The images's lifecycle state.
      type: string
      enum:
        - pending
        - creating
        - ready
        - failed
    tag:
      description: >-
        A tag mapping arbitrary names to values.  These have no special meaning

        for any component are are intended for use by end users to add
        additional

        context to a resource, for example to categorize it.
      type: object
      required:
        - name
        - value
      properties:
        name:
          description: A unique tag name.
          type: string
        value:
          description: The value of the tag.
          type: string
    osKernel:
      description: A kernel type.
      type: string
      enum:
        - linux
    osFamily:
      description: >-
        A family of operating systems.  This typically defines the package
        format.
      type: string
      enum:
        - redhat
        - debian
    osDistro:
      description: A distribution name.
      type: string
      enum:
        - rocky
        - ubuntu
    semver:
      description: |-
        A semantic version in the form v1.2.3.
        Pre-releases and variants are not currently supported.
      type: string
      pattern: ^v\d+\.\d+\.\d+$
    gpuVendor:
      description: The GPU vendor.
      type: string
      enum:
        - NVIDIA
        - AMD
    gpuModelList:
      description: A list of GPU model numbers.
      type: array
      items:
        $ref: '#/components/schemas/gpuModel'
    gpuModel:
      description: A GPU model number.
      type: string
  securitySchemes:
    oauth2Authentication:
      description: Operation requires OAuth 2.0 bearer token authentication.
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://identity.nks.europe-west4.nscale.com/oauth2/v2/authorization
          tokenUrl: https://identity.nks.europe-west4.nscale.com/oauth2/v2/token
          scopes: {}

````