API referenceBatchesCreate a batch

Create a batch

⚠️
Preview — this feature is being built; the design below is the spec.
POST https://app.syntic.ai/v1/batches

Submit 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

HeaderRequiredValue
AuthorizationYesBearer <key>: a private inference key (sk_live_...). See Authentication.
Content-TypeYesapplication/json
Idempotency-KeyNoUp to 255 characters. Retrying with the same key within 24 hours returns the first result instead of creating a duplicate. See Idempotency.

Body parameters

ParameterTypeRequiredNotes
input_file_idstringOne of these twoA file uploaded with purpose: "batch".
requestsarrayOne of these twoUp to 1,000 objects of the form {custom_id, endpoint, body}.
completion_windowstringNoOnly "24h".
metadataobjectNoUp 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"
  }
}
FieldTypeDescription
idstringStarts with batch_.
objectstringAlways batch.
statusstringvalidating, in_progress, canceling, completed, expired, canceled or failed.
input_file_idstring or nullThe input file, or null for an inline batch.
output_file_idstring or nullResults file, set once the batch reaches a final state with any finished lines.
error_file_idstring or nullSet when validation found problems; lists them by line.
request_countsobjecttotal, succeeded, failed and canceled.
created_atintegerUnix seconds.
started_atinteger or nullWhen the first request started.
ends_byintegerThe end of the 24-hour window.
completed_atinteger or nullWhen the batch reached a final state.
metadataobjectYour 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:

StatustypecodeWhen
400invalid_request_errorinvalid_batch_fileA line is not valid JSON or is missing a field; message gives the line number.
400invalid_request_errorduplicate_custom_idTwo lines share a custom_id.
400invalid_request_errorstreaming_not_allowedA body sets stream: true.
400invalid_request_errortoo_many_requests_in_batchMore than 50,000 lines or 500 MB.
404not_found_errorfile_not_foundinput_file_id does not exist in this workspace.
429rate_limit_errorbatch_queue_fullToo many queued requests for your organization.
401authentication_errorinvalid_api_keyThe key is missing, unknown, revoked or expired.
429rate_limit_errorrate_limitedToo many requests; wait for Retry-After. See Rate-limit headers.
Was this page helpful?