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

> Add a new column to a sheet. Non-text columns will generate cells for all existing rows. Requests are scoped to the workspace associated with the API key; table, sheet, column, cell, operation, and version IDs must belong to that workspace.

Add a new column to a sheet. For non-text columns, cells for all existing rows are created with `stale` status and queued for computation.

Use `dependencies` to declare which other columns this column's config references. PromptLayer enforces a DAG (no cycles allowed) and uses the dependency graph to propagate staleness when upstream cells change.

Creating a column creates a new sheet version. The response returns `version`, the current sheet version count after the column is added.


## OpenAPI

````yaml POST /api/public/v2/tables/{table_id}/sheets/{sheet_id}/columns
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tables/{table_id}/sheets/{sheet_id}/columns:
    post:
      tags:
        - smart-tables
      summary: Create Column
      description: >-
        Add a new column to a sheet. Non-text columns will generate cells for
        all existing rows. 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: create_table_sheet_column
      parameters:
        - name: table_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: sheet_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - title
                - type
              properties:
                title:
                  type: string
                type:
                  type: string
                  enum:
                    - text
                    - prompt_template
                    - llm
                    - code
                    - score
                    - comparison
                    - composition
                config:
                  type: object
                  nullable: true
                  description: Type-specific column configuration.
                dependencies:
                  type: array
                  nullable: true
                  description: Column dependency edges for non-text columns.
                  items:
                    type: object
                    required:
                      - column_id
                    properties:
                      column_id:
                        type: string
                        format: uuid
                      reference_type:
                        type: string
                        default: value
                      config_key:
                        type: string
                        nullable: true
                      config_meta:
                        type: object
                        nullable: true
      responses:
        '201':
          description: Column created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  column:
                    $ref: '#/components/schemas/Column'
                  cells:
                    type: array
                    items:
                      $ref: '#/components/schemas/Cell'
                  version:
                    type: integer
                    description: >-
                      Current sheet version_count for this response. It matches
                      the sheet's version_count after any committed changes.
        '400':
          description: Cycle detected or invalid config
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Table or sheet not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    Column:
      type: object
      description: A column within a Table sheet.
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the column.
        sheet_id:
          type: string
          format: uuid
        workspace_id:
          type: integer
          description: >-
            Workspace that owns this resource; determined by the authenticated
            request scope.
        title:
          type: string
          description: Display title of the column.
        type:
          type: string
          description: >-
            Column type. 'text' columns store free-text; 'prompt_template',
            'llm', 'code', 'score', 'comparison', and 'composition' columns run
            automated computations.
          enum:
            - text
            - prompt_template
            - llm
            - code
            - score
            - comparison
            - composition
        config:
          type: object
          description: Type-specific configuration. Shape depends on the column type.
        position_rank:
          type: number
          description: Fractional position rank used for ordering.
        is_output_column:
          type: boolean
          description: Whether this column is designated as an output column.
    Cell:
      type: object
      description: A single cell at the intersection of a column and a row.
      properties:
        id:
          type: string
          format: uuid
        sheet_id:
          type: string
          format: uuid
        column_id:
          type: string
          format: uuid
        row_index:
          type: integer
        status:
          type: string
          enum:
            - completed
            - stale
            - running
            - queued
            - error
            - cancelled
          description: Current computation status of the cell.
        display_value:
          type: string
          nullable: true
        value:
          description: Structured cell value (type depends on column type).
        error:
          type: string
          nullable: true
        input_hash:
          type: string
          nullable: true
          description: >-
            Hash of the inputs used to compute this cell, used for cache
            invalidation.
        updated_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp of the last update.
        request_metrics:
          allOf:
            - $ref: '#/components/schemas/SmartTableRequestMetrics'
          nullable: true
          description: >-
            Execution metrics populated for prompt-template column cells.
            Present only when the cell has an associated request log.
        execution_id:
          type: string
          format: uuid
          nullable: true
          description: >-
            Execution ID associated with the current or most recent computed
            value, when available.
        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.
        error_message:
          type: string
          nullable: true
          description: >-
            User-visible error message for failed computed cells, when
            available.
    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.
    SmartTableRequestMetrics:
      type: object
      description: >-
        Execution metrics for a prompt-template cell, derived from the
        underlying request log.
      properties:
        request_count:
          type: integer
          description: Number of LLM requests made to produce this cell's value.
        request_ids:
          type: array
          items:
            type: integer
          description: IDs of the request logs associated with this cell.
        latency_ms:
          type: integer
          nullable: true
          description: Total end-to-end latency in milliseconds.
        price:
          type: number
          nullable: true
          description: Total cost in USD for all requests that produced this cell.
        input_tokens:
          type: integer
          nullable: true
          description: Total number of input tokens across all requests.
        output_tokens:
          type: integer
          nullable: true
          description: Total number of output tokens across all requests.
        trace_ids:
          type: array
          items:
            type: string
          description: >-
            Trace IDs linked to this cell (present when the cell was produced
            via an OpenTelemetry-traced workflow).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  responses:
    UnauthorizedError:
      description: Unauthorized - missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error - request parameters or body are invalid.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/HTTPValidationError'
              - $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````