The Copyleaks Object Detection API locates specific objects within an image and returns a Run-Length Encoded (RLE) segmentation mask for each object it finds. The API is synchronous, so you get the results in the same API call. This guide walks you through submitting an image with a list of objects to locate using multipart/form-data, and interpreting the results.
Object detection performs segmentation only - it does not classify whether the image is AI-generated. To detect AI-generated content, see the AI Image Detection guide.

Get started

1

Before you begin

Before you start, ensure you have the following:
2

Login

To perform a scan, we first need to generate an access token. For that, we will use the login endpoint. The API key can be found on the Copyleaks API Dashboard.Upon successful authentication, you will receive a token that must be attached to subsequent API calls via the Authorization: Bearer <TOKEN> header. This token remains valid for 48 hours.
Response
Save this token. It is valid for 48 hours and can be reused for subsequent API calls.
3

Submit for analysis

Use the Object Detection Endpoint to send an image for analysis. We suggest you provide a unique scanId for each submission.Provide the objects to locate in the objectDetection field as a JSON-encoded array of objects, for example [{"object":"face"},{"object":"hand"}].

Image Requirements

  • Size: Minimum 512x512px, maximum 6000x4500px (27 megapixels)
  • File size: Less than 32MB
  • Formats: PNG, JPG, JPEG, BMP, WebP, HEIC/HEIF

Object Detection Requirements

  • At least one entry, maximum 3 entries.
  • Each entry’s object value must be a non-empty string of at most 32 characters.
For testing, set sandbox=true. Sandbox mode is free and returns mock results.
4

Interpreting the response

The API response contains:
  • imageInfo with the image dimensions, used to decode the masks.
  • detectedObjects - one entry per object located in the image, each with an object name and a Run-Length Encoded (RLE) mask.
  • scannedImage with scan details including credits used.
Objects that were requested but not found are omitted from detectedObjects, so look entries up by object rather than by position.

Understanding the RLE Mask

Run-Length Encoding (RLE) represents each object’s region efficiently as arrays of starts positions and lengths over a flattened 1D version of the image. Decode it into a binary mask to visualize the object’s region:
Python
For a complete breakdown of all fields in the response, see the Object Detection Response documentation.
5

Summary

You have successfully submitted an image for object detection. You can now use the per-object masks in your application, for example to crop, blur, or highlight the detected regions.

Frequently asked questions

Yes. You send the image to the check endpoint and receive the results in the same API call, with no webhook required.
Between 1 and 3 objects per request. Each object’s name must be a non-empty string of at most 32 characters.
No. Object detection performs segmentation only. Use the AI Image Detection API to detect AI-generated content.
Objects that are not found are omitted from the detectedObjects array. Look entries up by their object name rather than by position.

Next steps

API Reference

Explore the full API reference for the Object Detection endpoint.

Object Detection Response

Explore the full response structure for Object Detection.