Create a batch
⚠️
Preview — this feature is being built; the design below is the spec.
POST https://app.syntic.ai/v1/batchesSubmit up to 50,000 requests to run within 24 hours at half the usual token price. Send either an uploaded JSONL file (purpose: "batch") or up to 1,000 requests inline. Each line has your custom_id, the target endpoint and a normal request body without streaming.
For how this fits into a full workflow, see Batches.
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer <key>: a private inference key (sk_live_...). See Authentication. |
Content-Type | Yes | application/json |
Idempotency-Key | No | Up to 255 characters. Retrying with the same key within 24 hours returns the first result instead of creating a duplicate. See Idempotency. |
Body parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
input_file_id | string | One of these two | A file uploaded with purpose: "batch". |
requests | array | One of these two | Up to 1,000 objects of the form {custom_id, endpoint, body}. |
completion_window | string | No | Only "24h". |
metadata | object | No | Up to 16 string keys and values. |
Response
201 Created, Content-Type: application/json
{
"id": "batch_01JBXF3P8K",
"object": "batch",
"status": "validating",
"input_file_id": "file_01JBXF1Z",
"output_file_id": null,
"error_file_id": null,
"request_counts": {
"total": 5000,
"succeeded": 0,
"failed": 0,
"canceled": 0
},
"created_at": 1791820800,
"started_at": null,
"ends_by": 1791907200,
"completed_at": null,
"metadata": {
"job": "october-tickets"
}
}| Field | Type | Description |
|---|---|---|
id | string | Starts with batch_. |
object | string | Always batch. |
status | string | validating, in_progress, canceling, completed, expired, canceled or failed. |
input_file_id | string or null | The input file, or null for an inline batch. |
output_file_id | string or null | Results file, set once the batch reaches a final state with any finished lines. |
error_file_id | string or null | Set when validation found problems; lists them by line. |
request_counts | object | total, succeeded, failed and canceled. |
created_at | integer | Unix seconds. |
started_at | integer or null | When the first request started. |
ends_by | integer | The end of the 24-hour window. |
completed_at | integer or null | When the batch reached a final state. |
metadata | object | Your string pairs, returned unchanged. |
Examples
curl -sS https://app.syntic.ai/v1/batches \
-H "Authorization: Bearer $SYNTIC_API_KEY" \
-H "Idempotency-Key: 8d6f0c1e-4b2a-4a57-9f0e-2f1d3c4b5a69" \
-H "Content-Type: application/json" \
-d '{
"input_file_id": "file_01JBXF1Z",
"completion_window": "24h",
"metadata": {
"job": "october-tickets"
}
}'Errors
Errors use the error envelope and carry a request_id. Codes specific to this operation:
| Status | type | code | When |
|---|---|---|---|
| 400 | invalid_request_error | invalid_batch_file | A line is not valid JSON or is missing a field; message gives the line number. |
| 400 | invalid_request_error | duplicate_custom_id | Two lines share a custom_id. |
| 400 | invalid_request_error | streaming_not_allowed | A body sets stream: true. |
| 400 | invalid_request_error | too_many_requests_in_batch | More than 50,000 lines or 500 MB. |
| 404 | not_found_error | file_not_found | input_file_id does not exist in this workspace. |
| 429 | rate_limit_error | batch_queue_full | Too many queued requests for your organization. |
| 401 | authentication_error | invalid_api_key | The key is missing, unknown, revoked or expired. |
| 429 | rate_limit_error | rate_limited | Too many requests; wait for Retry-After. See Rate-limit headers. |
Related
Was this page helpful?