Batch Predictions lets you submit a shared prompt and output schema once, then process many files asynchronously through a single batch job. Each item references an existing Datagrid file and returns one NDJSON result line keyed by yourDocumentation Index
Fetch the complete documentation index at: https://developers.datagrid.com/llms.txt
Use this file to discover all available pages before exploring further.
custom_id.
Recommended flow
- Upload or identify the files you want to process with the Files API.
- Call Create batch prediction with your shared
prompt,output_schema, and item list. - Poll Retrieve batch prediction or subscribe to a terminal-state webhook until the batch reaches
completed,failed,expired, orcancelled. - Read Retrieve batch prediction results and parse the NDJSON stream one line at a time.
- If needed, stop pending work with Cancel batch prediction.
Webhooks
You can subscribe to terminal batch lifecycle events with Webhooks. Batch prediction webhook event types are:batch_prediction.completedbatch_prediction.failedbatch_prediction.expiredbatch_prediction.cancelled
Lifecycle
| Status | Meaning |
|---|---|
validating | The batch was accepted and Datagrid is validating file access, file types, and page references. |
in_progress | Items are actively being processed. |
finalizing | All item work is done and Datagrid is finishing the batch. |
completed | The batch finished successfully. Some individual items may still contain per-item errors in the results stream. |
failed | Validation or processing failed before the batch could complete normally. |
cancelling | A cancel request was accepted and remaining work is being stopped. |
cancelled | The batch reached a terminal cancelled state. Completed items remain available in the results stream. |
expired | The completion window elapsed before all items finished. Completed items remain available in the results stream. |
completion_window is currently fixed to 24h.
Request limits and validation
- A batch must contain between 1 and 5,000 items.
- The JSON request body must be no larger than 100 MiB.
- Each
custom_idmust be unique within the batch and 128 characters or fewer. pageis optional, 1-indexed, and only valid for paged file formats.metadatacan contain up to 16 string values. Keys must be 64 characters or fewer, and values must be 512 characters or fewer.output_schemamust be a valid JSON Schema Draft 2020-12 object with roottype: "object".$defs,$ref,allOf,anyOf,not,oneOf, andpatternPropertiesare not supported.
Idempotency
POST /v1/batch-predictions accepts an optional Idempotency-Key header.
- Reusing the same key with the same request body replays the original response.
- Reusing the same key with a different request body returns
409 Conflict. - Idempotency records expire after 24 hours.
Results format
The results endpoint returnsapplication/x-ndjson, not a JSON array. Split on newlines and JSON parse each non-empty line independently.
custom_id. output is only populated when status is succeeded; error is populated when status is errored, canceled, or expired.
Retention and cleanup
- Terminal batch metadata remains retrievable after processing.
- Retained result lines are currently eligible for cleanup 29 days after batch creation.
- When that happens,
results_urlbecomesnulland the results endpoint returns410 Gone.