NSFW-Detection API

Also available as TOR hidden service: nsfwapi5vviz2jry.onion
URL of Image

or

Upload




Free

  • No key needed
  • Analyze 10 Images per day and IP
  • Shared workers

Indie

  • 5$ one time payment
  • Analyze 5000 Images
  • Previously analyzed images are free
  • Shared workers

Pro

  • 20$ / Month
  • Analyze as many images as you want
  • Dedicated workers
Need a different package? Contact us: [email protected]

About

This NaaS (Nudity-detection as a service) is using fine tuned machine learning algorithms to perform image analysis.

When you submit an image or URL it gets sent to our cluster where a dynamic number of workers run the trained model to distinguish images between Pornographic, Not safe for work (NSFW) and Neutral

  • The difference between pornographic and NSFW is that the latter could be bare skin like a photo of people on the beach
  • Every IPv4 address on the internet can analyze 10 images for free per day
  • The neural network was trained on images resized to 400x400 pixels. Resizing your images to this size before uploading will drastically improve performance because of lower transfer size

Using the API

Basics

If you have an API key you can send it with every request either as HTTP header with the name "NSFWKEY". If no key is supplied, free quota will be used.

Base URL
https://nsfw-categorize.it/api
Answer structure

{
  "status": "OK/ERR/NOQUOTA",
  "data": {
    /* the data of the successful request */
    "confidence": 98.74,
    "hash": "c634eaef41791d[..]2edda7aec4598b",
    "classification":"nsfw",
    "nsfw": true,
    "porn": false
  },
  "quota": 4520 /* The remaining quota on your key or free calls */
}

Error handling

When the status is ERR there will always be a field "reason" that explains what went wrong.

{
  "status": "ERR",
  "reason": "File not a valid image"
}
                    
When you have used up all remaining quota you get status: NOQUOTA

{
  "status": "NOQUOTA",
  "reason": "The quota of your API key has depleted. Visit https://nsfw-categorize.it to re-fill your key"
}
                    

Uploading an image

API call
/upload

You can post a file using the POST variable image

CURL example
curl -s -F "[email protected]" "https://nsfw-categorize.it/api/upload"
Output

{
  "status": "OK",
  "data": {
    "confidence": 98.74,
    "hash": "c634eaef41791d[..]2edda7aec4598b",
    "classification":"nsfw",
    "nsfw": true,
    "porn": false
  },
  "key_quota": 4997
}

Grabbing a URL

API call
/upload?url=url of image

You can specify a URL in the POST or GET variable url that the call will try to download and process.

CURL example
curl -s "https://nsfw-categorize.it/api/upload?url=https://i.imgur.com/qgDhTlX.jpg
Output

{
  "status": "OK",
  "data": {
    "confidence": 98.74,
    "hash": "c634eaef41791d[..]2edda7aec4598b",
    "classification":"nsfw",
    "nsfw": true,
    "porn": false
  },
  "key_quota": 4996
}

Checking results

If you want to check if a file you have on hand was already checked by our API, you can use this call.

API call
/hash/sha1 hash of file
CURL example
curl -s "https://nsfw-categorize.it/api/hash/c634ead[..]7aec4598b"
Output

{
  "status": "OK",
  "data": {
    "confidence": 98.74,
    "hash": "c634ead[..]7aec4598b",
    "classification":"nsfw",
    "nsfw": true,
    "porn": false
  },
  "key_quota": 4996
}

Free vs Key

If no valid key is sent to the API, the free quota of 10 calls per IP and day will be used. The daily free quota will reset 24 hours after the last API call (with a quota cost of 1) was received.

Quota costs
No key With key
Uploading a new image 1 1
Uploading an existing image 1 0
Checking a hash 0 0
Check out our example code


What about privacy?

All uploaded images are deleted automatically after analyzation

More info

  • In accordance with the GDPR we anonymize IP adresses after one week
  • We save the SHA1 hashes of all images so we don't have to analyze same uploads multiple times
  • We save the nudity prediction results for all images (but not the images themselves)
  • We're not using any trackers or external scripts
  • All data is stored in our private datacenter in Austria
  • We won't give your IP, uploaded images, URLs or analyzation results to anyone