curl --request PUT \
--url https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit \
--header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com/annual-report.pdf",
"fileName": "annual-report.pdf",
"model": "ai-image-1-ultra",
"maskType": "none",
"webhooks": {
"url": "https://your-server.com/webhook/receive-results"
}
}'
import requests
url = 'https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit'
headers = {
'Authorization': 'Bearer YOUR_LOGIN_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'url': 'https://example.com/annual-report.pdf',
'fileName': 'annual-report.pdf',
'model': 'ai-image-1-ultra',
'maskType': 'none',
'webhooks': {
'url': 'https://your-server.com/webhook/receive-results'
}
}
response = requests.put(url, json=payload, headers=headers)
print(f"Submission status: {response.status_code}") # 201 Created
const response = await fetch(
'https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_LOGIN_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/annual-report.pdf',
fileName: 'annual-report.pdf',
model: 'ai-image-1-ultra',
maskType: 'none',
webhooks: {
url: 'https://your-server.com/webhook/receive-results'
}
})
}
);
console.log('Submission status:', response.status); // 201 Created
PUT https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit
Content-Type: application/json
Authorization: Bearer YOUR_LOGIN_TOKEN
{
"url": "https://example.com/annual-report.pdf",
"fileName": "annual-report.pdf",
"model": "ai-image-1-ultra",
"maskType": "none",
"webhooks": {
"url": "https://your-server.com/webhook/receive-results"
}
}
{}
{
"error": {
"type": "invalid_request_error",
"id": "unsupported_file_type",
"code": 10,
"message": "This file type is not supported."
}
}
{
"error": "Authentication or authorization failed."
}
{
"error": {
"type": "authentication_error",
"id": "authorization_denied",
"code": 37,
"message": "Please reach out to your sales representative to access the object detection feature."
}
}
{}
{
"error": "Rate limit exceeded."
}
{
"error": "The server encountered an internal error."
}
AI Image Detection
AI Image Detection for Images and PDFs (Async)
Submit an image or a PDF for AI-generated content detection. Every image in the file is checked, and one result document is delivered to your webhook.
curl --request PUT \
--url https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit \
--header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com/annual-report.pdf",
"fileName": "annual-report.pdf",
"model": "ai-image-1-ultra",
"maskType": "none",
"webhooks": {
"url": "https://your-server.com/webhook/receive-results"
}
}'
import requests
url = 'https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit'
headers = {
'Authorization': 'Bearer YOUR_LOGIN_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'url': 'https://example.com/annual-report.pdf',
'fileName': 'annual-report.pdf',
'model': 'ai-image-1-ultra',
'maskType': 'none',
'webhooks': {
'url': 'https://your-server.com/webhook/receive-results'
}
}
response = requests.put(url, json=payload, headers=headers)
print(f"Submission status: {response.status_code}") # 201 Created
const response = await fetch(
'https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_LOGIN_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/annual-report.pdf',
fileName: 'annual-report.pdf',
model: 'ai-image-1-ultra',
maskType: 'none',
webhooks: {
url: 'https://your-server.com/webhook/receive-results'
}
})
}
);
console.log('Submission status:', response.status); // 201 Created
PUT https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit
Content-Type: application/json
Authorization: Bearer YOUR_LOGIN_TOKEN
{
"url": "https://example.com/annual-report.pdf",
"fileName": "annual-report.pdf",
"model": "ai-image-1-ultra",
"maskType": "none",
"webhooks": {
"url": "https://your-server.com/webhook/receive-results"
}
}
{}
{
"error": {
"type": "invalid_request_error",
"id": "unsupported_file_type",
"code": 10,
"message": "This file type is not supported."
}
}
{
"error": "Authentication or authorization failed."
}
{
"error": {
"type": "authentication_error",
"id": "authorization_denied",
"code": 37,
"message": "Please reach out to your sales representative to access the object detection feature."
}
}
{}
{
"error": "Rate limit exceeded."
}
{
"error": "The server encountered an internal error."
}
Submit an image or a PDF for AI-generated content detection. The endpoint is asynchronous - it returns
Candidate images are the images whose declared size is within the minimum-side, megapixel and aspect-ratio limits. They are counted before the images are decoded, and every place an image is drawn counts separately: a logo on 3 pages is 3 candidate images.
An image in a PDF that is outside the per-image limits, or fails a quality check (for example too dark, or too few colors), is not an error: it is listed in the result as
When every analyzed image fails during detection, the webhook receives
201 Created immediately, and one result document, holding a result for every image in the file, is delivered to your webhook once processing is complete.
For a PDF, Copyleaks finds the images embedded in the document, checks each image, and tells you where it is drawn. A single image is answered with the same document shape, holding one image, so your webhook parses one format whatever you sent.
Use this endpoint for PDFs, or when you want one webhook format for images and PDFs alike. The v1 asynchronous endpoint and the synchronous AI Image Detection endpoint are unchanged and still accept images only.
Authentication is required. See Login for how to obtain a bearer token.
Path parameters
A unique scan id provided by you. We recommend using the same id in your database to represent the scan in the Copyleaks database - this helps debug incidents and avoid duplicate scans for the same file. See criteria for creating a Scan ID.
>= 3 characters <= 36 charactersMatch pattern: [a-z0-9!@$^&+%=_(){}<>'";:/.,~`|\\-] (\\ is a single backslash)Scan IDs that contain g, then one or more o or 0, then gle (for example google, gogle, g00gle) are rejected.Submitting a scan id that already exists returns 409 Conflict.Headers
Content-Type: application/json
Authorization: Bearer YOUR_LOGIN_TOKEN
Body parameters
Provide the file either as aurl or as base64.
Publicly accessible
http or https URL of the image or PDF to analyze. Required unless base64 is provided.The URL must resolve to a public address. URLs that point to private, loopback or link-local addresses are refused with the bad_url error, and every redirect (up to 5) is checked the same way.Example: "https://example.com/annual-report.pdf"The file content, base64-encoded. Required unless
url is provided. When both are sent, base64 is used. The whole request body is limited to 70MB, so a file sent this way must also stay under the 50MB file limit once decoded.Example: "JVBERi0xLjcKJeLjz9M..."The name of the file including its extension. The extension decides whether the file is handled as an image or as a PDF.Supported extensions:
.pdf, .jpg, .jpeg, .png, .webp, .bmp, .heic, .heif, .avifAny other extension is refused at submit with the unsupported_file_type error (code 10).Example: "annual-report.pdf"The AI image detection model to use for analysis.
- AI Image 1 Ultra:
"ai-image-1-ultra"
"ai-image-1-ultra"The type of detection mask to include for each analyzed image.Supported values:
"binary"(default) - a mask of the regions flagged as AI-generated, as a transparent PNG inresult.base64: palette index0is human,1is AI."heatmap"- the same transparent PNG, where the palette index is the confidence level,1to5(0is human). Higher levels mean higher confidence."none"- no mask. Each image carries its scores only, which keeps the webhook body small for large PDFs.
400.Example: "none"Optional. The colours and opacity drawn into the PNG masks, so they can be laid straight over the image. Only how a mask looks changes: the palette index is the mask value whatever the style.
An invalid style (a colour that is not
human, ai and levels are ignored for maskType: "none"; object applies to the detectedObjects masks.Show properties
Show properties
Human pixels:
color as "#RRGGBB" and opacity from 0 (fully transparent) to 1 (solid). By default human pixels are fully transparent.AI pixels of a binary mask, with the same
color and opacity fields. Its opacity also applies to every heatmap level.#RRGGBB, an opacity outside 0-1, not exactly five levels, or an unknown field) is refused before any charge, with missing_parameter (1) naming the maskStyle field.Example: { "ai": { "color": "#00A3FF", "opacity": 0.5 } }Optional. A list of objects to locate and segment within every analyzed image, with the same rules as the v1 asynchronous endpoint. When provided, each analyzed image additionally includes a
detectedObjects array.- Maximum 3 entries.
- Each entry’s
objectvalue must be a non-empty string of at most 32 characters. - Object detection must be enabled for your account; otherwise the request is refused with
403 Forbidden.
[{ "object": "face" }]Webhook configuration for receiving the async results.
Show properties
Show properties
The URL that Copyleaks will POST the result document to when processing is complete.Example:
"https://your-server.com/webhook/receive-results"Use sandbox mode to test your integration without consuming any credits. The request is validated as usual, and your webhook receives a mock result document holding one image. Intended for development purposes only.
An optional string payload that Copyleaks will include in the webhook body, allowing you to correlate the callback with your internal data.Example:
"order-id-12345"Limits
| Limit | Value |
|---|---|
| File size | 50MB |
Request body (with base64) | 70MB |
| PDF pages | 100 |
| Candidate images in a PDF | 25 |
| Each image | At least 400px on each side, at most 27 megapixels, aspect ratio at most 4:1, under 32MB |
| Result document | 20MB |
skipped, with the reason, and is not charged.
When the result document would be larger than 20MB, the scan fails with internal_server_error (code 16) and all credits are refunded. Use maskType: "none" for PDFs with many large images.
Billing
- 1 credit per analyzable image.
- An image drawn several times in a PDF (for example a logo on every page) is a separate image, and is charged, each time it is drawn.
skippedandduplicateimages are free.- Images that fail during detection are refunded, so
scannedDocument.actualCreditsis what you pay. - A file rejected before detection (see Errors) is not charged.
insufficient_credits error (code 13) with the required number of credits, and nothing is charged.
curl --request PUT \
--url https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit \
--header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com/annual-report.pdf",
"fileName": "annual-report.pdf",
"model": "ai-image-1-ultra",
"maskType": "none",
"webhooks": {
"url": "https://your-server.com/webhook/receive-results"
}
}'
import requests
url = 'https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit'
headers = {
'Authorization': 'Bearer YOUR_LOGIN_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'url': 'https://example.com/annual-report.pdf',
'fileName': 'annual-report.pdf',
'model': 'ai-image-1-ultra',
'maskType': 'none',
'webhooks': {
'url': 'https://your-server.com/webhook/receive-results'
}
}
response = requests.put(url, json=payload, headers=headers)
print(f"Submission status: {response.status_code}") # 201 Created
const response = await fetch(
'https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_LOGIN_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/annual-report.pdf',
fileName: 'annual-report.pdf',
model: 'ai-image-1-ultra',
maskType: 'none',
webhooks: {
url: 'https://your-server.com/webhook/receive-results'
}
})
}
);
console.log('Submission status:', response.status); // 201 Created
PUT https://api.copyleaks.com/v2/ai-image-detector-async/my-pdf-scan-1/submit
Content-Type: application/json
Authorization: Bearer YOUR_LOGIN_TOKEN
{
"url": "https://example.com/annual-report.pdf",
"fileName": "annual-report.pdf",
"model": "ai-image-1-ultra",
"maskType": "none",
"webhooks": {
"url": "https://your-server.com/webhook/receive-results"
}
}
{}
{
"error": {
"type": "invalid_request_error",
"id": "unsupported_file_type",
"code": 10,
"message": "This file type is not supported."
}
}
{
"error": "Authentication or authorization failed."
}
{
"error": {
"type": "authentication_error",
"id": "authorization_denied",
"code": 37,
"message": "Please reach out to your sales representative to access the object detection feature."
}
}
{}
{
"error": "Rate limit exceeded."
}
{
"error": "The server encountered an internal error."
}
Webhook payload
When processing completes, Copyleaks sends aPOST request to your webhook URL with one JSON document for the whole file. See the AI Image Document Response reference for every field.
{
"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 } }
},
{
"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 } }
},
{
"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"
}
- One entry per image drawn: an image drawn on several pages (for example a logo) is a separate entry on each page, with its own
id, score and location. idis"1","2", … in the order images first appear in the file. Ids are assigned before any image is skipped, so they stay stable.locations[].boxplaces the image on its page as fractions of the page width and height, measured from the top-left corner. It is absent when the page layout could not be read. A single image is one location on page 1 covering the whole page.statusisanalyzed,skipped(free, with anerrorid such asimage_too_smallorimage_too_dark),duplicate(free: the same picture stored a second time in the file, withduplicateOfnaming the image it repeats; it carries noresultordetectedObjects) orfailed(refunded, with anerrorid).- A single image that is outside the per-image limits is answered with a document holding one
skippedimage, at 0 credits.
Errors
Some errors are returned at submit, before anything is queued. The others are found once the file is downloaded and arrive at your webhook instead of the result document, in the standard error format. No credits are charged for any of them; the result-size error is refunded in full.| Condition | Where | Error (code) |
|---|---|---|
fileName is not an image or a PDF | Submit 400 | unsupported_file_type (10) |
maskType is not binary, none or heatmap | Submit 400 | missing_parameter (1) |
maskStyle is invalid | Webhook | missing_parameter (1), naming the maskStyle field |
objectDetection is invalid | Submit 400 | missing_parameter (1) |
| Object detection is not enabled for your account | Submit 403 | authorization_denied (37) |
base64 is not valid base64 | Submit 400 | Plain body "Failed to process image" |
| The request body is larger than 70MB | Submit | Rejected before validation |
| The URL resolves to a non-public address | Webhook | bad_url (44) |
| The file could not be downloaded | Webhook | download_failed (5) |
| The file is larger than 50MB | Webhook | file_too_large (6) |
| The PDF needs a password to open | Webhook | file_password_protected (41) |
| The PDF cannot be read, or has no pages | Webhook | invalid_file (14) |
| The PDF has more than 100 pages | Webhook | document_too_long (12) |
| The PDF has more than 25 candidate images | Webhook | too_many_images (75) |
| The PDF has no image that can be analyzed | Webhook | no_analyzable_images (74), with one details entry per skip reason |
| Not enough credits | Webhook | insufficient_credits (13) |
| PDF processing is temporarily unavailable | Webhook | temporarily_unavailable (9) |
| The result document would be larger than 20MB | Webhook | internal_server_error (16), all credits refunded |
internal_server_error (16) and all credits are refunded.
