AI Image Detection
The Copyleaks AI Image Detection API provides advanced capabilities to detect whether an image is AI-generated or partially AI-generated. This API uses sophisticated AI models to analyze images and produce a mask that overlays the submitted image, indicating which parts are AI-generated and which are authentic.
Request
Section titled “Request”Path Parameters
Section titled “Path Parameters”A unique scan id provided by you. We recommend you use the same id in your database to represent the scan in the Copyleaks database. This will help you to debug incidents. Using the same ID for the same file will help you to avoid network problems that may lead to multiple scans for the same file. Learn more about the criteria for creating a Scan ID.
>= 3 characters
<= 36 characters
Match pattern: [a-z0-9] !@$^&-+%=_(){}<>';:/.",~
|
Headers
Section titled “Headers”Content-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN
Request Body
Section titled “Request Body”The request body is a JSON object containing the image to analyze.
The base64-encoded image data to be analyzed for AI generation.
Requirements:
- Minimum 512×512px, maximum 16 megapixels, less than 32MB.
- Supported formats:
PNG
,JPEG
,BMP
,WebP
,HEIC/HEIF
Example: "aGVsbG8gd29ybGQ="
The name of the image file including its extension.
Requirements:
.png
,.bmp
,.jpg
,.jpeg
,.webp
,.heic
,.heif
<= 255 characters
Example: "my-image.png"
The AI detection model to use for analysis. You can use either the full model name or its alias:
- AI Image 1 Ultra:
"ai-image-1-ultra-01-09-2025"
(full name) or"ai-image-1-ultra"
(alias) - AI image detection model. Produces an overlay of the detected AI segments.
Example: "ai-image-1-ultra-01-09-2025"
or "ai-image-1-ultra"
Use sandbox mode to test your integration with the Copyleaks API without consuming any credits.
Submit images for AI detection and get returned mock results, simulating Copyleaks’ API functionality to ensure you have successfully integrated the API.
This feature is intended to be used for development purposes only.
Responses
Section titled “Responses”The image was successfully analyzed.
Response Schema
The response contains the following fields:
result object
summary object
imageInfo object
shape object
metadata object
scannedDocument object
Example Response
A typical response from this endpoint:
{ "model": "v1", "result": { "starts": [ 0, 512, 1536, 2560 ], "lengths": [ 256, 512, 768, 1024 ]// ... truncated
Invalid request parameters, unsupported image format, or image processing issues.
Authentication or authorization issues.
You don't have enough credits to complete the request.
Too many requests have been sent. The request has been rejected.
The server encountered an internal error or misconfiguration.
Examples
Section titled “Examples”POST https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/checkContent-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN
{ "base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJ...", "filename": "test-image.png", "sandbox": true, "model": "ai-image-1-ultra-01-09-2025"}
curl --request POST \ --url https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/check \ --header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJ...", "filename": "test-image.png", "sandbox": true, "model": "ai-image-1-ultra-01-09-2025" }'
const imageFile = document.getElementById('fileInput').files[0];const reader = new FileReader();
reader.onload = async function(e) { const base64Data = e.target.result.split(',')[1];
const response = await fetch('https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/check', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_LOGIN_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ base64: base64Data, filename: imageFile.name, sandbox: true, model: 'ai-image-1-ultra-01-09-2025' }) });
const result = await response.json(); console.log('AI Detection Result:', result);};
reader.readAsDataURL(imageFile);
import base64import requests
# Read and encode the imagewith open('test-image.png', 'rb') as image_file: base64_image = base64.b64encode(image_file.read()).decode('utf-8')
# Prepare the requesturl = 'https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/check'headers = { 'Authorization': 'Bearer YOUR_LOGIN_TOKEN', 'Content-Type': 'application/json'}
payload = { 'base64': base64_image, 'filename': 'test-image.png', 'sandbox': True, 'model': 'ai-image-1-ultra-01-09-2025'}
# Send the requestresponse = requests.post(url, json=payload, headers=headers)result = response.json()
print(f"AI Detection Summary: {result['summary']}")