Skip to main content
POST
/
api
/
public
/
v2
/
tables
/
{table_id}
/
sheets
Create Sheet
curl --request POST \
  --url https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "source": {
    "file_name": "<string>",
    "file_content_base64": "<string>"
  },
  "title": "<string>",
  "index": 123,
  "operation_id": "<string>"
}
'
{
  "success": true,
  "message": "<string>",
  "operation_id": "<string>",
  "operation": {
    "operation_id": "<string>",
    "progress": 123,
    "message": "<string>",
    "rows_added": 123,
    "row_count": 123,
    "file_name": "<string>",
    "error_message": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  },
  "sheet": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "table_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "workspace_id": 123,
    "title": "<string>",
    "index": 123,
    "row_count": 123,
    "version_count": 123,
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}
Create a new sheet and start an asynchronous import job. The response returns immediately with 202, an operation_id, the import operation, and the newly created sheet.

File imports

Use source.type=file to import CSV or JSON content. Send the file content as base64 in file_content_base64; the decoded file can be up to 100MB. JSON input is converted to CSV before processing.

Request log imports

Use source.type=request_logs to import request history into a sheet. Provide either explicit request_log_ids or a request-log filter_group. You can also pass variables_to_parse, include_fields, and limit to control the imported columns and rows.

Operation tracking

Pass operation_id when you want a stable client-side identifier for polling and webhook correlation. If omitted, PromptLayer generates one. Poll Get Table Sheet Import Operation until the operation reaches succeeded or failed.

Authorizations

X-API-KEY
string
header
required

Path Parameters

table_id
string<uuid>
required

Body

application/json
source
File source · object
required

Data source for the sheet.

title
string | null

Sheet title. Defaults to the source file name or 'Request Logs'.

index
integer | null

Display position within the table (0-based). Defaults to appending at the end.

operation_id
string | null

Optional idempotency key for the import operation.

Response

Import started. Poll the operation endpoint to track progress.

success
boolean
message
string
operation_id
string
operation
object

Status of an asynchronous sheet import operation.

sheet
object

A sheet within a Table.