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

# watermark 抽出注文を作成

> 1 つのファイルから不可視 watermark を検査する注文を作成します。

- リクエストごとに元ファイルと検査するファイルを一緒に提出します
- 画像の元ファイルには `jpg`, `jpeg`, `png`, `webp`, `bmp`, `tif`, `tiff` の検査ファイル、PDF の元ファイルには PDF・PNG・JPEG の検査ファイルを指定できます
- BMP・TIFF の処理可能な範囲は watermark の埋め込みと同じです。処理できないファイルは注文が `failed` ではなく `complete` で終わり、`detectionStatus` が `unsupported` になり、クレジットは返金されます
- レスポンスの `files[]` は 2 件です。`files[0]` が元ファイル、`files[1]` が検査ファイルで、それぞれ `uploadUrl` へ `PUT` でアップロードします
- 2 つのファイルのアップロードが終わると処理が自動で始まります。注文あたり 1 クレジットを使用し、`unsupported`・`error` の結果は返金されます
- 結果は [`GET /api/v3/orders/{orderId}`](/ja/api-reference/orders/get-order-v3) の `result` で確認します




## OpenAPI

````yaml ja/api-reference/openapi.yaml POST /api/v3/orders/wtr-extract
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
  license:
    name: Proprietary
    url: https://docs.bizmori.com/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/wtr-extract:
    post:
      tags:
        - Watermark Extract
      summary: watermark 抽出注文を作成
      description: >
        1 つのファイルから不可視 watermark を検査する注文を作成します。


        - リクエストごとに元ファイルと検査するファイルを一緒に提出します

        - 画像の元ファイルには `jpg`, `jpeg`, `png`, `webp`, `bmp`, `tif`, `tiff`
        の検査ファイル、PDF の元ファイルには PDF・PNG・JPEG の検査ファイルを指定できます

        - BMP・TIFF の処理可能な範囲は watermark の埋め込みと同じです。処理できないファイルは注文が `failed` ではなく
        `complete` で終わり、`detectionStatus` が `unsupported` になり、クレジットは返金されます

        - レスポンスの `files[]` は 2 件です。`files[0]` が元ファイル、`files[1]` が検査ファイルで、それぞれ
        `uploadUrl` へ `PUT` でアップロードします

        - 2 つのファイルのアップロードが終わると処理が自動で始まります。注文あたり 1
        クレジットを使用し、`unsupported`・`error` の結果は返金されます

        - 結果は [`GET
        /api/v3/orders/{orderId}`](/ja/api-reference/orders/get-order-v3) の
        `result` で確認します
      operationId: createWatermarkV1ExtractOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - idempotencyKey
                - file
              properties:
                idempotencyKey:
                  type: string
                  maxLength: 255
                  description: >-
                    冪等性キー。新しい注文ごとに新しい UUIDv4
                    を使い、同じリクエストを再試行するときだけ再利用します。同じキーは既存の注文を返し、同じキーで異なるリクエストボディを送ると
                    `409 WATERMARK_V2_CONFLICT` を返します。
                file:
                  type: object
                  required:
                    - fileName
                    - originalFile
                  description: 検査するファイル
                  properties:
                    fileName:
                      type: string
                      maxLength: 255
                      description: 拡張子を含む検査ファイル名
                    originalFile:
                      type: object
                      required:
                        - fileName
                      description: watermark を埋め込んだ元ファイル
                      properties:
                        fileName:
                          type: string
                          maxLength: 255
            example:
              idempotencyKey: 6c3b9f7e-2d41-4a8e-9b5f-0e1d2c3b4a59
              file:
                fileName: suspect.png
                originalFile:
                  fileName: campaign.png
      responses:
        '200':
          description: 元ファイルと検査ファイルのアップロード URL とともに注文を作成
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WatermarkV1OrderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: 同じ `idempotencyKey` で異なるリクエストボディを送信
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: WATERMARK_V2_CONFLICT
        '429':
          description: リクエスト回数の超過
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: RATE_LIMIT_EXCEEDED
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          description: watermark 処理を一時的に利用できない
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: WATERMARK_V2_UNAVAILABLE
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |
            curl -X POST https://api.bizmori.com/api/v3/orders/wtr-extract \
              -H "Authorization: Bearer YOUR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
              "idempotencyKey": "6c3b9f7e-2d41-4a8e-9b5f-0e1d2c3b4a59",
              "file": {
                "fileName": "suspect.png",
                "originalFile": {
                  "fileName": "campaign.png"
                }
              }
            }'
        - lang: javascript
          label: JavaScript
          source: >
            const response = await
            fetch(`https://api.bizmori.com/api/v3/orders/wtr-extract`, {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer YOUR_API_KEY',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                "idempotencyKey": "6c3b9f7e-2d41-4a8e-9b5f-0e1d2c3b4a59",
                "file": {
                  "fileName": "suspect.png",
                  "originalFile": {
                    "fileName": "campaign.png"
                  }
                }
              })
            });

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

            response = requests.post(
                f'https://api.bizmori.com/api/v3/orders/wtr-extract',
                headers={'Authorization': 'Bearer YOUR_API_KEY'},
                json={
                  "idempotencyKey": "6c3b9f7e-2d41-4a8e-9b5f-0e1d2c3b4a59",
                  "file": {
                    "fileName": "suspect.png",
                    "originalFile": {
                      "fileName": "campaign.png"
                    }
                  }
                }
            )
            data = response.json()['data']
components:
  schemas:
    WatermarkV1OrderResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/WatermarkV1Order'
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: エラーコード
    WatermarkV1Order:
      type: object
      description: v3 API で作成した不可視 watermark 注文
      required:
        - orderId
        - status
        - processingDelayed
        - files
        - outputs
        - result
        - reports
      properties:
        orderId:
          type: string
          description: 注文 ID
        status:
          type: string
          enum:
            - pending
            - inProgress
            - complete
            - failed
            - expired
          description: |
            注文の処理ステータス

            * `pending` - ファイルのアップロード待ち
            * `inProgress` - 処理中
            * `complete` - 処理完了。抽出注文は `result` で結果を確認します
            * `failed` - 処理失敗、または 12 時間以内にアップロードされなかった
            * `expired` - 保管期限を過ぎ、ファイルが削除された
        processingDelayed:
          type: boolean
          description: 自動再試行をすべて使い切り、手動復旧を待っている場合は `true`。注文は `inProgress` のままです
        expiresAt:
          type: string
          format: date-time
          nullable: true
          description: 注文ファイルが削除される日時。以降のダウンロードとレポートは `ORDER_EXPIRED` を返します
        files:
          type: array
          description: リクエスト順の入力ファイル。抽出注文は元ファイル、検査ファイルの順です
          items:
            $ref: '#/components/schemas/WatermarkV1UploadFile'
        outputs:
          type: array
          description: 埋め込み結果。watermark テキストごとに 1 件で、抽出注文では空の配列です
          items:
            $ref: '#/components/schemas/WatermarkV1Output'
        result:
          $ref: '#/components/schemas/WatermarkV1DetectionResult'
        reports:
          type: array
          description: この注文でリクエストしたレポート
          items:
            type: object
            required:
              - locale
              - status
            properties:
              locale:
                type: string
                enum:
                  - ko-KR
                  - en-US
                  - ja-JP
              status:
                type: string
                enum:
                  - queued
                  - processing
                  - completed
                  - failed
    WatermarkV1UploadFile:
      type: object
      required:
        - fileId
        - uploadUrl
      properties:
        fileId:
          type: string
          description: 入力ファイル ID
        uploadUrl:
          type: string
          format: uri
          nullable: true
          description: >
            ファイルアップロード用の presigned `PUT` URL(900 秒有効)。注文の `status` が `pending`
            で保管期限前、かつアップロード待ちのファイルにだけ発行します。

            `originalFileUrl` で指定したファイル、アップロード済みのファイル、12 時間のアップロード期限を過ぎて
            `failed` になった注文、保管期限を過ぎた注文は `null` です。
    WatermarkV1Output:
      type: object
      required:
        - fileId
        - inputFileId
        - outputIndex
        - watermarkText
        - status
        - mediaKind
      properties:
        fileId:
          type: string
          description: '`{inputFileId}-{連番}` 形式の結果ファイル ID(`outputs[].fileId`)'
        inputFileId:
          type: string
          description: この結果を作成した入力ファイル ID
        outputIndex:
          type: integer
          minimum: 0
          description: 入力ファイルの `watermarks` 内でのテキストの位置
        watermarkText:
          type: string
          description: 埋め込んだ watermark テキスト
        status:
          type: string
          enum:
            - pending
            - queued
            - processing
            - completed
            - failed
            - retry_required
          description: この結果ファイルの処理ステータス
        mediaKind:
          type: string
          enum:
            - image
            - pdf
    WatermarkV1DetectionResult:
      type: object
      nullable: true
      description: 抽出結果の概要。埋め込み注文と、結果が出る前は `null` で、以下のフィールドだけを含みます
      required:
        - detectionStatus
        - reportSupported
        - watermarkText
      additionalProperties: false
      properties:
        detectionStatus:
          type: string
          enum:
            - detected
            - not_detected
            - inconclusive
            - unsupported
            - error
          description: |
            * `detected` - watermark を検出
            * `not_detected` - 最後まで検査したが watermark なし
            * `inconclusive` - 候補はあるが確信度の基準に満たず判定不可
            * `unsupported` - 処理できない入力 (クレジット返金)
            * `error` - 検出処理の失敗。watermark なしとは異なる (クレジット返金)
        reportSupported:
          type: boolean
          description: この結果からレポートを作成できるかどうか。PDF からキャプチャした画像は `false`
        watermarkText:
          type: string
          nullable: true
          description: >
            検出された watermark の埋め込みテキスト。`detectionStatus` が `detected`
            で、呼び出し元のアカウントが埋め込み、発行記録がちょうど 1 件のときだけ返します。

            別のアカウントが埋め込んだ watermark など、それ以外は `null` です。
  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
    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.