Stream batch results
⚠️
Preview — this feature is being built; the design below is the spec.
GET https://app.syntic.ai/v1/batches/{batch_id}/resultsStream the results of an ended batch as JSONL, one line per request, successes and failures together, each tagged with your custom_id. It is the same data as the output and error files merged, so you do not need two downloads. Line order is not the input order; match on custom_id.
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. |
Path parameters
| Parameter | Type | Description |
|---|---|---|
batch_id | string | Starts with batch_. |
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
result | string | succeeded, errored, canceled or expired to stream only one kind. |
Response
200 OK
Content-Type: application/x-ndjson. Each line:
{"custom_id": "ticket-1042", "result": {"type": "succeeded", "response": {"status_code": 200, "body": {"id": "chatcmpl_01JBXF…", "choices": [{"message": {"role": "assistant", "content": "billing"}, "finish_reason": "stop"}], "usage": {"prompt_tokens": 182, "completion_tokens": 2}}}}}
{"custom_id": "ticket-1043", "result": {"type": "errored", "error": {"type": "invalid_request", "code": "context_length_exceeded", "message": "…"}}}Examples
curl -sS "https://app.syntic.ai/v1/batches/batch_01JC3D5F7H9K1M3P5R7T/results" \
-H "Authorization: Bearer $SYNTIC_API_KEY" \
-o output.binErrors
Errors use the error envelope and carry a request_id. Codes specific to this operation:
| Status | type | code | When |
|---|---|---|---|
| 409 | conflict_error | batch_not_ended | The batch is still running; results are available once status is completed, canceled or expired. |
| 404 | not_found_error | batch_not_found | No batch with this id. |
| 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. |
Results are kept for the organization’s batch_results_days (29 by default). After that this call returns 410 results_expired.
Was this page helpful?