Image Nudity Detection Scan Endpoint
This endpoint is designed for developers who need to implement automated image content moderation using AI-powered detection of explicit or unwanted content.
It allows you to submit images for analysis based on the settings configured in your dashboard, including detection strictness and specific content categories to flag or ignore. The AI model will evaluate each image and return a structured response indicating the presence of inappropriate content.
This endpoint allows you to:
- Analyze single or multiple images for explicit content in a single request
- Customize detection sensitivity and categories via dashboard settings
- Receive results in either JSON format by specifying the desired response format in the endpoint URL
- Identify detected content types such as nudity, partial nudity, and sexually suggestive imagery
- Filter results based on predefined categories (e.g., explicit, suggestive, partial nudity)
- Automatically discard the processed images after analysis to maintain data privacy
Data Privacy and Security
We strictly adhere to European data protection regulations, ensuring that all submitted images and videos are not shared, sold, or made accessible to third parties under any circumstances. Once the analysis is complete, all uploaded content is immediately and permanently deleted from our servers, maintaining the highest standards of data security and user privacy.
Image Scan Request
Here’s a sample request to perform an image nudity detection scan:
POSTAPI key required
https://api.nudescan.io/v1/scan/image
curl -X POST https://api.nudescan.io/v1/scan/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/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/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/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.
[
{
"category_scores": {
"sex": 0.82,
"porn": 0.65,
"exposed": 0.91,
"nude": 0.47
},
"detected_categories": [
{
"category": "sex",
"score": 0.82
},
{
"category": "porn",
"score": 0.65
},
{
"category": "exposed",
"score": 0.91
}
],
"isNude": true
}
]
Response Fields
(object)
A nested object containing the highest detection scores for each specified content category.
(float)
The detection score for sexually suggestive content.
(float)
The detection score for pornographic content.
(float)
The detection score for exposed nudity.
(float)
The detection score for nudity in general.
(array)
An array of detected categories that exceeded the abuse threshold, including the category name and its respective score.
(string)
The name of the detected content category (e.g., "sex", "porn", "exposed").
(float)
The confidence score for the detected category, ranging from 0.0 to 1.0.
(boolean)
A flag indicating whether any detected category's score has exceeded the predefined abuse 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 |