API Documentation

Our REST API enables you to integrate image analysis capabilities directly into your applications. Below you'll find everything you need to get started.

Authentication

All API requests require an API key to be included in the header:

X-API-Key: nsfw_2f7ab4f1d743d69ee242eec932b19671

Endpoints

POST/api/v1/detect-nsfw

Request

Content-Type: multipart/form-data

ParameterTypeDescription
imageFileImage file to analyze

Response

{
    "result": [
        {
            "label": "Neutral",
            "score": 0.64818274974823
        },
        {
            "label": "Porn",
            "score": 0.2696273922920227
        },
        {
            "label": "Drawing",
            "score": 0.050479065626859665
        },
        {
            "label": "Hentai",
            "score": 0.02014758251607418
        },
        {
            "label": "Sexy",
            "score": 0.011563214473426342
        }
    ],
    "type": "normal",
    "code": 0
}

Example Request

cURL

curl -X POST \ -H "X-API-Key: your_api_key_here" \ -F "image=@/path/to/image.jpg" \ https://nsfwdet.com/api/v1/detect-nsfw

JavaScript

const formData = new FormData(); formData.append('image', imageFile); const response = await fetch('https://nsfwdet.com/api/v1/detect-nsfw', { method: 'POST', headers: { 'X-API-Key': 'your_api_key_here' }, body: formData }); const data = await response.json();

Rate Limit

IPRate
1 IP20/min

Error Handling

Status CodeDescription
400Invalid request (e.g., missing image)
401Invalid or missing API key
429Rate limit exceeded