TokenLab

Files & Batches

Retrieve Batch

Retrieves the current status, counts, and result files for a batch.

GET
/v1/batches/{batch_id}

Overview

Return the batch status, request counts, and result file IDs. An unknown batch ID, or a batch of another Workspace, returns 404 batch_not_found.

status is one of validating, queued, in_progress, finalizing, completed, failed, cancelling, cancelled, or expired. The result files are ready when status is completed; read them with Retrieve File Content.

Example

Request

cURL
curl -X GET "https://api.tokenlab.sh/v1/batches/batch_abc123" \
  -H "Authorization: Bearer sk-your-api-key"

Response example

Response

200 OK
{
  "id": "batch_abc123",
  "object": "batch",
  "status": "completed",
  "input_file_id": "file_abc123",
  "output_file_id": "file_out123",
  "error_file_id": "file_err123",
  "request_counts": { "total": 100, "completed": 98, "failed": 2 }
}

Important fields

request_countsobject
Counts of total, completed, failed, and cancelled requests.
output_file_idstring|null
Successful result file ID.
error_file_idstring|null
Failed result file ID.

Authorization

BearerAuth
AuthorizationBearer <token>

API Key authentication. Create or manage API keys in Dashboard > API > API Keys.

In: header

Path Parameters

batch_id*string

Response

application/json

application/json

application/json