# Object Detection Response

> Response structure and field definitions for the Copyleaks Object Detection API, including per-object RLE segmentation masks.

The Copyleaks Object Detection API returns the dimensions of the analyzed image and, for each requested object that was found, a Run-Length Encoded (RLE) segmentation mask.

Objects that were requested but not found in the image are omitted from `detectedObjects`, so the array is not aligned by position with the request - look entries up by `object`.

## Response Properties

<ParamField path="imageInfo" type="object">
  Information about the analyzed image.
  <Expandable title="properties">
    <ParamField path="shape" type="object">
      The dimensions of the image, used to decode the RLE masks.
      <Expandable title="properties">
        <ParamField path="height" type="integer">
          The height of the image in pixels.
        </ParamField>
        <ParamField path="width" type="integer">
          The width of the image in pixels.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>
<ParamField path="detectedObjects" type="array<object>">
  One entry per object located in the image. Objects that were requested but not found are absent.
  <Expandable title="properties">
    <ParamField path="object" type="string">
      The object description from the request that this entry corresponds to.
    </ParamField>
    <ParamField path="mask" type="object">
      The Run-Length Encoded (RLE) segmentation mask for this object.
      <Expandable title="properties">
        <ParamField path="starts" type="array<integer>">
          An array of starting positions for each segment in the flattened 1D image array.
        </ParamField>
        <ParamField path="lengths" type="array<integer>">
          An array of lengths for each segment, corresponding to the `starts` array.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>
<ParamField path="scannedImage" 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="credits" type="integer">
      The actual number of credits consumed by the scan.
    </ParamField>
    <ParamField path="expectedCredits" type="integer">
      The expected number of credits for the scan.
    </ParamField>
    <ParamField path="creationTime" type="string">
      The ISO 8601 timestamp indicating when the scan was created.
    </ParamField>
  </Expandable>
</ParamField>

## Example Response

```json
{
  "imageInfo": {
    "shape": {
      "height": 1024,
      "width": 768
    }
  },
  "detectedObjects": [
    {
      "object": "face",
      "mask": {
        "starts": [200, 412],
        "lengths": [50, 30]
      }
    }
  ],
  "scannedImage": {
    "scanId": "my-scan-id-1",
    "credits": 1,
    "expectedCredits": 1,
    "creationTime": "2023-01-10T10:07:58.9459512Z"
  }
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Object Detection API Reference" icon="code" href="/reference/actions/object-detection/check/">Explore the complete API reference for the Object Detection endpoint.</Card>
  <Card title="AI Image Detection" icon="image" href="/reference/actions/ai-image-detector/check/">Detect whether an image is AI-generated.</Card>
</CardGroup>
