NSFW / Nudity Detection API

Check user-uploaded images for nudity, sexual content, suggestive imagery, violence, drugs, and hate symbols in a single REST call. Moderation labels with confidence scores, as structured JSON.

Published 2026-05-20 · Updated 2026-10-26

A glowing frosted-glass shield in a stream of abstract image tiles: tiles that pass through get a green check badge, and two flagged tiles come out blurred behind violet glass with an eye-slash icon.
Every upload is checked before it is published. The API returns the labels it detects; your policy decides what is approved, reviewed, or blocked.

TL;DR. An NSFW / nudity detection API takes an image and reports the unsafe content it finds. Send the image to Pixicular's image analysis API with the detect-moderation service and you get back moderation labels, such as Explicit Nudity or Suggestive, each with a confidence percentage. Your backend then approves, queues for review, or blocks according to your own policy.

How does NSFW detection work?

The detect-moderation service runs a content-moderation model over the uploaded image and returns each moderation label it detects, with a confidence percentage from 0 to 100. A higher number means the model is more certain the content is present. The API does not return a single "safe" or "unsafe" verdict, because where that line sits depends on your platform, not on the model.

The integration is one HTTPS request: upload the image as multipart form data to POST /v1/detect with detect-moderation in the services field, or send a public URL to /v1/detect-from-url. The result sits under services["detect-moderation"]: a detected boolean and a labels array. Labels are hierarchical. A top-level category such as Suggestive has an empty parentName; a more specific label such as Female Swimwear Or Underwear names its category in parentName, and both appear in the list with their own confidence.

A blurred, hidden image tile linked to a detect-moderation result: detected: true, a top-level label Suggestive with an empty parentName and confidence 90.5, and a child label Female Swimwear Or Underwear with parentName Suggestive and confidence 90.5.
Labels are hierarchical: a top-level category has an empty parentName, each child label names its category, and both carry a confidence percentage.

What categories does the API return?

The moderation taxonomy behind detect-moderation covers the content areas below, and more. The table describes areas, not an exhaustive list of label names: log the labels your own uploads return, write your policy against those names, and decide per area what your platform allows. Many platforms tolerate swimwear but block nudity, or allow medical context but block recreational drug imagery.

Content areaWhat it coversTypical policy use
Nudity and sexual contentExplicit nudity and sexual activity. Top-level labels such as Explicit Nudity, with more specific child labels beneath them.Block on general-audience platforms; restrict to verified adults where it is allowed.
Suggestive contentSwimwear, underwear, and revealing clothing without explicit nudity, for example Female Swimwear Or Underwear under Suggestive. The borderline area.Approve, review, or restrict depending on your audience.
ViolenceWeapons, and graphic violence or injury.Review weapons in context; block graphic violence.
DrugsDrug use and drug paraphernalia.Review; medical or harm-reduction context can be legitimate.
Hate symbolsExtremist and hate symbols.Block, and review the account that uploaded it.

Labels are independent. An image can return Suggestive without any explicit-nudity label, or a violence label on its own, so make decisions per label rather than on one combined score.

How do you use confidence thresholds for auto-block, review, and approve?

Every returned label carries a confidence percentage. Labels the model does not detect are left out of the response, so a result with no labels (detected: false) is the auto-approve path. For the labels that do come back, your policy maps the name and confidence to an action: block high-confidence labels on your block list, and send everything else to human review.

Moderation policy diagram: a detect-moderation result branches into three lanes. detected: false leads to Approve, other labels lead to Review, and a block-list label leads to Block, above a bar reading Your thresholds, your policy.
One way to turn a result into an action. The block list and the confidence thresholds are policy you set, not API settings.

A reasonable starting point for a general-audience platform: block explicit-nudity and sexual-activity labels at 90% confidence or above, review any other label, and approve the rest. Stricter platforms can lower the block threshold or add Suggestive to the block list; more permissive ones can approve swimwear labels outright. Tune each label separately, because 60% on Suggestive is not the same risk as 60% on Explicit Nudity, and track how many uploads land in each bucket so your review queue stays manageable.

How do you call the NSFW detection API?

One multipart POST to /v1/detect with the image in the file field and services set to detect-moderation. The response is a single JSON document with the moderation result under services.

curl

curl -X POST https://api.pixicular.com/v1/detect \
  -H "Authorization: Bearer $PIXICULAR_API_KEY" \
  -F "file=@./user-upload.jpg" \
  -F "services=detect-moderation"

Python (requests)

import os
import requests

API_URL = "https://api.pixicular.com/v1/detect"
API_KEY = os.environ["PIXICULAR_API_KEY"]

# Your policy: label or category names you never allow, and the
# confidence (a percentage) at which to block. Use the names your uploads return.
BLOCK_LIST = {"Explicit Nudity"}
BLOCK_AT = 90.0

with open("user-upload.jpg", "rb") as image_file:
    response = requests.post(
        API_URL,
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"file": image_file},
        data={"services": "detect-moderation"},
        timeout=60,
    )

if response.status_code == 202:
    # Queued under load: poll response.json()["statusUrl"] (see the docs).
    decision = "pending"
else:
    response.raise_for_status()
    moderation = response.json()["services"]["detect-moderation"]

    if not moderation["detected"]:
        decision = "approve"
    elif any(
        (label["name"] in BLOCK_LIST or label["parentName"] in BLOCK_LIST)
        and label["confidence"] >= BLOCK_AT
        for label in moderation["labels"]
    ):
        decision = "block"
    else:
        decision = "review"

print(decision)

Example response

{
  "success": true,
  "requestId": "req_Qm7Tz2LkV9pXcR4aWe",
  "services": {
    "detect-moderation": {
      "detected": true,
      "labels": [
        { "name": "Suggestive", "parentName": "", "confidence": 90.5 },
        {
          "name": "Female Swimwear Or Underwear",
          "parentName": "Suggestive",
          "confidence": 90.5
        }
      ]
    }
  },
  "photo": { "id": "photo_Hn3vB8sYq1KdWm6tZc", "status": "COMPLETED" },
  "creditCost": 1,
  "processingTimeMs": 1250,
  "processedAt": "2026-10-26T09:30:00.000Z"
}

This is the swimwear case: a top-level Suggestive label and its child label. Each service on each image is one operation (creditCost). Normally the result comes back with 200; under load the API can answer 202 with a statusUrl to poll, which is not an error. For authentication, error codes, and rate limits, see the Pixicular API documentation.

Which image formats and sizes are supported?

The API accepts JPEG, PNG, WebP, AVIF, and TIFF images up to 10 MB per image and between 100×100 and 4096×4096 pixels, uploaded as multipart form data or fetched from a public URL. The rate limit is 60 detection requests per minute per API key.

FormatNotes
JPEG (.jpg, .jpeg)The usual format for camera and phone photos.
PNG (.png)Supported. Files are larger, so screenshots and graphics reach the 10 MB limit sooner.
WebP (.webp)Supported. Smaller than JPEG at similar quality; common for browser uploads.
AVIF (.avif)Supported. A compact modern format.
TIFF (.tif, .tiff)Supported. Often very large; check the 10 MB limit before uploading.

Other formats, such as GIF, HEIC, and BMP, are rejected, so convert them before upload (iPhone HEIC photos to JPEG, for example). The service analyses still images; video is not supported. Very small or heavily compressed images give the model less to work with, so send the largest version you have within the limits.

How accurate is automated nudity detection, and what about false positives?

Automated detection can clear routine uploads and catch obvious violations without a reviewer, but it is not perfect. Pixicular does not publish an accuracy figure for moderation, so validate it on a sample of your own uploads before you set thresholds. Common false positives include swimwear, breastfeeding photos, classical art, and medical imagery, all of which can trigger nudity or suggestive labels while being legitimate on many platforms. Common false negatives include heavily occluded content, unusual camera angles, low-resolution uploads, and crops designed to evade detection.

Treat the API as a triage layer, not a final adjudicator. Approving uploads with no labels takes the routine volume out of your review queue, blocking high-confidence block-list labels keeps obvious violations off the platform, and everything in between goes to reviewers who see the labels next to the image.

Responsible use: automated triage, not human judgement

An NSFW detection API is a triage tool. It matches pixels against what its model learned; it does not understand consent, context, intent, or jurisdiction. A beach photo and an explicit image can both return nudity-related labels, and a hunting photo and a threat can both return a weapons label. The labels are signals, not verdicts.

For high-impact decisions (bans, account termination, legal takedowns, anything that may involve minors) route the case to a trained human reviewer. Store the labels next to the review decision so your team has an audit trail for appeals and for duties under laws such as the EU Digital Services Act and the UK Online Safety Act. This API is not a CSAM-detection tool and must never be the only control for that risk: use dedicated hash-matching services and work with a specialist body such as NCMEC in the US, the IWF in the UK, or your national hotline.

Related Pixicular services

NSFW detection is one service inside a broader image analysis API. Most moderation pipelines request it together with other services on the same upload, for example detect-age on platforms with age-restricted content, or detect-labels for prohibited-goods screening. Each service is billed as one operation per image. See the guides for image moderation for dating apps and UGC image moderation for social platforms for end-to-end pipelines that combine moderation with the rest of the API.

Note: Pixicular's AI-generated image detection service is currently disabled while accuracy is being improved and is returning soon. The NSFW / nudity detection described on this page is a separate, live service and does not depend on AI-generation detection.

Frequently asked questions

How does an NSFW detection API score an image?

POST the image to https://api.pixicular.com/v1/detect with services=detect-moderation. The response lists every moderation label the model detected, each with a name, a parentName (the category it belongs to, empty for a top-level category) and a confidence percentage from 0 to 100. detected is true when at least one label is found; a clean image returns detected: false and an empty labels list. Your code maps the labels to approve, review, or block.

What false-positive rate should I expect from an NSFW detection API?

It depends on your thresholds and your traffic. Pixicular does not publish a false-positive rate for moderation, so measure it on a sample of your own uploads. Blocking only high-confidence labels from a short block list keeps false blocks rare; sending every other label to review catches more borderline content at the cost of reviewer time. Swimwear, breastfeeding photos, classical art, and medical imagery are common false positives for nudity-related labels.

Does the API return a score for every category?

No. The labels list contains only what the model detected; categories it did not find are left out rather than returned with a low score. Low-confidence detections may be left out, so a missing label means not detected, and a result with detected: false is the natural auto-approve path. Build your policy on the label names and confidences that do come back.

Are images sent to the moderation API stored?

Per the Pixicular privacy policy, uploaded images are retained for 30 days after analysis (or as configured by the user) and detection results for the life of the account plus 90 days, and data may be processed outside the UK, including in the US and the EU. On your side, keep only what your moderation and appeals process needs, such as the decision and the labels that triggered it. This is general information, not legal advice.

What happens when the API cannot analyse an image?

You get an explicit error instead of an empty result: 400 for a missing file or services field or an unsupported file type, 422 when /v1/detect-from-url cannot download the image, and 500 with a code such as INVALID_IMAGE or PROVIDER_TIMEOUT when the analysis fails. Failed requests cost no credits. A 202 is not an error: the request was queued, so poll its statusUrl. Never treat a missing result as a pass; hold the upload or send it to review.

Add NSFW detection to your upload pipeline

The fastest way to evaluate Pixicular's NSFW detection is to point a curl request at it with a real user upload from your platform. Pick a plan on the pricing page and follow the API documentation for authentication, error codes, and the full response schema for detect-moderation.