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

# 出力ファイルの取得

> バッチ出力ファイルの署名付きダウンロード URL を取得します。

`GET /api/v1/forward/batches/{batch_id}/output`

`output.jsonl` の OSS プリサインドダウンロード URL を返します。バッチは終端状態でなければならず、そうでない場合は `400 batch_not_ready` を返します。

## Headers

| Header          | Required | Description    |
| --------------- | -------- | -------------- |
| `Authorization` | Yes      | `Bearer <PAT>` |

## Path parameters

| Parameter  | Type   | Required | Description |
| ---------- | ------ | -------- | ----------- |
| `batch_id` | string | Yes      | バッチ 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 プリサインドダウンロード URL。`Expires` / `OSSAccessKeyId` / `Signature` および `response-content-disposition` を含みます。ダウンロード時のファイル名は `batch-<batch_id>-output.jsonl` です。 |
| `expires_at` | string | リンクの有効期限。RFC 3339。この時刻までにダウンロードを完了する必要があります。                                                                                                                |

## Error codes

| HTTP | Type                    | Code                      | Trigger                             |
| ---- | ----------------------- | ------------------------- | ----------------------------------- |
| 400  | `invalid_request_error` | `batch_not_ready`         | バッチが終端状態ではありません。                    |
| 404  | `not_found_error`       | `batch_not_found`         | バッチが存在しない、他ユーザーのもの、または出力ファイルが未生成です。 |
| 410  | `not_found_error`       | `file_expired`            | 出力ファイルは 30 日保持期間を過ぎて削除されています。       |
| 401  | `authentication_error`  | `authentication_required` | PAT が無効または期限切れです。                   |

## Notes

* 出力ファイルは 30 日間保持されます。保持期間を過ぎると `410 file_expired` を返します。
* ダウンロードファイル名は `batch-<batch_id>-output.jsonl` です。
* 失敗行の結果は `error.jsonl` に含まれます。バッチ詳細の `error_file_id` から取得してください。

## Related

<CardGroup cols={2}>
  <Card title="バッチを取得" icon="file-text" href="/ja/cloud-agents/api/forward/batches/get" />

  <Card title="バッチの一覧取得" icon="list" href="/ja/cloud-agents/api/forward/batches/list" />
</CardGroup>
