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

# Create Version

> Create a named Table sheet version, or restore from an existing version while creating a new version. Requests are scoped to the workspace associated with the API key; table, sheet, column, cell, operation, and version IDs must belong to that workspace.

Create a named version for a sheet.

Pass `name` to save the current sheet state. `name` is required when `source_version_id` is omitted.

Pass `source_version_id` to restore from an existing version while creating a new version.


## OpenAPI

````yaml POST /api/public/v2/tables/{table_id}/sheets/{sheet_id}/versions
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tables/{table_id}/sheets/{sheet_id}/versions:
    post:
      tags:
        - tables
      summary: Create Table Sheet Version
      description: >-
        Create a named Table sheet version, or restore from an existing version
        while creating a new version. Requests are scoped to the workspace
        associated with the API key; table, sheet, column, cell, operation, and
        version IDs must belong to that workspace.
      operationId: createTableSheetVersion
      parameters:
        - name: X-API-KEY
          in: header
          required: true
          schema:
            type: string
          description: >-
            Your PromptLayer API key. The key's workspace scopes table resources
            for this request.
        - name: table_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Table ID.
        - name: sheet_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Table sheet ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTableSheetVersionRequest'
      responses:
        '201':
          description: Version created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTableSheetVersionResponse'
        '400':
          description: Invalid request body or workspace context.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Table, sheet, or source version not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateTableSheetVersionRequest:
      type: object
      title: CreateTableSheetVersionRequest
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
          nullable: true
          description: Version name. Required when source_version_id is omitted.
        source_version_id:
          type: string
          format: uuid
          nullable: true
          description: Existing version to restore from while creating a new version.
      additionalProperties: false
    GetTableSheetVersionResponse:
      type: object
      title: GetTableSheetVersionResponse
      required:
        - success
        - version
      properties:
        success:
          type: boolean
        version:
          $ref: '#/components/schemas/TableSheetVersion'
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    TableSheetVersion:
      type: object
      title: TableSheetVersion
      required:
        - id
        - sheet_id
        - version_number
      properties:
        id:
          type: string
          format: uuid
        sheet_id:
          type: string
          format: uuid
        version_number:
          type: integer
          description: Sequential saved version number for this sheet.
        name:
          type: string
          nullable: true
        created_by:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
          nullable: true
        metadata:
          additionalProperties: true
          type: object
        deltas:
          type: array
          items:
            additionalProperties: true
            type: object
        snapshot:
          additionalProperties: true
          type: object
        score:
          additionalProperties: true
          type: object
        score_configuration:
          type: object
          nullable: true
          additionalProperties: true
      additionalProperties: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````