Documentation menu

Getting started

Last updated: 2026-10-22

The NSFW Check API tells you how explicit an image is. It works asynchronously: you submit an image URL and get a task ID back at once, then query the task until its result is ready.

POST /v1/predictions        → 201 Created   status "waiting"
GET  /v1/predictions/{id}   → 200 OK        status "processing"   (query again)
GET  /v1/predictions/{id}   → 200 OK        status "succeeded" + output

Basics

ItemValue
Base URLhttps://api.nsfwcheckapi.com
AuthenticationAuthorization: Bearer YOUR_API_KEY — see Authentication
Request bodyJSON with Content-Type: application/json, at most 64 KiB
ResponsesJSON (UTF-8), each with an X-Request-Id header
TimesISO 8601 strings in UTC, for example 2026-10-22T08:30:00.000Z
Billing1 credit per accepted task; a task that finally fails returns its credit. Queries are free. See Pricing.

Quickstart

1. Create an API key

Sign in and create a key under API keys. New accounts get free starter credits.

2. Submit a task

curl -X POST 'https://api.nsfwcheckapi.com/v1/predictions' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{ "input": { "image": "https://images.example.com/photo.jpg" } }'

The response returns at once with the task id and "status": "waiting".

3. Query the task until it is final

curl 'https://api.nsfwcheckapi.com/v1/predictions/TASK_ID' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Query every 1–2 seconds while status is "waiting" or "processing".

4. Read the result

When status is "succeeded":

  • output.level — the most probable level, L1 (lowest risk) to L4 (most explicit);
  • output.probabilities — the probability of each level;
  • output.is_nsfw — the verdict under your policy.

Every field is described in Image Moderation.

Complete example

Submit a task, poll it until it is final, then read the result.

import time
import uuid

import requests

API = "https://api.nsfwcheckapi.com"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}


def check_image(image_url: str, sensitivity: str = "standard") -> dict:
    # 1. Submit the task. Keep the idempotency key to retry safely.
    response = requests.post(
        f"{API}/v1/predictions",
        headers={**HEADERS, "Idempotency-Key": uuid.uuid4().hex},
        json={"input": {"image": image_url}, "policy": {"sensitivity": sensitivity}},
        timeout=30,
    )
    response.raise_for_status()
    task = response.json()

    # 2. Poll until the task is final.
    while task["status"] in ("waiting", "processing"):
        time.sleep(1)
        response = requests.get(task["urls"]["get"], headers=HEADERS, timeout=30)
        if response.status_code == 429:
            time.sleep(int(response.headers.get("Retry-After", "1")))
            continue
        response.raise_for_status()
        task = response.json()

    # 3. Read the result.
    if task["status"] == "failed":
        raise RuntimeError(task["error"]["code"])
    return task["output"]


print(check_image("https://images.example.com/photo.jpg"))

Next steps