NSFW Text Detection

Detect sexually explicit language, hate speech, harassment, self-harm, and other harmful categories in user-generated text.

POST /nsfw-text/detect

Authentication

Bearer token in the Authorization header.

Request

Content-Type: application/json
FieldTypeRequiredDescription
textstringRequiredThe text to classify. Long text is automatically chunked.

Response

FieldTypeDescription
scorenumberOverall NSFW probability (0.0 – 1.0).
is_nsfwbooleanWhether the text is classified as NSFW.
categoriesobjectPer-category scores, e.g. {"sexual": 0.01, "hate": 0.02, "violence": 0.0, "harassment": 0.0, "self_harm": 0.0}.
verdictstringHuman-readable verdict summarising the result.

Example

Request

curl -X POST https://api.cacuda.com/nsfw-text/detect \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, how are you today?"}'

Response 200 OK

{
  "score": 0.01,
  "is_nsfw": false,
  "categories": {
    "sexual": 0.01,
    "hate": 0,
    "violence": 0,
    "harassment": 0,
    "self_harm": 0
  },
  "verdict": "safe"
}

Error Codes

CodeDescription
400Missing or empty text field.
401Missing or invalid API key.
402Insufficient credits.
503Detection service unavailable.

Notes

Text longer than ~450 tokens is automatically split into chunks. Each chunk consumes one credit.

Category keys may vary by model ensemble version.

Try it in the scanner

Test this endpoint interactively with real data. No code required.

Open Scanner