POST /api/v1/forward/batches
Forward validates the input file and JSONL line format, then schedules execution automatically inside the off-peak window. When the batch finishes, output.jsonl and error.jsonl are produced for download.
Headers
Prerequisite: upload the input file
Creating a batch requires a JSONL input file uploaded through the CAS Files API to obtain afile_id.
JSONL format — one JSON object per line, one line per independent task:
Upload the file:
purpose must be session_resource. Otherwise downloads may fail later.id is the input_file_id for Create Batch.
Body parameters
Example request
Example response
HTTP 200 OKvalidating and moves to queued once validation passes. output_file_id and error_file_id only appear after the batch reaches a terminal state and are omitted from the create response.
Response fields
Batch status
Request counts
The invariant
total = pending + running + completed + failed + cancelled + expired always holds.
Validation rules
Create Batch rejects the following errors upfront rather than enqueuing:- JSON parse failure → line marked
failed - Missing required field → line marked
failed - Duplicate
custom_id→ line markedfailed - Tool permission policy set to
always_askoralways_deny→ line markedfailed(unattended execution disallows these)
error.jsonl.
Error codes
Notes
- A single batch supports up to 10,000 JSONL lines.
- Global concurrency is capped at 50 tasks.
- Scheduling runs inside the off-peak window (default 22:00–08:00, configurable server-side).
- After creating a batch, the client should poll
GET /api/v1/forward/batches/{batch_id}until a terminal state is reached.