Get started
Before you begin
Before you start, ensure you have the following:- An active Copyleaks account. If you don’t have one, sign up for free.
- You can find your API key on the API Dashboard.
Installation
Choose your preferred method for making API calls.HTTP needs no installation - call the API with any standard HTTP client, or import our Postman collection for a quicker start.
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 theAuthorization: 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.
Submit for analysis
Use the AI Image Detector Endpoint to send an image for analysis. We suggest you provide a uniquescanId for each submission.This guide uses multipart/form-data format, which sends the image file directly without base64 encoding overhead.Image Requirements
- Size: Minimum 512×512px, maximum 6000×4500px (27 megapixels)
- File size: Less than 32MB
- Formats: PNG, JPG, JPEG, BMP, WebP, HEIC/HEIF
Interpreting the response
The API response contains:- A
summaryobject with the overall percentage of AI vs. human pixels - A
resultobject with a Run-Length Encoded (RLE) mask imageInfowith the image dimensions and metadata (when available)scannedDocumentwith scan details including credits used
Understanding the RLE Mask
Run-Length Encoding (RLE) is a compression method used to represent the AI-detected regions of the image efficiently. It provides an array ofstarts positions and lengths for each run of AI-detected pixels in a flattened 1D version of the image.You can decode this RLE data to create a binary mask. Below are implementations in different languages:1 (or true in Java) represents an AI-detected pixel. You can use this mask to create a visual overlay on the original image.Creating a Visual Overlay
After decoding the RLE data, you can use the resulting mask to draw a semi-transparent overlay on the original image. Here are some examples of how to achieve this:Summary
You have successfully submitted an image for AI detection. You can now use the JSON response in your application to take further action based on the findings.Frequently asked questions
Is the AI image detection API synchronous?
Is the AI image detection API synchronous?
Yes. You send the image to the check endpoint and receive the results in the same API call, with no webhook required.
What are the image requirements?
What are the image requirements?
Images must be between 512×512px and 6000×4500px (27 megapixels) and under 32MB. Supported formats are PNG, JPG, JPEG, BMP, WebP, and HEIC/HEIF.
Can I submit an image as base64 instead of a binary file?
Can I submit an image as base64 instead of a binary file?
Yes. Use
application/json to send a base64-encoded image. The multipart/form-data method shown in this guide accepts only binary files, not base64.What does the response contain?
What does the response contain?
A
summary with the overall percentage of AI vs. human pixels, a result object with a Run-Length Encoded (RLE) mask of AI-detected regions, imageInfo with dimensions and metadata, and scannedDocument with scan details. See the AI Image Detection Response reference.How do I see which parts of the image are AI-generated?
How do I see which parts of the image are AI-generated?
Decode the RLE mask into a binary mask (one value per pixel), then draw a semi-transparent overlay on the original image. This guide includes ready-to-use decode and overlay code in Python, JavaScript, and Java.
Next steps
API Reference
Explore the full API reference for the AI Image Detection endpoint.
AI Image Detector Response
Explore the full response for the AI Image Detection.
Performance Best Practices
Learn optimization strategies for performance and accuracy with image detection.
Testing Methodology
Learn about the accuracy and testing methodology of the AI Image Detection product.

