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

# 注文結果のダウンロード URL を発行

> 完了した Anti-AI・watermark 埋め込み注文について、結果ファイルごとのダウンロード URL と、結果全体を受け取る URL を 1 回の呼び出しで発行します。watermark 注文を v2 と v3 のどちらで作成したかに関係なく、レスポンスの形式は同じです。

- `files[]`: 結果ファイルごとの `{ fileId, downloadUrl }`。[`GET /api/v3/orders/{orderId}`](/ja/api-reference/orders/get-order-v3) の `result.outputFiles[]` と同じファイルを同じ順序で含み、`fileId` も同じです
- `archiveUrl`: この URL 1 つで結果全体を受け取れます。常に文字列です
  - Anti-AI の注文、v2 で作成した watermark 埋め込み注文: 結果の ZIP
  - v3 で作成した watermark 埋め込み注文: 結果ファイルが 2 件以上なら ZIP、1 件ならその結果ファイルの URL（`files[0].downloadUrl` と同じファイル）
- `expiresInSeconds`: URL の有効期間。既定は 3600 秒（1 時間）で、保管期限（`expiresAt`）までの残り時間のほうが短い場合はその時間に短縮します。新しい URL が必要な場合は再度呼び出してください

**エラーの確認順序**（最初に該当したエラーを返します）
1. 注文が存在しないか、他のアカウントの注文 → `404 ORDER_NOT_FOUND`
2. watermark 検出・AI Detection の注文 → `400 ORDER_TYPE_CANT_DOWNLOAD`。保管期限が過ぎていてもこのエラーです
3. 保管期限切れ → `400 ORDER_EXPIRED`。保管期限を確認できない場合は `409 FILE_RETENTION_UNKNOWN`
4. `status` が `complete` ではない（`pending`、`inProgress`、`failed`） → `400 ORDER_NOT_COMPLETED`

**以前の v3 レスポンスからの変更（破壊的変更、2026-10-08）**: レスポンスは `{ downloadUrl, expiresInSeconds: 300 }` から `{ archiveUrl, files, expiresInSeconds }` に変わり、Anti-AI の注文と v2 で作成した watermark 埋め込み注文にも対応しました。URL の有効期間は 300 秒から最大 3600 秒に延びました。未完了の注文は `VALIDATION_FAILED` の代わりに `ORDER_NOT_COMPLETED` を、検出注文は `ORDER_TYPE_CANT_DOWNLOAD` を返します。結果ファイルを 1 つ受け取る `GET /api/v3/orders/{orderId}/files/{fileId}/download` は削除されました。`files[]` を使用してください。

**テストキー（`sk_test_`）**: 同じキーで作成した、完了済みの Anti-AI・watermark 埋め込みテスト注文（v2・v3）で動作します。URL は処理結果ではなく、`https://api.bizmori.com/api/v2/test-samples/{signedToken}` で提供されるサンプルファイルを指します。結果ファイルのない Anti-AI テスト注文は `files: []` とサンプル ZIP の `archiveUrl` を返します。結果が 1 件の v3 埋め込みテスト注文はそのサンプルファイルを、それ以外のテスト注文はサンプル ZIP を `archiveUrl` として返します。`expiresInSeconds`、エラーコード、確認順序は本番注文と同じです。


完了した Anti-AI・watermark 埋め込み注文の結果をダウンロードするときに、このエンドポイントを使用します。1 回の呼び出しで、結果ファイルごとの URL と結果全体を受け取る URL をまとめて取得できます。watermark 注文を v2 と v3 のどちらで作成したかに関係なく、レスポンスの形式は同じです。

> [!WARNING]
>
> 2026 年 10 月 8 日にレスポンスの形式が変わり、`GET /api/v3/orders/{orderId}/files/{fileId}/download` は削除されました。[以前のレスポンスからの変更](#以前のレスポンスからの変更)を確認してください。

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

| フィールド | 型 | 説明 |
| - | - | - |
| `archiveUrl` | string | 結果全体を受け取る URL。常にあります |
| `files[]` | array | 結果ファイルごとの `{ fileId, downloadUrl }` |
| `expiresInSeconds` | integer | URL の有効期間（秒）。最大 3600 |

`files[]` は、[注文詳細を取得](https://docs.contentcare.ai/ja/api-reference/orders/get-order-v3.md)の `result.outputFiles[]` と同じファイルを同じ順序で含み、`fileId` も同じです。`fileId` を使って、各 URL を結果ファイルとその `inputFileId` に対応付けてください。

### `archiveUrl` が指すファイル

| 注文 | `archiveUrl` |
| - | - |
| Anti-AI | すべての結果ファイルの ZIP |
| v2 で作成した watermark 埋め込み | すべての結果ファイルの ZIP |
| v3 で作成した watermark 埋め込み、結果ファイル 2 件以上 | すべての結果ファイルの ZIP |
| v3 で作成した watermark 埋め込み、結果ファイル 1 件 | その結果ファイル（`files[0].downloadUrl` と同じファイル） |

`archiveUrl` は結果ファイル 1 つか全体の ZIP のどちらかなので、1 つのダウンロードボタンにそのまま割り当てられます。

### URL の有効期間

URL は 3600 秒（1 時間）有効です。注文の保管期限（`expiresAt`）がそれより先に来る場合は残り時間に短縮し、短縮した値を `expiresInSeconds` に入れます。URL は保存せず、ダウンロードするたびにこのエンドポイントを呼び出してください。

## 例

```json Anti-AI theme={null}
{
  "data": {
    "archiveUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/zip/1001/archive.zip?X-Amz-...",
    "files": [
      {
        "fileId": "21",
        "downloadUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/out/cat.png?X-Amz-..."
      },
      {
        "fileId": "22",
        "downloadUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/out/dog.png?X-Amz-..."
      }
    ],
    "expiresInSeconds": 3600
  }
}
```

```json watermark 埋め込み（結果 1 件） theme={null}
{
  "data": {
    "archiveUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo.png?X-Amz-...",
    "files": [
      {
        "fileId": "201",
        "downloadUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo.png?X-Amz-..."
      }
    ],
    "expiresInSeconds": 3600
  }
}
```

```json watermark 埋め込み（結果 2 件） theme={null}
{
  "data": {
    "archiveUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/archive/2001.zip?X-Amz-...",
    "files": [
      {
        "fileId": "201",
        "downloadUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo-1.png?X-Amz-..."
      },
      {
        "fileId": "202",
        "downloadUrl": "https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo-2.png?X-Amz-..."
      }
    ],
    "expiresInSeconds": 3600
  }
}
```

## すべての結果ファイルをダウンロードする

```javascript Node.js theme={null}
import { writeFile } from 'node:fs/promises';

const headers = { Authorization: 'Bearer YOUR_API_KEY' };
const base = `https://api.bizmori.com/api/v3/orders/${orderId}`;

const { data: order } = await (await fetch(base, { headers })).json();
const { data: download } = await (await fetch(`${base}/download`, { headers })).json();

// files[] と result.outputFiles[] は fileId の値と順序が一致します。
const names = new Map(order.result.outputFiles.map((file) => [file.fileId, file.fileName]));
for (const { fileId, downloadUrl } of download.files) {
  const res = await fetch(downloadUrl);
  await writeFile(`${fileId}-${names.get(fileId)}`, Buffer.from(await res.arrayBuffer()));
}
```

```python Python theme={null}
import requests

headers = {'Authorization': 'Bearer YOUR_API_KEY'}
base = f'https://api.bizmori.com/api/v3/orders/{order_id}'

order = requests.get(base, headers=headers).json()['data']
download = requests.get(f'{base}/download', headers=headers).json()['data']

# files[] と result.outputFiles[] は fileId の値と順序が一致します。
names = {f['fileId']: f['fileName'] for f in order['result']['outputFiles']}
for item in download['files']:
    res = requests.get(item['downloadUrl'])
    with open(f"{item['fileId']}-{names[item['fileId']]}", 'wb') as out:
        out.write(res.content)
```

## エラー

次の順序でエラーを確認し、最初に該当したエラーを返します。

| 順序 | 条件 | HTTP | `code` |
| - | - | - | - |
| 1 | 注文が存在しないか、他のアカウントの注文 | 404 | `ORDER_NOT_FOUND` |
| 2 | watermark 検出・AI Detection の注文（保管期限が過ぎていても同じ） | 400 | `ORDER_TYPE_CANT_DOWNLOAD` |
| 3 | 保管期限切れ | 400 | `ORDER_EXPIRED` |
| 3 | 保管期限を確認できない | 409 | `FILE_RETENTION_UNKNOWN` |
| 4 | `status` が `pending`、`inProgress`、`failed` | 400 | `ORDER_NOT_COMPLETED` |

`orderId` の形式が正しくない場合は `400 VALIDATION_FAILED` を返します。

## 以前のレスポンスからの変更

2026 年 10 月 8 日から、このエンドポイントは上記の形式で応答します。後方互換性のない変更です。

| 以前の動作 | 現在 |
| - | - |
| レスポンス `{ downloadUrl, expiresInSeconds }` | `{ archiveUrl, files, expiresInSeconds }`。`downloadUrl` の代わりに `archiveUrl` |
| v3 の watermark 埋め込み注文のみ対応 | Anti-AI の注文と、v2・v3 で作成した watermark 埋め込み注文に対応 |
| URL は 300 秒有効 | 最大 3600 秒。保管期限までに制限 |
| 未完了の注文: `400 VALIDATION_FAILED` | `400 ORDER_NOT_COMPLETED` |
| watermark 検出・AI Detection の注文: 非対応 | 引き続き非対応で、専用のエラー `400 ORDER_TYPE_CANT_DOWNLOAD` を返す |
| 結果ファイルを 1 つ受け取る `GET /api/v3/orders/{orderId}/files/{fileId}/download` | 削除。このエンドポイントの `files[]` を使用 |

非推奨（deprecated）の [`GET /api/v2/orders/{orderId}/download`](https://docs.contentcare.ai/ja/api-reference/orders/download-order) は、以前のレスポンスをそのまま返します。

## テストキー

`sk_test_` キーで呼び出すと、同じキーで作成した完了済みの Anti-AI・watermark 埋め込みテスト注文で動作します。URL は処理結果ではなく、固定のサンプルファイルを指します。[テスト API キー](https://docs.contentcare.ai/ja/test-api-keys.md)を参照してください。


## OpenAPI

````yaml ja/api-reference/openapi.yaml GET /api/v3/orders/{orderId}/download
openapi: 3.0.0
info:
  title: BIZ MORI API
  version: 2.0.0
  description: >-
    BIZ MORI API は、デジタルコンテンツ保護のための4つのコアサービスを提供します:

    - **Anti-AI**: 画像をAI学習から保護

    - **Watermark Embed**: 画像に不可視のデジタル watermark を埋め込み

    - **Watermark Extract**: 画像から watermark を抽出・検証

    - **AI Detection**: 画像がAI生成かどうかを検知

    - **テストAPIキー**: `sk_test_`
    プレフィックスのキーは同じBearer認証を使用し、実際の処理サービスの実行やクレジットの消費なしに注文ライフサイクルを検証できます。テストアップロードの内容は破棄され、結果ファイルは作成されません
  contact:
    name: BIZ MORI サポート
    email: support@contentcare.ai
  license:
    name: Proprietary
    url: https://docs.contentcare.ai/legal/terms
servers:
  - url: https://api.bizmori.com
    description: 本番環境
security: []
tags:
  - name: Anti-AI
    description: Anti-AI画像保護の注文
  - name: Watermark Embed
    description: watermark 埋め込みの注文
  - name: Watermark Extract
    description: watermark 抽出の注文
  - name: AI Detection
    description: AI生成画像検知の注文
  - name: Orders
    description: 注文の照会と管理
  - name: Webhooks
    description: Webhookの設定とイベント
  - name: Reports
    description: watermark 抽出・AI Detection 注文の PDF 分析レポート
paths:
  /api/v3/orders/{orderId}/download:
    get:
      tags:
        - Orders
      summary: 注文結果のダウンロード URL を発行
      description: >
        完了した Anti-AI・watermark 埋め込み注文について、結果ファイルごとのダウンロード URL と、結果全体を受け取る URL を
        1 回の呼び出しで発行します。watermark 注文を v2 と v3 のどちらで作成したかに関係なく、レスポンスの形式は同じです。


        - `files[]`: 結果ファイルごとの `{ fileId, downloadUrl }`。[`GET
        /api/v3/orders/{orderId}`](/ja/api-reference/orders/get-order-v3) の
        `result.outputFiles[]` と同じファイルを同じ順序で含み、`fileId` も同じです

        - `archiveUrl`: この URL 1 つで結果全体を受け取れます。常に文字列です
          - Anti-AI の注文、v2 で作成した watermark 埋め込み注文: 結果の ZIP
          - v3 で作成した watermark 埋め込み注文: 結果ファイルが 2 件以上なら ZIP、1 件ならその結果ファイルの URL（`files[0].downloadUrl` と同じファイル）
        - `expiresInSeconds`: URL の有効期間。既定は 3600 秒（1
        時間）で、保管期限（`expiresAt`）までの残り時間のほうが短い場合はその時間に短縮します。新しい URL
        が必要な場合は再度呼び出してください


        **エラーの確認順序**（最初に該当したエラーを返します）

        1. 注文が存在しないか、他のアカウントの注文 → `404 ORDER_NOT_FOUND`

        2. watermark 検出・AI Detection の注文 → `400
        ORDER_TYPE_CANT_DOWNLOAD`。保管期限が過ぎていてもこのエラーです

        3. 保管期限切れ → `400 ORDER_EXPIRED`。保管期限を確認できない場合は `409
        FILE_RETENTION_UNKNOWN`

        4. `status` が `complete` ではない（`pending`、`inProgress`、`failed`） → `400
        ORDER_NOT_COMPLETED`


        **以前の v3 レスポンスからの変更（破壊的変更、2026-10-08）**: レスポンスは `{ downloadUrl,
        expiresInSeconds: 300 }` から `{ archiveUrl, files, expiresInSeconds }`
        に変わり、Anti-AI の注文と v2 で作成した watermark 埋め込み注文にも対応しました。URL の有効期間は 300 秒から最大
        3600 秒に延びました。未完了の注文は `VALIDATION_FAILED` の代わりに `ORDER_NOT_COMPLETED`
        を、検出注文は `ORDER_TYPE_CANT_DOWNLOAD` を返します。結果ファイルを 1 つ受け取る `GET
        /api/v3/orders/{orderId}/files/{fileId}/download` は削除されました。`files[]`
        を使用してください。


        **テストキー（`sk_test_`）**: 同じキーで作成した、完了済みの Anti-AI・watermark
        埋め込みテスト注文（v2・v3）で動作します。URL
        は処理結果ではなく、`https://api.bizmori.com/api/v2/test-samples/{signedToken}`
        で提供されるサンプルファイルを指します。結果ファイルのない Anti-AI テスト注文は `files: []` とサンプル ZIP の
        `archiveUrl` を返します。結果が 1 件の v3 埋め込みテスト注文はそのサンプルファイルを、それ以外のテスト注文はサンプル ZIP
        を `archiveUrl` として返します。`expiresInSeconds`、エラーコード、確認順序は本番注文と同じです。
      operationId: downloadOrderV3
      parameters:
        - in: path
          name: orderId
          required: true
          schema:
            type: string
            pattern: ^[0-9]{1,20}$
          description: 注文 ID
      responses:
        '200':
          description: 結果ファイルごとの URL と結果全体の URL
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicOrderV3DownloadResponse'
              examples:
                antiAi:
                  summary: Anti-AI（結果 2 件、`archiveUrl` は ZIP）
                  value:
                    data:
                      archiveUrl: >-
                        https://bucket.s3.ap-northeast-2.amazonaws.com/zip/1001/archive.zip?X-Amz-...
                      files:
                        - fileId: '21'
                          downloadUrl: >-
                            https://bucket.s3.ap-northeast-2.amazonaws.com/out/cat.png?X-Amz-...
                        - fileId: '22'
                          downloadUrl: >-
                            https://bucket.s3.ap-northeast-2.amazonaws.com/out/dog.png?X-Amz-...
                      expiresInSeconds: 3600
                watermarkEmbedV3Multiple:
                  summary: watermark 埋め込み（v3）（結果 2 件、`archiveUrl` は ZIP）
                  value:
                    data:
                      archiveUrl: >-
                        https://bucket.s3.ap-northeast-2.amazonaws.com/archive/2001.zip?X-Amz-...
                      files:
                        - fileId: '201'
                          downloadUrl: >-
                            https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo-1.png?X-Amz-...
                        - fileId: '202'
                          downloadUrl: >-
                            https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo-2.png?X-Amz-...
                      expiresInSeconds: 3600
                watermarkEmbedV3Single:
                  summary: watermark 埋め込み（v3）（結果 1 件、`archiveUrl` は結果ファイルの URL）
                  value:
                    data:
                      archiveUrl: >-
                        https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo.png?X-Amz-...
                      files:
                        - fileId: '201'
                          downloadUrl: >-
                            https://bucket.s3.ap-northeast-2.amazonaws.com/out/logo.png?X-Amz-...
                      expiresInSeconds: 3600
                watermarkEmbedV2:
                  summary: >-
                    watermark 埋め込み（v2）（結果 2 件。`expiresAt` まで残り 20 分のため URL
                    の有効期間を短縮）
                  value:
                    data:
                      archiveUrl: >-
                        https://bucket.s3.ap-northeast-2.amazonaws.com/zip/2101.zip?X-Amz-...
                      files:
                        - fileId: '41'
                          downloadUrl: >-
                            https://bucket.s3.ap-northeast-2.amazonaws.com/out/a.png?X-Amz-...
                        - fileId: '42'
                          downloadUrl: >-
                            https://bucket.s3.ap-northeast-2.amazonaws.com/out/b.png?X-Amz-...
                      expiresInSeconds: 1200
        '400':
          description: リクエストの形式エラー、ダウンロードできない注文の種類、保管期限切れ、未完了の注文
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation:
                  summary: '`orderId` の形式エラー'
                  value:
                    code: VALIDATION_FAILED
                typeCantDownload:
                  summary: watermark 検出・AI Detection の注文
                  value:
                    code: ORDER_TYPE_CANT_DOWNLOAD
                expired:
                  summary: 保管期限切れ
                  value:
                    code: ORDER_EXPIRED
                notCompleted:
                  summary: '`pending`、`inProgress`、`failed` の注文'
                  value:
                    code: ORDER_NOT_COMPLETED
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: 注文が存在しないか、他のアカウントの注文です
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: ORDER_NOT_FOUND
        '409':
          description: 注文の保管期限を確認できません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: FILE_RETENTION_UNKNOWN
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >
            curl -X GET https://api.bizmori.com/api/v3/orders/ORDER_ID/download
            \
              -H "Authorization: Bearer YOUR_API_KEY"
        - lang: javascript
          label: JavaScript
          source: >
            const orderId = 'ORDER_ID';

            const response = await
            fetch(`https://api.bizmori.com/api/v3/orders/${orderId}/download`, {
              headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
            });

            const { data } = await response.json();
        - lang: python
          label: Python
          source: |
            import requests

            order_id = 'ORDER_ID'
            response = requests.get(
                f'https://api.bizmori.com/api/v3/orders/{order_id}/download',
                headers={'Authorization': 'Bearer YOUR_API_KEY'}
            )
            data = response.json()['data']
components:
  schemas:
    PublicOrderV3DownloadResponse:
      type: object
      required:
        - data
      additionalProperties: false
      properties:
        data:
          type: object
          required:
            - archiveUrl
            - files
            - expiresInSeconds
          additionalProperties: false
          properties:
            archiveUrl:
              type: string
              format: uri
              description: >-
                結果全体を一度に受け取る URL。Anti-AI の注文と v2 の watermark 埋め込み注文では結果の ZIP
                です。v3 の watermark 埋め込み注文では、結果ファイルが 2 件以上なら ZIP、1 件ならその結果ファイルの
                URL（`files[0].downloadUrl` と同じファイル）です
            files:
              type: array
              description: 結果ファイルごとのダウンロード URL。注文詳細の `result.outputFiles` と同じファイルを同じ順序で含みます
              items:
                type: object
                required:
                  - fileId
                  - downloadUrl
                additionalProperties: false
                properties:
                  fileId:
                    type: string
                    pattern: ^[0-9]+$
                    description: 注文詳細の `result.outputFiles[].fileId` と同じ値
                  downloadUrl:
                    type: string
                    format: uri
                    description: 結果ファイルの presigned ダウンロード URL
            expiresInSeconds:
              type: integer
              maximum: 3600
              description: URL の有効期間（秒）。既定は 3600 秒で、`expiresAt` までの残り時間のほうが短い場合はその時間に短縮します
              example: 3600
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: エラーコード
  responses:
    Unauthorized:
      description: 認証失敗
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: AUTH_NOT_AUTHENTICATED
    InternalError:
      description: 内部サーバーエラー
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: SERVER_INTERNAL_ERROR
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        外部クライアントアクセス用のBearer APIキー。本番キーは `sk_` プレフィックスを使用し、テストキーは `sk_test_`
        プレフィックスを使用して、処理やクレジット消費なしに注文ライフサイクルを検証します。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.