Retrieve batch results
Use this method to retrieve the results for each item in a batch. You can call it while the batch has the pending or processing status.
Each result entry has a status. For details on each status, see the Item statuses section on the The batch object page.
Each result entry includes a task identifier in the task_id field. Use this value with the GET method of the /analyze/tasks/{task_id} endpoint if you need the full analysis task response.
You can retrieve results for 30 days after batch creation.
Authentication
Your API key.
You can find your API key on the API Keys page.
Path parameters
Response
The response is a JSON Lines (application/jsonl) stream. Each line is a JSON object containing one result entry for a batch item.
Example body with four result entries:
{"task_id":"68f4ddaf8aaa60d33df0e900","custom_id":"summary-001","status":"ready","data":{"generation_id":"gen_xyz789","data":"This video covers the keynote launch...","finish_reason":"stop","usage":{"output_tokens":150,"input_tokens":45}}}
{"task_id":"68f4ddaf8aaa60d33df0e901","custom_id":"summary-002","status":"failed","error":{"code":"asset_unavailable","message":"The asset could not be read."}}
{"task_id":"68f4ddaf8aaa60d33df0e902","custom_id":"summary-003","status":"processing"}
{"task_id":"68f4ddaf8aaa60d33df0e903","custom_id":"summary-004","status":"queued"}
The custom identifier you provided when you created the batch. If you did not provide one, this field is null.
The status of a result entry. This field is different from the batch status. For the meaning of each value, see the Item statuses section on the The batch object page.
Contains the analysis result for an item in the ready status. The analysis text is in this object’s nested data field. The envelope uses the same schema as the result field in the GET method of the /analyze/tasks/{task_id} endpoint.