Skip to main content
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 a file_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.
The returned id is the input_file_id for Create Batch.

Body parameters

Example request

Example response

HTTP 200 OK
A newly created batch starts in validating 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 marked failed
  • Tool permission policy set to always_ask or always_deny → line marked failed (unattended execution disallows these)
Validation failures on individual lines do not block other lines; they are written together to 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.

Get a batch

Cancel a batch