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

# Create AI Detection order

> Creates an AI Detection order and issues an upload URL for the image. Live keys receive an S3 presigned URL; test keys receive an absolute BIZ MORI test-upload URL.

## Flow

1. Call this endpoint to receive an upload URL
2. Upload the image using the live S3 URL or test BIZ MORI URL
3. Call `POST /api/v2/orders/ai-detection/confirm` to start async detection
4. Use webhooks or poll the order detail endpoint for the result

## Order Status

| Status | Description |
|--------|-------------|
| `pending` | Waiting for file upload |
| `inProgress` | Detection is in progress |
| `complete` | Detection complete, result available |
| `failed` | Detection failed |

## Supported Formats

jpg, jpeg, png, webp, bmp, tiff


## How to upload the image

After receiving the `uploadUrl` from the response, upload your image using a `PUT` request. Live keys return a presigned storage URL. Test keys return a BIZ MORI test upload URL that consumes and discards the request body:

```bash theme={null}
curl -X PUT "UPLOAD_URL" \
  -H "Content-Type: image/jpeg" \
  --data-binary @photo.jpg
```

> [!NOTE]
>
> Live presigned upload URLs expire after **1 hour**. Test upload URLs carry their own authorization and do not require a Bearer header. Upload the file before the URL expires, then call the [Confirm order](https://docs.contentcare.ai/api-reference/ai-detection/confirm-order.md) endpoint.

## Getting the detection result

Once you confirm the upload, the order status changes to `inProgress`. When detection completes, the result is available via:

1. **Webhook** — Subscribe to `order.aiDetection.completed` or `order.aiDetection.failed` events
2. **Polling** — Call [Get order details](https://docs.contentcare.ai/api-reference/orders/get-order-v3.md) until `status` is `complete` or `failed`

When the order is `complete`, the detection result is in `result`. The example below omits the common order fields; see [Get order details](https://docs.contentcare.ai/api-reference/orders/get-order-v3.md) for the full response.

```json theme={null}
{
  "data": {
    "type": "aiDetection",
    "orderId": "...",
    "status": "complete",
    "result": {
      "verdict": "likely_ai",
      "probability": 0.97,
      "options": {
        "generateHeatmap": true,
        "generateOverlay": false,
        "generateThumbnail": true
      },
      "originalImageUrl": "https://...",
      "heatmapUrl": "https://...",
      "overlayUrl": null
    }
  }
}
```

> [!NOTE]
>
> Test orders return deterministic detection results from the input file name. Use `_ai` for probability `0.98` or `_human` for probability `0.02`. Test orders do not create downloadable heatmap or overlay files.

### Verdict

| `result.verdict` | Probability range | Meaning |
| - | - | - |
| `likely_ai` | ≥ 0.75 | Likely AI-generated |
| `uncertain_ai` | 0.5 – 0.75 | Possibly AI-generated |
| `uncertain_real` | 0.25 – 0.5 | Possibly not AI-generated |
| `likely_real` | \< 0.25 | Likely not AI-generated |


## OpenAPI

````yaml 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 provides four core services for digital content protection:

    - **Anti-AI**: Protect images from AI training

    - **Watermark Embed**: Embed invisible digital watermarks into images

    - **Watermark Extract**: Extract and verify watermarks from images

    - **AI Detection**: Detect whether an image is AI-generated

    - **Test API keys**: Keys with the `sk_test_` prefix use the same Bearer
    authentication and support order-lifecycle testing with mock responses
    without running processing services or consuming credits; test uploads
    discard file contents and do not create result files
  contact:
    name: BIZ MORI Support
    email: support@contentcare.ai
  license:
    name: Proprietary
    url: https://docs.contentcare.ai/legal/terms
servers:
  - url: https://api.bizmori.com
    description: Production
security: []
tags:
  - name: Anti-AI
    description: Anti-AI image protection orders
  - name: Watermark Embed
    description: Watermark embedding orders
  - name: Watermark Extract
    description: Watermark extraction orders
  - name: AI Detection
    description: AI-generated image detection orders
  - name: Orders
    description: Order query and management
  - name: Webhooks
    description: Webhook configuration and events
  - name: Reports
    description: PDF analysis reports for watermark extract and AI Detection orders
paths:
  /api/v2/orders/ai-detection:
    post:
      tags:
        - AI Detection
      summary: Create AI Detection order
      description: >
        Creates an AI Detection order and issues an upload URL for the image.
        Live keys receive an S3 presigned URL; test keys receive an absolute BIZ
        MORI test-upload URL.


        ## Flow


        1. Call this endpoint to receive an upload URL

        2. Upload the image using the live S3 URL or test BIZ MORI URL

        3. Call `POST /api/v2/orders/ai-detection/confirm` to start async
        detection

        4. Use webhooks or poll the order detail endpoint for the result


        ## Order Status


        | Status | Description |

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

        | `pending` | Waiting for file upload |

        | `inProgress` | Detection is in progress |

        | `complete` | Detection complete, result available |

        | `failed` | Detection failed |


        ## Supported Formats


        jpg, jpeg, png, webp, bmp, tiff
      operationId: createAiDetectionOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - idempotencyKey
                - fileName
              properties:
                idempotencyKey:
                  type: string
                  description: Idempotency key to prevent duplicate requests
                  example: 0e6c4a9b-b1d8-457e-a9fc-4b7d0e3a6c59
                orderName:
                  type: string
                  maxLength: 64
                  description: Order name (optional, auto-generated if not provided)
                  example: my-detection-order
                fileName:
                  type: string
                  description: >-
                    Image file name with extension. Supported: jpg, jpeg, png,
                    webp, bmp, tiff
                  example: photo.jpg
                options:
                  type: object
                  description: >-
                    Output options (optional). Generated files are included in
                    the order detail response.
                  properties:
                    generateHeatmap:
                      type: boolean
                      default: false
                      description: Generate AI detection heatmap image
                    generateOverlay:
                      type: boolean
                      default: false
                      description: Generate heatmap overlay on original image
                    generateThumbnail:
                      type: boolean
                      default: false
                      description: Generate thumbnail image
      responses:
        '200':
          description: Order created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      orderId:
                        type: string
                        description: Order ID
                      orderName:
                        type: string
                        description: Order name
                      status:
                        type: string
                        enum:
                          - pending
                        description: Order status
                      file:
                        type: object
                        properties:
                          fileId:
                            type: integer
                            description: File record ID
                          fileName:
                            type: string
                            description: File name
                          uploadUrl:
                            type: string
                            format: uri
                            description: >-
                              Upload URL. Live keys receive an S3 presigned URL;
                              test keys receive an absolute
                              `https://api.bizmori.com/api/v2/test-uploads/{signedToken}`
                              URL. Both expire after one hour. PUT needs no
                              Authorization header because the signed token
                              authorizes the test upload. Test request bodies
                              are streamed, not stored; test orders move to
                              simulated results without usage consumption or
                              actual external processing.
                          fileKey:
                            type: string
                            description: >
                              File identifier: an S3 object key for live keys or
                              an isolated logical key for test keys.
        '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: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: VALIDATION_FAILED
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: AUTH_NOT_AUTHENTICATED
    UsageLimitExceeded:
      description: Usage limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: USAGE_LIMIT_EXCEEDED
  schemas:
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer API key for external client access. Live keys use the `sk_`
        prefix; test keys use the `sk_test_` prefix and support order-lifecycle
        testing with mock responses without processing or credit usage.

````

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