GET /api/v1/forward/batches/{batch_id}/output
Returns an OSS pre-signed download URL for output.jsonl. The batch must be in a terminal state; otherwise the endpoint returns 400 batch_not_ready.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT or SAT> |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
batch_id | string | Yes | Batch ID. |
Example request
Example response
HTTP 200 OK
Response fields
| Field | Type | Description |
|---|---|---|
url | string | OSS pre-signed download URL containing Expires, OSSAccessKeyId, Signature, and response-content-disposition. The download filename is batch-<batch_id>-output.jsonl. |
expires_at | string | Link expiration time, RFC 3339. The download must complete before this time. |
output.jsonl line format
Each Batch Task corresponds to one line:
template_id and identity_id are always returned. session_id is returned only after a Session has been created. started_at and completed_at are RFC 3339 UTC strings and are null when unavailable. started_at indicates the start time of the final persisted execution attempt.
Successful lines return response and error: null. Other statuses return response: null and {"code": string, "message": string}. Valid JSON results are returned directly as response.body; plain text is wrapped as {"text": ...}.
artifacts appears at the top level only when non-empty. Each item uses file_id, name, and size, and includes content_type when provided by the source. The response does not include filename or size_bytes, and artifacts are not duplicated in response.body.
usage appears at the top level when the task has persisted valid CAS Session usage. It currently contains total_credits; explicit zero values are preserved, and the field is omitted when usage is missing or invalid. The unit is CAS Credit, not tokens or currency. If a transient error retry creates a new Session, only usage for the final or current Session is recorded; usage from replaced historical Sessions is not accumulated.
error.jsonl line format
Failed lines preserve the original body and include the same status, Session/Template/Identity, timestamps, structured error, and optional top-level artifacts as output lines. Currently, error.jsonl does not include usage:
Error codes
| HTTP | Type | Code | Trigger |
|---|---|---|---|
| 400 | invalid_request_error | batch_not_ready | Batch is not in a terminal state. |
| 404 | not_found_error | batch_not_found | Batch does not exist, belongs to another user, or output file has not been generated. |
| 410 | not_found_error | file_expired | The output file passed its 30-day retention and was purged. |
| 401 | authentication_error | authentication_required | PAT is invalid or expired. |
Notes
- Output files are retained for 30 days. After retention, the endpoint returns
410 file_expired. - The download filename is
batch-<batch_id>-output.jsonl. - Failed-line results appear in both
output.jsonlanderror.jsonl. Download the latter through the Batch/errorendpoint. - Batch result files are not registered as general Forward file resources and cannot be retrieved through
/api/v1/forward/files/{file_id}or/content.