> ## 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/cloud/files/{file_id}/content`

[ファイルコンテンツリンク](/ja/cloud-agents/api/files/schemas#file-content-link)を返します。返される URL は有効期限付きで、ファイル内容を直接ダウンロードできます。

ファイルのダウンロードは、ファイルオブジェクトの `downloadable` フィールドが `true` の場合のみ可能です。

## パスパラメータ

| パラメータ     | 型      | 必須 | 説明                       |
| --------- | ------ | -- | ------------------------ |
| `file_id` | string | はい | ファイル ID（`file_` プレフィックス） |

## ヘッダー

| ヘッダー          | 必須 | 説明                  |
| ------------- | -- | ------------------- |
| Authorization | はい | `Bearer $QODER_PAT` |

## リクエスト例

```bash theme={null}
curl -X GET "https://api.qoder.com/api/v1/cloud/files/file_019e3bb9b0c2752688aeb5fdacf00565/content" \
  -H "Authorization: Bearer $QODER_PAT"
```

## レスポンス例

**HTTP 200 OK**

```json theme={null}
{
  "expires_at": "2026-05-18T16:34:52Z",
  "url": "https://storage.qoder.com/files/..."
}
```

## レスポンスフィールド

| フィールド        | 型      | 説明                          |
| ------------ | ------ | --------------------------- |
| `url`        | string | 署名済みダウンロード URL              |
| `expires_at` | string | URL の有効期限（RFC 3339 形式の UTC） |

## 注意事項

* `expires_at` 以降は新しい URL を再リクエストしてください。
* クライアントは JSON レスポンスから `url` フィールドを読み取り、その URL に GET リクエストを送信してファイル内容をダウンロードしてください。

## エラーレスポンス

| HTTP | type                   | 説明                             |
| ---- | ---------------------- | ------------------------------ |
| 401  | `authentication_error` | 認証トークンが欠落または無効                 |
| 403  | `permission_error`     | ファイルを `/content` 経由でダウンロードできない |
| 404  | `not_found_error`      | 指定 ID のファイルが存在しない              |
| 409  | `conflict_error`       | ファイルは存在するが `ready` ステータスではない   |
| 410  | `not_found_error`      | ファイルが `deleted` ステータス          |

[エラー](/ja/cloud-agents/api/conventions/errors)で完全なエラーエンベロープを参照してください。

## 関連項目

<CardGroup cols={2}>
  <Card title="ファイルの添付とダウンロード" icon="paperclip" href="/ja/cloud-agents/files">
    Agent にコンテキストを提供するファイルをアップロードし、Agent が生成したファイルをダウンロードします。
  </Card>
</CardGroup>
