Docs

Quickstart Guide

Get up and running with NSFWGuard in under 5 minutes. This guide walks you through generating an API key, making your first request, and interpreting the results.

Step 1: Get Your API Key

Navigate to your API Keys dashboard and click "Generate New Key". Your key will only be shown once — store it securely

Step 2: Make Your First Request

curl -X POST https://api.nsfw-protect.com/classify \  -H "X-API-Key: YOUR_API_KEY" \  -F "[email protected]"

Step 3: Read the Response

The classification comes back directly in the response — one request, one result. The JSON body is identical whichever client you use; each label gets a score between 0 and 1:

{  "status": "done",  "result": [    { "label": "nsfw", "score": 0.998 },    { "label": "sfw", "score": 0.002 }  ]}

Pro Tip

Treat an image as NSFW when the nsfw label's score exceeds 0.5 — that's the same threshold our own dashboard uses.

Handling busy responses

In rare cases (heavy load), the API answers 202 with { "status": "pending" } instead of a result. You are not charged for that request — simply retry the same upload after a short delay. Note that a 202 passes checks like response.ok, so check for status === "done" before reading the result.