AI Generated Image Detection Endpoint
This endpoint is tailored for developers who need to implement automated verification of AI-generated images using advanced detection algorithms.
It allows you to submit images for analysis based on the settings configured in your dashboard, including detection sensitivity and specific content categories to flag or ignore. The AI model will evaluate each image and return a structured response indicating the likelihood of AI generation.
This endpoint enables you to:
- Analyze single or multiple images for AI-generated content in a single request
- Adjust detection sensitivity and content categories through dashboard settings
- Receive analysis results in JSON format by specifying the desired response format in the endpoint URL
- Identify detected content types such as deepfakes, synthetic images, and manipulated media
- Filter results based on predefined categories (e.g., synthetic, manipulated, AI-generated)
- Automatically delete the processed images after analysis to maintain data integrity and privacy
Data Privacy and Security
We strictly comply with European data protection standards, ensuring that all submitted images are not shared, sold, or accessible to third parties. Upon completing the analysis, all uploaded content is immediately and permanently removed from our servers, adhering to the highest standards of data security and user privacy.
Image Scan Request
Here’s a sample request to perform an AI-generated image detection scan:
POSTAPI key required
https://api.nudescan.io/v1/scan/ai/image
curl -X POST https://api.nudescan.io/v1/scan/ai/image \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Transfer-Encoding: chunked" \
-F "files=@/path/to/photo1.jpg;type=application/octet-stream" \
-F "files=@/path/to/photo2.jpg;type=application/octet-stream"
const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');
// Define the API endpoint
const apiUrl = 'https://api.nudescan.io/v1/scan/ai/image';
// Define the function to make the POST request
async function sendPostRequest(photoFiles) {
try {
const form = new FormData();
// Add all files as "files"
photoFiles.forEach((photo) => {
form.append('files', fs.createReadStream(photo.path), {
filename: photo.filename,
contentType: 'application/octet-stream', // Specify the content type
Authorization: 'Bearer YOUR_API_KEY' // Add the API key as a Bearer token
});
});
const response = await axios.post(apiUrl, form, {
headers: {
...form.getHeaders()
}
});
const { results } = response.data;
// Update the photoFiles with the 'abuse' value
return photoFiles.map((photo, index) => {
return { ...photo, abuse: results[index] };
});
} catch (error) {
console.error('Error sending photos for classification:', error.message);
throw error;
}
}
// Call the function
sendPostRequest();
<?php
// API URL
$apiUrl = 'https://api.nudescan.io/v1/scan/ai/image';
$apiKey = 'YOUR_API_KEY';
// Funktion zum Senden des POST-Requests
function sendPostRequest(array $photoFiles) {
global $apiUrl, $apiKey;
$curl = curl_init();
$boundary = uniqid();
$delimiter = '-------------' . $boundary;
$eol = "\r\n";
$headers = [
"Authorization: Bearer $apiKey",
"Content-Type: multipart/form-data; boundary=" . $delimiter
];
$body = '';
foreach ($photoFiles as $index => $photo) {
$filePath = $photo['path'];
$filename = $photo['filename'];
if (file_exists($filePath)) {
$fileContents = file_get_contents($filePath);
$body .= "--" . $delimiter . $eol;
$body .= 'Content-Disposition: form-data; name="files[]"; filename="' . $filename . '"' . $eol;
$body .= 'Content-Type: application/octet-stream' . $eol . $eol;
$body .= $fileContents . $eol;
}
}
$body .= "--" . $delimiter . "--" . $eol;
curl_setopt_array($curl, [
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $body
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode !== 200) {
echo "Error sending photos for classification: " . curl_error($curl) . PHP_EOL;
curl_close($curl);
return false;
}
curl_close($curl);
$responseData = json_decode($response, true);
if (isset($responseData['results'])) {
foreach ($photoFiles as $index => &$photo) {
$photo['abuse'] = $responseData['results'][$index] ?? null;
}
}
return $photoFiles;
}
// Beispielaufruf
$photos = [
['path' => 'path/to/photo1.jpg', 'filename' => 'photo1.jpg'],
['path' => 'path/to/photo2.jpg', 'filename' => 'photo2.jpg']
];
$result = sendPostRequest($photos);
print_r($result);
import requests
# API URL
api_url = "https://api.nudescan.io/v1/scan/ai/image"
api_key = "YOUR_API_KEY"
def send_post_request(photo_files):
headers = {
"Authorization": f"Bearer {api_key}"
}
files = [
('files', (photo['filename'], open(photo['path'], 'rb'), 'application/octet-stream'))
for photo in photo_files
]
try:
response = requests.post(api_url, headers=headers, files=files)
response.raise_for_status()
response_data = response.json()
# Update photo_files with 'abuse' values
if 'results' in response_data:
for index, photo in enumerate(photo_files):
photo['abuse'] = response_data['results'][index] if index < len(response_data['results']) else None
return photo_files
except requests.RequestException as e:
print(f"Error sending photos for classification: {e}")
raise
# Beispielaufruf
photos = [
{'path': 'path/to/photo1.jpg', 'filename': 'photo1.jpg'},
{'path': 'path/to/photo2.jpg', 'filename': 'photo2.jpg'}
]
result = send_post_request(photos)
print(result)
Parameters
(object) Max 25 files Max 15 MB / File REQUIRED
The file added to FormData is an object representing a file or binary data, typically consisting of properties like name, type, and size.
Response
The API returns a JSON array containing the results of the submitted images.
[
{
"isAi": true
}
]
Response Fields
(boolean)
A boolean flag indicating whether any detected category's score has exceeded the predefined AI generation threshold.
Error Responses
| Status Code | Description |
|---|---|
| 401 | Not authorized - Invalid or missing API key |
| 403 | Forbidden - You don’t have permission |
| 404 | Not Found - Account or user not found |
| 500 | Internal Server Error - An unexpected error occurred |
| 512 | Parameter error - Check your sent data |