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

# Add Rows

> Append one or more rows to a sheet. Text column values can be set immediately; non-text column cells are created with `stale` status and must be triggered via a recalculation. Requests are scoped to the workspace associated with the API key; table, sheet, column, cell, operation, and version IDs must belong to that workspace.

Append one or more rows (up to 100 at a time) to a sheet.

Text column values can be set immediately via the `values` array. Non-text column cells are created with `stale` status — trigger a [recalculation](/reference/table-sheet-cells-recalculate) to compute them.

Adding rows creates a new sheet version. The response returns `version`, the current sheet version count after the rows are appended.


## OpenAPI

````yaml POST /api/public/v2/tables/{table_id}/sheets/{sheet_id}/rows
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tables/{table_id}/sheets/{sheet_id}/rows:
    post:
      tags:
        - smart-tables
      summary: Add Rows
      description: >-
        Append one or more rows to a sheet. Text column values can be set
        immediately; non-text column cells are created with `stale` status and
        must be triggered via a recalculation. 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: add_table_sheet_rows
      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: false
        content:
          application/json:
            schema:
              type: object
              properties:
                count:
                  type: integer
                  description: Number of rows to append (1–100).
                  default: 1
                  minimum: 1
                  maximum: 100
                values:
                  type: array
                  nullable: true
                  description: >-
                    Per-row initial values for text columns. Each element is a
                    map of column_id → value.
                  items:
                    additionalProperties: true
                    type: object
      responses:
        '201':
          description: Rows added
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  rows_created:
                    type: integer
                  start_row_index:
                    type: integer
                  row_indices:
                    type: array
                    items:
                      type: integer
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        row_index:
                          type: integer
                        cells:
                          type: object
                          additionalProperties:
                            $ref: '#/components/schemas/Cell'
                  cell_count:
                    type: integer
                  row_count:
                    type: integer
                  version:
                    type: integer
                    description: >-
                      Current sheet version_count for this response. It matches
                      the sheet's version_count after any committed changes.
        '400':
          description: No columns defined
          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:
    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

````