API referenceBatchesStream results

Stream batch results

⚠️
Preview — this feature is being built; the design below is the spec.
GET https://app.syntic.ai/v1/batches/{batch_id}/results

Stream 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

HeaderRequiredValue
AuthorizationYesBearer <key>: a private inference key (sk_live_...). See Authentication.

Path parameters

ParameterTypeDescription
batch_idstringStarts with batch_.

Query parameters

ParameterTypeDefaultDescription
resultstringsucceeded, 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.bin

Errors

Errors use the error envelope and carry a request_id. Codes specific to this operation:

StatustypecodeWhen
409conflict_errorbatch_not_endedThe batch is still running; results are available once status is completed, canceled or expired.
404not_found_errorbatch_not_foundNo batch with this id.
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.

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?