> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get output file

> Get a signed download URL for a batch's output file.

`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>` |

## Path parameters

| Parameter  | Type   | Required | Description |
| ---------- | ------ | -------- | ----------- |
| `batch_id` | string | Yes      | Batch ID.   |

## Example request

```bash theme={null}
curl -s -X GET 'https://api.qoder.com/api/v1/forward/batches/batch_completed001/output' \
  -H "Authorization: Bearer $QODER_PAT"
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "url": "https://cloud-agents-storage.oss-cn-beijing.aliyuncs.com/files%2F<user_id>%2F<file_id>%2Fcontent?Expires=1783685162&OSSAccessKeyId=<ak>&Signature=<sig>&response-content-disposition=attachment%3B%20filename%3Dbatch-batch_completed001-output.jsonl",
  "expires_at": "2026-07-10T12:06:02Z"
}
```

## 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.                                                                                                   |

## 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 are in `error.jsonl`. Retrieve it via `error_file_id` from the batch detail.

## Related

<CardGroup cols={2}>
  <Card title="Get a batch" icon="file-text" href="/cloud-agents/api/forward/batches/get" />

  <Card title="List batches" icon="list" href="/cloud-agents/api/forward/batches/list" />
</CardGroup>
