Workflow
Input format
Upload an NDJSON file (one JSON object per line). Each line contains atext field:
1. Create job
POST/v1/batch
Pass the classification config (same fields as /v1/classify). The text field is not included here — it comes from the uploaded file.
Request
| Field | Type | Required | Description |
|---|---|---|---|
labels | string[] | Yes* | Classification labels (1–200) |
classifier | string | No | Saved classifier reference (alternative to labels) |
descriptions | object | No | Per-label descriptions |
examples | object | No | Per-label example texts |
source_type | string | No | Context for prompt tuning |
mode | string | No | single (default) or multi |
threshold | number | No | Confidence threshold for multi mode (default: 0.3) |
Response (201)
Upload the file
Use theupload_url and upload_fields to upload your NDJSON file as a multipart form POST:
2. Start processing
POST/v1/batch/{job_id}/start
Validates the uploaded file exists and starts background processing.
- Only
pendingorfailedjobs can be started - One active job per account at a time (409 if another is running)
Response (202)
3. Poll status
GET/v1/batch/{job_id}
Response
| Field | Type | Description |
|---|---|---|
status | string | pending, processing, completed, or failed |
requests_total | number | Total items in the input file |
requests_completed | number | Successfully processed items |
requests_failed | number | Failed items |
estimated_tokens | number | Estimated token usage |
actual_tokens | number | Actual tokens used (null until complete) |
error | string | Error message if status is failed |
4. Download results
GET/v1/batch/{job_id}/results
Only available when status is completed.
Response
5. Delete job
DELETE/v1/batch/{job_id}
Deletes the job and its S3 files. Cannot delete jobs that are currently processing.
Response
Full example
Limits
| Limit | Value |
|---|---|
| Max file size | 5GB |
| Concurrent jobs | 1 per account |
| Pricing | $0.08 / 1M tokens |
| Speed | <15min P95 |