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

# Anti-AI注文を作成

> AI検知防止処理のための注文を作成します。

## 入力モード（アップロード / URL / 混合）
入力モードは、各ファイルオブジェクトに `originalFileUrl` が含まれるかどうかで決定されます:
- **アップロードモード**（`originalFileUrl` なし）: プリサインドURLを発行 → クライアントがS3にアップロード → `/confirm` を呼び出し
- **URLモード**（`originalFileUrl` を指定）: URLから画像をダウンロードして即座に処理
- **混合モード**: 一部のファイルはアップロードモード、残りはURLモードで同時に処理

### 動作
| 条件 | 注文ステータス | Confirmの必要性 |
|-----------|-------------|-----------------|
| すべてのファイルに `originalFileUrl` がある | `inProgress` | 不要（即座に処理） |
| `originalFileUrl` がないファイルが含まれる | `pending` | 必要（アップロード後にconfirm） |

## Zero Copy モード
`mode.zeroCopy: true` の場合、処理結果は顧客が提供したプリサインドURLへ直接アップロードされます。
この場合、`outputTargets` 配列が必須であり、`files` 配列と同じ長さである必要があります。



## OpenAPI

````yaml ja/api-reference/openapi.yaml POST /api/v2/orders/anti-ai
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@bizmori.com
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の設定とイベント
paths:
  /api/v2/orders/anti-ai:
    post:
      tags:
        - Anti-AI
      summary: Anti-AI注文を作成
      description: >-
        AI検知防止処理のための注文を作成します。


        ## 入力モード（アップロード / URL / 混合）

        入力モードは、各ファイルオブジェクトに `originalFileUrl` が含まれるかどうかで決定されます:

        - **アップロードモード**（`originalFileUrl` なし）: プリサインドURLを発行 → クライアントがS3にアップロード →
        `/confirm` を呼び出し

        - **URLモード**（`originalFileUrl` を指定）: URLから画像をダウンロードして即座に処理

        - **混合モード**: 一部のファイルはアップロードモード、残りはURLモードで同時に処理


        ### 動作

        | 条件 | 注文ステータス | Confirmの必要性 |

        |-----------|-------------|-----------------|

        | すべてのファイルに `originalFileUrl` がある | `inProgress` | 不要（即座に処理） |

        | `originalFileUrl` がないファイルが含まれる | `pending` | 必要（アップロード後にconfirm） |


        ## Zero Copy モード

        `mode.zeroCopy: true` の場合、処理結果は顧客が提供したプリサインドURLへ直接アップロードされます。

        この場合、`outputTargets` 配列が必須であり、`files` 配列と同じ長さである必要があります。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - idempotencyKey
                - files
              properties:
                idempotencyKey:
                  type: string
                  description: 重複リクエストを防ぐための冪等性キー
                orderName:
                  type: string
                  maxLength: 64
                  description: 注文名（任意、未指定の場合は自動生成）
                files:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - fileName
                    properties:
                      fileName:
                        type: string
                        description: ファイル名（拡張子を含む）
                        example: image.jpg
                      originalFileUrl:
                        type: string
                        format: uri
                        description: |-
                          元画像URL（任意）
                          - 指定した場合: URLモード（プリサインドURLは発行されず、即座に処理）
                          - 指定しない場合: アップロードモード（プリサインドURLを発行、confirmが必要）
                        example: https://example.com/image.jpg
                mode:
                  type: object
                  description: 処理モード設定
                  properties:
                    zeroCopy:
                      type: boolean
                      default: false
                      description: Zero Copyモードを有効化
                outputTargets:
                  type: array
                  description: Zero Copyモードの出力アップロード先（mode.zeroCopyがtrueの場合必須）
                  items:
                    type: object
                    required:
                      - fileKey
                      - url
                      - presignedUrlExpiresAt
                    properties:
                      fileKey:
                        type: string
                        description: ファイルキー（識別子）
                      url:
                        type: string
                        format: uri
                        description: 結果アップロード用のプリサインドURL
                      presignedUrlExpiresAt:
                        type: string
                        format: date-time
                        description: プリサインドURLの有効期限（ISO 8601）
                options:
                  $ref: '#/components/schemas/OrderOptions'
            examples:
              uploadMode:
                summary: アップロードモード（従来型）
                value:
                  idempotencyKey: key-upload-001
                  files:
                    - fileName: image1.jpg
                    - fileName: image2.png
                  options:
                    strength: high
              urlMode:
                summary: URLモード（即座に処理）
                value:
                  idempotencyKey: 3c7a5e19-9b2f-4d86-a1c4-6f8e0b3d5a71
                  files:
                    - fileName: image1.jpg
                      originalFileUrl: https://example.com/image1.jpg
                    - fileName: image2.png
                      originalFileUrl: https://example.com/image2.png
                  options:
                    strength: high
              mixedMode:
                summary: 混合モード
                value:
                  idempotencyKey: key-mixed-001
                  files:
                    - fileName: upload-file.jpg
                    - fileName: url-file.png
                      originalFileUrl: https://example.com/image.png
                  options:
                    strength: standard
      responses:
        '200':
          description: 注文が正常に作成されました
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      orderName:
                        type: string
                      orderId:
                        type: string
                      status:
                        type: string
                        enum:
                          - pending
                          - inProgress
                        description: |-
                          注文ステータス
                          - `pending`: アップロードファイルを含む（confirmが必要）
                          - `inProgress`: すべてのファイルがURLモード（即座に処理）
                      files:
                        type: array
                        items:
                          $ref: '#/components/schemas/AntiAiOrderFile'
              examples:
                uploadModeResponse:
                  summary: アップロードモードのレスポンス
                  value:
                    data:
                      orderName: anti_ai_2026-02-09
                      orderId: '123456789'
                      status: pending
                      files:
                        - fileId: 1
                          fileName: image1.jpg
                          uploadUrl: https://s3.amazonaws.com/...
                          fileKey: temp/123456789/0/image1.jpg
                urlModeResponse:
                  summary: URLモードのレスポンス
                  value:
                    data:
                      orderName: anti_ai_2026-02-09
                      orderId: '123456789'
                      status: inProgress
                      files:
                        - fileId: 1
                          fileName: image1.jpg
                          originalFileUrl: https://example.com/image1.jpg
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/UsageLimitExceeded'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl -X POST https://api.bizmori.com/api/v2/orders/anti-ai \
              -H "Authorization: Bearer YOUR_API_TOKEN" \
              -H "Content-Type: application/json" \
              -d '{
                "idempotencyKey": "2f4b6c82-8a6e-4f39-9f8a-7d3b5c1e2a40",
                "files": [
                  {"fileName": "image1.jpg"},
                  {"fileName": "image2.png"}
                ],
                "options": {"strength": "high"}
              }'
        - lang: javascript
          label: JavaScript
          source: >-
            const response = await
            fetch('https://api.bizmori.com/api/v2/orders/anti-ai', {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer YOUR_API_TOKEN',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                idempotencyKey: '2f4b6c82-8a6e-4f39-9f8a-7d3b5c1e2a40',
                files: [
                  { fileName: 'image1.jpg' },
                  { fileName: 'image2.png' }
                ],
                options: { strength: 'high' }
              })
            });

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

            response = requests.post(
                'https://api.bizmori.com/api/v2/orders/anti-ai',
                headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
                json={
                    'idempotencyKey': '2f4b6c82-8a6e-4f39-9f8a-7d3b5c1e2a40',
                    'files': [
                        {'fileName': 'image1.jpg'},
                        {'fileName': 'image2.png'}
                    ],
                    'options': {'strength': 'high'}
                }
            )
            data = response.json()
components:
  schemas:
    OrderOptions:
      type: object
      properties:
        strength:
          type: string
          enum:
            - low
            - standard
            - high
          default: high
          description: |-
            保護強度レベル
            * low - 低い保護強度
            * standard - 標準の保護強度
            * high - 高い保護強度
    AntiAiOrderFile:
      type: object
      description: |-
        Anti-AI 注文ファイル情報（ファイルモードによってフィールドが異なります）
        - アップロードモード: fileId, fileName, uploadUrl, fileKey
        - URLモード: fileId, fileName, originalFileUrl
      properties:
        fileId:
          type: string
          description: ファイルID
        fileName:
          type: string
          description: ファイル名
        uploadUrl:
          type: string
          format: uri
          description: アップロードURL（プリサインドURL）— アップロードモードのファイルのみ
        fileKey:
          type: string
          description: S3ファイルキー — アップロードモードのファイルのみ
        originalFileUrl:
          type: string
          format: uri
          description: 元画像URL — URLモードのファイルのみ
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: エラーコード
  responses:
    BadRequest:
      description: 不正なリクエスト
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: VALIDATION_FAILED
    Unauthorized:
      description: 認証失敗
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: AUTH_NOT_AUTHENTICATED
    UsageLimitExceeded:
      description: 使用量上限を超過
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: USAGE_LIMIT_EXCEEDED
    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_`
        プレフィックスを使用して、処理やクレジット消費なしに注文ライフサイクルを検証します。

````