# AI Image Document Response

> Webhook body of the v2 asynchronous AI Image Detection endpoint - one document holding a result for every image in a submitted image or PDF.

The [v2 asynchronous AI Image Detection](/reference/actions/ai-image-detector/submit-v2) endpoint delivers one JSON document to your webhook for every submission. A PDF yields one entry per image drawn in it; a single image yields a document with one entry.

## Response Properties

<ParamField path="model" type="string">
  The version of the AI detection model used for the analysis.
</ParamField>
<ParamField path="document" type="object">
  What was found in the submitted file.
  <Expandable title="properties">
    <ParamField path="type" type="string">
      `"pdf"` or `"image"`.
    </ParamField>
    <ParamField path="pageCount" type="integer">
      The number of pages in the PDF. `1` for an image.
    </ParamField>
    <ParamField path="imagesFound" type="integer">
      The number of images, the length of `images`.
    </ParamField>
    <ParamField path="imagesAnalyzed" type="integer">
      Images with status `analyzed`.
    </ParamField>
    <ParamField path="imagesSkipped" type="integer">
      Images with status `skipped`.
    </ParamField>
    <ParamField path="imagesFailed" type="integer">
      Images with status `failed`.
    </ParamField>
  </Expandable>
</ParamField>
<ParamField path="summary" type="object">
  The verdict for the whole file. Absent when no image was analyzed.
  <Expandable title="properties">
    <ParamField path="ai" type="float">
      The share of AI-generated pixels across the analyzed images, each image weighted by its pixel count. Ranges from `0.0` to `1.0`.
    </ParamField>
    <ParamField path="human" type="float">
      `1 - ai`.
    </ParamField>
    <ParamField path="isAiDetected" type="boolean">
      `true` when any analyzed image was flagged as AI-generated.
    </ParamField>
    <ParamField path="aiImages" type="integer">
      The number of analyzed images flagged as AI-generated.
    </ParamField>
  </Expandable>
</ParamField>
<ParamField path="images" type="array<object>">
  One entry per image drawn in the file, in the order they appear.
  <Expandable title="properties">
    <ParamField path="id" type="string">
      `"1"`, `"2"`, ... in order of appearance. Ids are assigned before any image is skipped, so they do not change when an image is skipped.
    </ParamField>
    <ParamField path="locations" type="array<object>">
      Where the image is drawn. A logo on 30 pages is 30 images, each with one location. A single image is one location on page 1 covering the whole page.
      <Expandable title="properties">
        <ParamField path="page" type="integer">
          The 1-based page number.
        </ParamField>
        <ParamField path="box" type="object">
          Where the image sits on the page, as fractions of the page width and height, measured from the top-left corner. Absent when the page layout could not be read.
          <Expandable title="properties">
            <ParamField path="left" type="float">
              Distance from the left edge of the page, `0.0` to `1.0`.
            </ParamField>
            <ParamField path="top" type="float">
              Distance from the top edge of the page, `0.0` to `1.0`.
            </ParamField>
            <ParamField path="width" type="float">
              Width as a fraction of the page width.
            </ParamField>
            <ParamField path="height" type="float">
              Height as a fraction of the page height.
            </ParamField>
          </Expandable>
        </ParamField>
      </Expandable>
    </ParamField>
    <ParamField path="status" type="string">
      - `analyzed` - the image was checked and charged.
      - `skipped` - the image is outside the per-image limits, failed a quality check (for example too dark, or too few colors) or could not be read. Free; `error` says why.
      - `duplicate` - the same picture stored a second time in the file. Free; `duplicateOf` names the image it repeats, and its `summary`, `isAiDetected` and `imageInfo` are copied from that image. A duplicate never carries `result` or `detectedObjects`; read them from the image it repeats.
      - `failed` - detection failed for this image. Refunded; `error` says why.
    </ParamField>
    <ParamField path="duplicateOf" type="string">
      Present for `duplicate` images: the `id` of the image this one repeats.
    </ParamField>
    <ParamField path="error" type="string">
      Present for `skipped` and `failed` images: an [error id](/using-the-apis/api-errors), such as `image_too_small`, `image_too_large`, `unsupported_aspect_ratio`, `image_too_dark`, `insufficient_colors`, `image_load_failed`, `request_timed_out` or `internal_server_error`.
    </ParamField>
    <ParamField path="summary" type="object">
      The image's AI score, as in the [AI Image Detection Response](/reference/data-types/ai-detector/ai-image-detection-response): `ai` and `human`, each from `0.0` to `1.0`.
    </ParamField>
    <ParamField path="isAiDetected" type="boolean">
      Indicates whether the image was flagged as AI-generated.
    </ParamField>
    <ParamField path="imageInfo" type="object">
      The image's dimensions (`shape.width`, `shape.height`) and optional `metadata`, as in the [AI Image Detection Response](/reference/data-types/ai-detector/ai-image-detection-response).
    </ParamField>
    <ParamField path="result" type="object">
      The detection mask as a transparent PNG at the image's size (`imageInfo.shape`). Present only on `analyzed` images, and absent for `maskType: "none"`.
      <Expandable title="properties">
        <ParamField path="encoding" type="string">
          Always `"png"`.
        </ParamField>
        <ParamField path="base64" type="string">
          The PNG file, base64-encoded. It is a palette PNG whose index is the mask value: `0` human and `1` AI for `maskType: "binary"`, or the confidence level `1` to `5` for `maskType: "heatmap"`. The palette carries the request's `maskStyle` colours and opacity, so the PNG can be drawn straight over the image (human pixels are transparent by default). To read the values, open it with any PNG library and read the palette index, for example `numpy.array(PIL.Image.open(...))` in Python.
        </ParamField>
      </Expandable>
    </ParamField>
    <ParamField path="detectedObjects" type="array<object>">
      Present only on `analyzed` images, when the request included `objectDetection`. One entry per object located in the image; an object that was asked for but not found is left out.

      <Expandable title="properties">
        <ParamField path="object" type="string">
          The object name, as asked for in `objectDetection`.
        </ParamField>
        <ParamField path="mask" type="object">
          The object's mask in the same form as `result`: `encoding` is always `"png"` and `base64` is a 1-bit palette PNG at the image's size, index `1` for the object's pixels (in `maskStyle.object`) and `0` for the rest (transparent). Unlike v1, it is not run-length encoded.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>
<ParamField path="scannedDocument" type="object">
  Metadata about the scan operation itself.
  <Expandable title="properties">
    <ParamField path="scanId" type="string">
      The unique identifier for this scan, provided by you in the request.
    </ParamField>
    <ParamField path="expectedCredits" type="integer">
      The credits charged for the scan: one per distinct analyzable image.
    </ParamField>
    <ParamField path="actualCredits" type="integer">
      The credits consumed: `expectedCredits` minus the refunded `failed` images.
    </ParamField>
    <ParamField path="creationTime" type="string">
      When the scan was created, in UTC, formatted as `month/day/year hours:minutes:seconds AM|PM` (for example `"11/4/2026 10:07:58 AM"`). This is not an ISO 8601 timestamp.
    </ParamField>
  </Expandable>
</ParamField>
<ParamField path="developerPayload" type="string">
  The `developerPayload` from the request, when one was sent.
</ParamField>

## Example Response

A three-page PDF with a logo on page 1, one photo, and one image too small to check, submitted with the default `binary` mask (the second PNG is shortened here):

```json
{
  "model": "ai-image-1-ultra",
  "document": {
    "type": "pdf",
    "pageCount": 3,
    "imagesFound": 3,
    "imagesAnalyzed": 2,
    "imagesSkipped": 1,
    "imagesFailed": 0
  },
  "summary": {
    "ai": 0.744,
    "human": 0.256,
    "isAiDetected": true,
    "aiImages": 1
  },
  "images": [
    {
      "id": "1",
      "locations": [
        { "page": 1, "box": { "left": 0.08, "top": 0.05, "width": 0.16, "height": 0.08 } }
      ],
      "status": "analyzed",
      "summary": { "ai": 0.0, "human": 1.0 },
      "isAiDetected": false,
      "imageInfo": { "shape": { "width": 600, "height": 600 } },
      "result": {
        "encoding": "png",
        "base64": "iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYAQMAAACEqAqfAAAABlBMVEUAAADmOUaZM3zCAAAAAnRSTlMAmf9A5tgAAABDSURBVHja7cEBDQAAAMKg909tDjegAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC+DbIgAAFbm/qRAAAAAElFTkSuQmCC"
      }
    },
    {
      "id": "2",
      "locations": [
        { "page": 2, "box": { "left": 0.1, "top": 0.3, "width": 0.8, "height": 0.45 } }
      ],
      "status": "analyzed",
      "summary": { "ai": 0.93, "human": 0.07 },
      "isAiDetected": true,
      "imageInfo": { "shape": { "width": 1600, "height": 900 } },
      "result": {
        "encoding": "png",
        "base64": "iVBORw0KGgoAAAANSUhEUgAABkAAAAOEAQMAAADDg2/hAAAABlBMVEUAAADmOUaZM3zCAAAAAnRSTlMAmf9A5tgAAALXSURBVHja7c9BEQAADAIg..."
      }
    },
    {
      "id": "3",
      "locations": [
        { "page": 3, "box": { "left": 0.4, "top": 0.9, "width": 0.05, "height": 0.03 } }
      ],
      "status": "skipped",
      "error": "image_too_small"
    }
  ],
  "scannedDocument": {
    "scanId": "my-pdf-scan-1",
    "expectedCredits": 2,
    "actualCredits": 2,
    "creationTime": "11/4/2026 10:07:58 AM"
  },
  "developerPayload": "order-id-12345"
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Detect AI Images in PDFs" icon="file-pdf" href="/guides/ai-detector/ai-pdf-image-detection">Submit a PDF and read the result document.</Card>
  <Card title="API Reference" icon="code" href="/reference/actions/ai-image-detector/submit-v2">Explore the v2 asynchronous AI Image Detection endpoint.</Card>
</CardGroup>
