Skip to content
Batch API
DocsREST API

Batch API

The Batch API runs one-off prompts asynchronously against a model without creating a full agent session. Submit a prompt, poll for completion, and retrieve the result.

Batch endpoints use the batch:read and batch:write permissions (separate from sessions:*).

A request's status is one of PENDING, PROCESSING, COMPLETED, or FAILED.

Create a Batch Request

POST/api/v1/batch

Requires batch:write permission. Both prompt and model are required.

Request

json
{
  "prompt": "Summarize the latest release notes",
  "model": "claude-sonnet-4-6"
}

Response 201 Created

json
{
  "requestId": "batch_abc123",
  "status": "PENDING",
  "createdAt": "2025-01-15T10:00:00Z"
}

List Batch Requests

GET/api/v1/batch

Requires batch:read permission.

Query Parameters

ParamDefaultDescription
limit20Number of requests to return (1–100)
offset0Pagination offset

Response 200 OK

json
{
  "requests": [
    {
      "requestId": "batch_abc123",
      "status": "COMPLETED",
      "model": "claude-sonnet-4-6",
      "prompt": "Summarize the latest release notes",
      "resultPreview": "The release adds...",
      "resultUrl": "https://...",
      "createdAt": "2025-01-15T10:00:00Z",
      "completedAt": "2025-01-15T10:01:30Z"
    }
  ],
  "totalCount": 12
}

Get a Batch Request

GET/api/v1/batch/{requestId}

Requires batch:read permission. Poll this endpoint to check status and retrieve the result.

Response 200 OK

json
{
  "requestId": "batch_abc123",
  "status": "COMPLETED",
  "model": "claude-sonnet-4-6",
  "prompt": "Summarize the latest release notes",
  "resultPreview": "The release adds...",
  "resultUrl": "https://...",
  "errorMessage": "",
  "createdAt": "2025-01-15T10:00:00Z",
  "completedAt": "2025-01-15T10:01:30Z"
}

resultUrl points to the full result; resultPreview is a truncated inline preview. errorMessage is populated only when the request failed.

Cancel a Batch Request

POST/api/v1/batch/{requestId}/cancel

Requires batch:write permission. No request body needed. Only requests still in PENDING status can be cancelled — once a request is PROCESSING, COMPLETED, or FAILED, cancellation is rejected.

Response 200 OK

json
{
  "success": true
}