AI Image Detection
Detect whether an image is AI-generated or partially AI-generated. Returns a detailed analysis with an RLE mask indicating AI-generated regions.
Authentication Required
You need to login with a user and API key in order to access this method. Add this HTTP header to your request:
Authorization: Bearer < Your-Login-Token >
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] !@$^&-+%=_(){}<>';:/.",~|
Supported Content Types
Section titled “Supported Content Types”Submit images using multipart/form-data (recommended) or JSON with base64.
Option 1: Multipart/Form-Data (Recommended)
Section titled “Option 1: Multipart/Form-Data (Recommended)”Headers:
Content-Type: multipart/form-dataAuthorization: Bearer YOUR_LOGIN_TOKENOption 2: JSON with Base64
Section titled “Option 2: JSON with Base64”Headers:
Content-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKENBody Parameters
Section titled “Body Parameters”The image field used depends on the content type:
multipart/form-data→ use theimagefield (binary file)application/json→ use thebase64field (base64-encoded string)
Binary image file. Required when using multipart/form-data. Base64-encoded images are not accepted for multipart requests.
Requirements:
- Size: Minimum 512×512px, maximum 6000×4500px (27 megapixels)
- File size: Less than 32MB
- Formats: PNG, JPG, JPEG, BMP, WebP, HEIC/HEIF
Base64-encoded image data. Required when using application/json content type.
Requirements:
- Size: Minimum 512×512px, maximum 6000×4500px (27 megapixels)
- File size: Less than 32MB (before encoding)
- Formats: PNG, JPG, JPEG, BMP, WebP, HEIC/HEIF
Example: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJ..."
The name of the image file including its extension.
Requirements:
- Allowed file extensions:
.png,.jpg,.jpeg,.bmp,.webp,.heic,.heif <= 255 characters
Example: "my-image.png"
The AI detection model to use for analysis:
- AI Image 1 Ultra:
"ai-image-1-ultra"
Example: "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": "ai-image-1-ultra", "result": { "starts": [ 0, 512, 1536, 2560 ], "lengths": [ 256, 512, 768, 1024 ]// ... truncatedInvalid 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”Multipart/Form-Data Examples (Recommended)
Section titled “Multipart/Form-Data Examples (Recommended)”POST https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/checkContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gWAuthorization: Bearer YOUR_LOGIN_TOKEN
------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="image"; filename="test-image.png"Content-Type: image/png
[binary image data]------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="filename"
test-image.png------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="sandbox"
true------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="model"
ai-image-1-ultra------WebKitFormBoundary7MA4YWxkTrZu0gW--curl --request POST \ --url https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/check \ --header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \ --form 'image=@/path/to/test-image.png' \ --form 'filename=test-image.png' \ --form 'sandbox=true' \ --form 'model=ai-image-1-ultra'const imageFile = document.getElementById('fileInput').files[0];const formData = new FormData();
formData.append('image', imageFile);formData.append('filename', imageFile.name);formData.append('sandbox', 'true');formData.append('model', 'ai-image-1-ultra');
const response = await fetch('https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/check', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_LOGIN_TOKEN' }, body: formData});
const result = await response.json();console.log('AI Detection Result:', result);import requests
# Prepare the requesturl = 'https://api.copyleaks.com/v1/ai-image-detector/my-scan-123/check'headers = { 'Authorization': 'Bearer YOUR_LOGIN_TOKEN'}
# Prepare multipart form datawith open('test-image.png', 'rb') as image_file: files = { 'image': ('test-image.png', image_file, 'image/png') } data = { 'filename': 'test-image.png', 'sandbox': 'true', 'model': 'ai-image-1-ultra' }
# Send the request response = requests.post(url, files=files, data=data, headers=headers)
result = response.json()print(f"AI Detection Summary: {result['summary']}")JSON Examples
Section titled “JSON 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"}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" }'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' }) });
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'}
# Send the requestresponse = requests.post(url, json=payload, headers=headers)result = response.json()
print(f"AI Detection Summary: {result['summary']}")