> ## 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 Table Sheet Request Log Import

> Import request history into an existing Table sheet.

Start an asynchronous request-history import into an existing Table sheet.

Provide either `request_log_ids` or a request-log `filter_group`. You can also pass `variables_to_parse`, `include_fields`, and `limit` to control imported columns and rows. `request_log_ids` and `limit` support up to 50,000 rows.

Pass `operation_id` when you want a stable client-side identifier for polling and webhook correlation. If omitted, PromptLayer generates one.

The response returns an `operation_id` and `status_url` for polling with [Get Table Sheet Import Operation](/reference/get-table-sheet-operation).


## OpenAPI

````yaml POST /api/public/v2/tables/{table_id}/sheets/{sheet_id}/imports/request-logs
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tables/{table_id}/sheets/{sheet_id}/imports/request-logs:
    post:
      tags:
        - tables
      summary: Import Request Logs Into Table Sheet
      description: >-
        Start an asynchronous request-history import into an existing Table
        sheet. 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: createTableSheetRequestLogImport
      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/CreateTableSheetRequestLogImportRequest'
      responses:
        '202':
          description: Request-history import queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TableSheetImportStartResponse'
        '400':
          description: Invalid request body, request logs, 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 or sheet not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateTableSheetRequestLogImportRequest:
      type: object
      title: CreateTableSheetRequestLogImportRequest
      description: >-
        Import request history into an existing Table sheet. Provide either
        request_log_ids or filter_group.
      properties:
        filter_group:
          $ref: '#/components/schemas/StructuredFilterGroup'
          nullable: true
          description: Nested filter group with AND/OR logic. Use this for complex queries.
        q:
          type: string
          nullable: true
          description: Free-text request-log search query applied with filter_group.
        sort_by:
          type: string
          nullable: true
          enum:
            - request_start_time
            - input_tokens
            - output_tokens
            - cost
            - latency_ms
            - status
          description: Field to sort matching request logs before import.
        sort_order:
          type: string
          nullable: true
          enum:
            - asc
            - desc
          description: Sort direction. Must be provided together with sort_by.
        metadata_cost_breakdown_key:
          type: string
          nullable: true
          description: >-
            Request-log query metadata key used by shared request-log query
            payloads.
        operation_id:
          type: string
          nullable: true
          description: >-
            Optional client-provided operation ID. A UUID is generated when
            omitted.
        request_log_ids:
          type: array
          items:
            type: integer
            minimum: 1
          nullable: true
          description: Specific request log IDs to import.
          minItems: 1
          maxItems: 50000
        variables_to_parse:
          type: array
          items:
            type: string
          default: []
          description: Input variable names to parse from matching request logs.
        include_fields:
          type: array
          items:
            type: string
          nullable: true
          description: Additional request log fields to include as columns.
        limit:
          type: integer
          minimum: 1
          nullable: true
          description: Maximum number of matching request logs to import.
          maximum: 50000
      additionalProperties: false
    TableSheetImportStartResponse:
      type: object
      title: TableSheetImportStartResponse
      required:
        - success
        - message
        - operation_id
        - operation
        - status_url
      properties:
        success:
          type: boolean
        message:
          type: string
        operation_id:
          type: string
        operation:
          $ref: '#/components/schemas/TableImportOperation'
        status_url:
          type: string
      additionalProperties: false
    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.
    StructuredFilterGroup:
      type: object
      title: StructuredFilterGroup
      description: >-
        A group of filters combined with AND or OR logic. Can be nested
        recursively.
      required:
        - filters
      properties:
        logic:
          type: string
          enum:
            - AND
            - OR
          default: AND
          description: How to combine the filters in this group.
        filters:
          type: array
          description: List of filters or nested filter groups.
          items:
            oneOf:
              - $ref: '#/components/schemas/StructuredFilter'
              - $ref: '#/components/schemas/StructuredFilterGroup'
    TableImportOperation:
      type: object
      description: Status of an asynchronous sheet import operation.
      properties:
        operation_id:
          type: string
        source:
          type: string
          enum:
            - file
            - request_logs
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
        progress:
          type: number
          nullable: true
        message:
          type: string
          nullable: true
        rows_added:
          type: integer
          nullable: true
        row_count:
          type: integer
          nullable: true
        file_name:
          type: string
          nullable: true
        error_message:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
          nullable: true
        updated_at:
          type: string
          format: date-time
          nullable: true
    StructuredFilter:
      type: object
      title: StructuredFilter
      description: A single filter condition on a request log field.
      required:
        - field
        - operator
      properties:
        field:
          type: string
          description: >-
            The request log field to filter on. Intent fields are virtual fields
            that classify request content by tone and do not require any
            additional logging configuration. `user_intent` classifies the
            user's message; valid values: `frustrated`, `satisfied`, `curious`.
            `agent_intent` classifies the agent's response; valid values:
            `apologetic`, `refusal`, `uncertain`. Intent fields support
            operators: `is`, `is_not`, `in`, `not_in`.
          enum:
            - pl_id
            - prompt_id
            - engine
            - provider_type
            - input_text
            - output_text
            - prompt_version_number
            - input_tokens
            - output_tokens
            - cost
            - latency_ms
            - request_start_time
            - request_end_time
            - status
            - is_json
            - is_tool_call
            - is_plain_text
            - tags
            - metadata_keys
            - metadata
            - tool_names
            - output
            - output_keys
            - input_variables
            - input_variable_keys
            - user_intent
            - agent_intent
        operator:
          type: string
          description: The comparison operator.
          enum:
            - is
            - is_not
            - in
            - not_in
            - contains
            - not_contains
            - starts_with
            - ends_with
            - eq
            - neq
            - gt
            - gte
            - lt
            - lte
            - between
            - before
            - after
            - is_true
            - is_false
            - is_empty
            - is_not_empty
            - is_null
            - is_not_null
            - key_equals
            - key_not_equals
            - key_contains
        value:
          description: >-
            The value to compare against. Type depends on the field and
            operator.
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
            - type: 'null'
        nested_key:
          type: string
          nullable: true
          description: >-
            Required for nested fields (metadata, output, input_variables).
            Specifies which key within the nested object to filter on.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````