apyhub
ARTIFICIAL INTELLIGENCE · SECURITY & PRIVACY

Detect Text Toxicity API

What it does

Toxicity Detector classifies a short text input as toxic or non-toxic. Send a body.text string up to 512 characters, and the response returns the original text, a label, a score, and a boolean toxic flag.

Use it when you need to screen user-generated content before it reaches a public surface. For example, you can check forum posts, comments, chat messages, support tickets, or profile bios and route flagged text to moderation or human review.

The API is intentionally small: one text field in, one classification result out. That makes it easy to add content moderation checks in a webhook, background job, or form submission flow without building and maintaining your own classifier.

Because the response includes both a boolean verdict and a numeric score, you can apply your own thresholding or escalation logic depending on how strict your moderation rules need to be.

POST
Detect whether text is toxic or harmful
http://localhost:8080/dosvak/detect-toxicity
QUICKSTARTGUIDE

Quickstart

Send a piece of text to check whether it is toxic.

curl -X POST "http://localhost:8080/dosvak/detect-toxicity" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"This is a sample sentence to analyze."}'

What you'll get back

Returns a JSON object with text as a string, label as a string, score as a number, and toxic as a boolean.

{
  "text": "This is a sample sentence to analyze.",
  "label": "non-toxic",
  "score": 0.98,
  "toxic": false
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Input text (truncated to 512 tokens)

About this endpoint

What it does

Detects whether the submitted text is toxic or harmful and returns a JSON object with the analyzed text, a label, a score, and a toxic boolean.

Request Body

ParameterTypeMandatoryDescription
textStringYesInput text to analyze. Maximum length: 512 characters. The schema description says it is truncated to 512 tokens.

Response

Returns a JSON object with four top-level fields: text as a string, label as a string, score as a number, and toxic as a boolean. Use toxic to determine whether the input was classified as toxic or harmful.

ParameterTypeMandatoryDescription
textStringNoThe text that was analyzed.
labelStringNoThe classification label returned by the service.
scoreNumberNoThe confidence or score returned by the service.
toxicBooleanNoWhether the text is classified as toxic or harmful.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.