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

# AI Detection注文を作成

> AI Detection注文を作成し、画像用のプリサインドS3アップロードURLを発行します。

## フロー

1. このエンドポイントを呼び出し、プリサインドアップロードURLを受け取ります
2. プリサインドURLを使用して画像を直接S3にアップロードします
3. `POST /api/v2/orders/ai-detection/confirm` を呼び出して非同期の検知処理を開始します
4. Webhookまたは注文詳細エンドポイントのポーリングで結果を確認します

## 注文ステータス

| ステータス | 説明 |
|--------|-------------|
| `pending` | ファイルアップロード待ち |
| `inProgress` | 検知処理中 |
| `complete` | 検知完了、結果を確認可能 |
| `failed` | 検知失敗 |

## 対応形式

jpg, jpeg, png, webp, bmp, tiff



## OpenAPI

````yaml ja/api-reference/openapi.yaml POST /api/v2/orders/ai-detection
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/ai-detection:
    post:
      tags:
        - AI Detection
      summary: AI Detection注文を作成
      description: |-
        AI Detection注文を作成し、画像用のプリサインドS3アップロードURLを発行します。

        ## フロー

        1. このエンドポイントを呼び出し、プリサインドアップロードURLを受け取ります
        2. プリサインドURLを使用して画像を直接S3にアップロードします
        3. `POST /api/v2/orders/ai-detection/confirm` を呼び出して非同期の検知処理を開始します
        4. Webhookまたは注文詳細エンドポイントのポーリングで結果を確認します

        ## 注文ステータス

        | ステータス | 説明 |
        |--------|-------------|
        | `pending` | ファイルアップロード待ち |
        | `inProgress` | 検知処理中 |
        | `complete` | 検知完了、結果を確認可能 |
        | `failed` | 検知失敗 |

        ## 対応形式

        jpg, jpeg, png, webp, bmp, tiff
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - idempotencyKey
                - fileName
              properties:
                idempotencyKey:
                  type: string
                  description: 重複リクエストを防ぐための冪等性キー
                  example: 0e6c4a9b-b1d8-457e-a9fc-4b7d0e3a6c59
                orderName:
                  type: string
                  maxLength: 64
                  description: 注文名（任意、未指定の場合は自動生成）
                  example: my-detection-order
                fileName:
                  type: string
                  description: '拡張子を含む画像ファイル名。対応形式: jpg, jpeg, png, webp, bmp, tiff'
                  example: photo.jpg
                options:
                  type: object
                  description: 出力オプション（任意）。生成されたファイルは注文詳細レスポンスに含まれます。
                  properties:
                    generateHeatmap:
                      type: boolean
                      default: false
                      description: AI検知ヒートマップ画像を生成
                    generateOverlay:
                      type: boolean
                      default: false
                      description: 元画像にヒートマップを重ねたオーバーレイ画像を生成
                    generateThumbnail:
                      type: boolean
                      default: false
                      description: サムネイル画像を生成
      responses:
        '200':
          description: 注文が正常に作成されました
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      orderId:
                        type: string
                        description: 注文ID
                      orderName:
                        type: string
                        description: 注文名
                      status:
                        type: string
                        enum:
                          - pending
                        description: 注文ステータス
                      file:
                        type: object
                        properties:
                          fileId:
                            type: integer
                            description: ファイルレコードID
                          fileName:
                            type: string
                            description: ファイル名
                          uploadUrl:
                            type: string
                            format: uri
                            description: ファイル直接アップロード用のプリサインドS3 URL
                          fileKey:
                            type: string
                            description: S3ファイルキー
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/UsageLimitExceeded'
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl -X POST https://api.bizmori.com/api/v2/orders/ai-detection \
              -H "Authorization: Bearer YOUR_API_TOKEN" \
              -H "Content-Type: application/json" \
              -d '{"idempotencyKey": "0e6c4a9b-b1d8-457e-a9fc-4b7d0e3a6c59", "fileName": "photo.jpg"}'
        - lang: javascript
          label: JavaScript
          source: >-
            const response = await
            fetch('https://api.bizmori.com/api/v2/orders/ai-detection', {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer YOUR_API_TOKEN',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                idempotencyKey: '0e6c4a9b-b1d8-457e-a9fc-4b7d0e3a6c59',
                fileName: 'photo.jpg'
              })
            });

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

            response = requests.post(
                'https://api.bizmori.com/api/v2/orders/ai-detection',
                headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
                json={'idempotencyKey': '0e6c4a9b-b1d8-457e-a9fc-4b7d0e3a6c59', 'fileName': 'photo.jpg'}
            )
            data = response.json()
components:
  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
  schemas:
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: エラーコード
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        外部クライアントアクセス用のBearer APIキー。本番キーは `sk_` プレフィックスを使用し、テストキーは `sk_test_`
        プレフィックスを使用して、処理やクレジット消費なしに注文ライフサイクルを検証します。

````