> ## 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 Operation

> Queue a recalculation operation for selected columns, rows, and cell statuses. Requests are scoped to the workspace associated with the API key; table, sheet, column, cell, operation, and version IDs must belong to that workspace.

Queue a `recalculate` operation for selected columns, rows, and cell statuses.

By default, recalculation targets stale computed cells. Pass `column_ids`, `row_ids`, or `statuses` to narrow the operation.

`row_ids` are zero-based row indices. `statuses` accepts `STALE`, `QUEUED`, `DISPATCHED`, `RUNNING`, `COMPLETED`, and `FAILED`; omit it to target stale cells, or pass an empty array to include all statuses. Text columns cannot be recalculated.

If the operation affects many cells, the response may return `requires_confirmation` with a `confirmation_token`; pass that token in a follow-up request to proceed. If no matching cells need work, the endpoint can return success with `cell_count: 0`.

Queued recalculations return `version`, the sheet version count used for the operation response. Computed cells report `last_computed_version` after they complete.


## OpenAPI

````yaml POST /api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations:
    post:
      tags:
        - tables
      summary: Create Table Sheet Operation
      description: >-
        Queue a recalculation operation for selected columns, rows, and cell
        statuses. 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: createTableSheetOperation
      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/CreateTableSheetOperationRequest'
      responses:
        '200':
          description: No operation was queued or confirmation is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTableSheetOperationResponse'
        '202':
          description: Operation queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTableSheetOperationResponse'
        '400':
          description: Invalid request, query parameter, 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 column not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateTableSheetOperationRequest:
      type: object
      title: CreateTableSheetOperationRequest
      properties:
        operation:
          type: string
          enum:
            - recalculate
          default: recalculate
        column_ids:
          type: array
          nullable: true
          items:
            type: string
            format: uuid
          description: Columns to recalculate. Text columns cannot be recalculated.
        row_ids:
          type: array
          nullable: true
          items:
            type: integer
            minimum: 0
          description: >-
            Zero-based row indices to recalculate. If omitted, matching cells
            across all rows are considered.
        statuses:
          type: array
          nullable: true
          items:
            type: string
            enum:
              - STALE
              - QUEUED
              - DISPATCHED
              - RUNNING
              - COMPLETED
              - FAILED
          description: >-
            Cell statuses to include. Defaults to stale cells. Pass an empty
            array to include all statuses.
        confirmation_token:
          type: string
          nullable: true
          description: >-
            Confirmation token returned when the operation exceeds the
            confirmation threshold.
      additionalProperties: false
    CreateTableSheetOperationResponse:
      title: CreateTableSheetOperationResponse
      oneOf:
        - $ref: '#/components/schemas/CreateTableSheetOperationQueuedResponse'
        - $ref: '#/components/schemas/CreateTableSheetOperationNoopResponse'
        - $ref: '#/components/schemas/CreateTableSheetOperationConfirmationResponse'
    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.
    CreateTableSheetOperationQueuedResponse:
      type: object
      title: CreateTableSheetOperationQueuedResponse
      required:
        - success
        - operation
        - operation_id
        - execution_id
        - execution_ids
        - cell_count
        - version
        - status_url
        - virtual_cell_count
        - cells
      properties:
        success:
          type: boolean
          enum:
            - true
        operation:
          type: string
          enum:
            - recalculate
        operation_id:
          type: string
        execution_id:
          type: string
        execution_ids:
          type: array
          items:
            type: string
        cell_count:
          type: integer
        version:
          type: integer
        status_url:
          type: string
        virtual_cell_count:
          type: integer
        cells:
          type: array
          items:
            $ref: '#/components/schemas/TableCell'
      additionalProperties: false
    CreateTableSheetOperationNoopResponse:
      type: object
      title: CreateTableSheetOperationNoopResponse
      required:
        - success
        - cell_count
        - virtual_cell_count
        - cells
      properties:
        success:
          type: boolean
          enum:
            - true
        cell_count:
          type: integer
          enum:
            - 0
        virtual_cell_count:
          type: integer
        cells:
          type: array
          items:
            $ref: '#/components/schemas/TableCell'
      additionalProperties: false
    CreateTableSheetOperationConfirmationResponse:
      type: object
      title: CreateTableSheetOperationConfirmationResponse
      required:
        - success
        - requires_confirmation
        - confirmation_token
        - affected_cell_count
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
        requires_confirmation:
          type: boolean
          enum:
            - true
        confirmation_token:
          type: string
        affected_cell_count:
          type: integer
        message:
          type: string
      additionalProperties: false
    TableCell:
      type: object
      title: TableCell
      required:
        - id
        - sheet_id
        - column_id
        - row_index
        - status
      properties:
        id:
          type: string
          description: Cell UUID, or a virtual cell ID for not-yet-computed output cells.
        sheet_id:
          type: string
          format: uuid
        execution_id:
          type: string
          format: uuid
          nullable: true
          description: >-
            Execution ID associated with the current or most recent computed
            value, when available.
        column_id:
          type: string
          format: uuid
        row_index:
          type: integer
        last_computed_version:
          type: integer
          nullable: true
          description: >-
            Sheet version_count when this cell was last computed. Null for text
            cells, virtual cells, or cells that have not completed computation.
        status:
          type: string
          enum:
            - STALE
            - QUEUED
            - DISPATCHED
            - RUNNING
            - COMPLETED
            - FAILED
        display_value:
          type: string
          nullable: true
        input_hash:
          type: string
          nullable: true
        value:
          nullable: true
          description: Structured cell value. Shape depends on the column type.
        updated_at:
          type: string
          format: date-time
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````