Content moderation API
A web service that checks content you send, such as a comment or a photo, and answers with the categories it found and how confident it is.
A content moderation API is a web service that checks content you send it, such as a comment or a photo, and answers with the categories it found, like hate speech or sexual content, and how confident it is. Your app then decides what to do: publish, hold for review or block. It supports people instead of making them read every post.
What you send
One HTTPS request per item, from your server. With Detectivision that is POST https://api.detectivision.ai/api/v1/moderation, with your key in the Api-Key header. Never ship the key in a web page or an app, where anyone could read it.
| Field | What it holds |
|---|---|
type | text_moderation or image_moderation. Video, audio and live streams are coming soon. |
input | The text itself, 1 to 10,000 characters, or an image's URL: JPEG, PNG, WebP, BMP or GIF, up to 10 MB. |
flags | Optional: the categories to look for, from GET /api/v1/flags. Leave it out to check every flag your account has for the type. |
mode | detect: the flags raised and their confidence. |
async | Optional: true to get the result later by webhook, at half the price of an answer given at once. |
metadata | Optional: your own JSON, up to 16 KB, such as the comment's id. It comes back unchanged. |
What the flags cover is on text moderation and on detection pages such as NSFW detection.
What comes back
Here a review comment is checked for three flags, with its id attached.
Example response (format from the API reference; values illustrative):
curl https://api.detectivision.ai/api/v1/moderation \
-H "Api-Key: $DETECTIVISION_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "text_moderation",
"input": "Terrible seller. You are an idiot.",
"mode": "detect",
"flags": ["hate", "insult", "self_harm"],
"metadata": { "commentId": "c_981" }
}'{
"id": 1050,
"type": "text_moderation",
"mode": "detect",
"status": "completed",
"flagged": true,
"flags": [{ "flag": "insult", "confidence": 0.92 }],
"checked": ["hate", "insult", "self_harm"],
"unchecked": [],
"tookMs": 640,
"usage": { "charged": 2, "remaining": 8417 },
"metadata": { "commentId": "c_981" }
}Field by field, as the responses reference defines them:
| Field | What it says | What to do with it |
|---|---|---|
id | The request's number | Read it again with GET /api/v1/moderation/{id}; quote it to support |
status | completed, or partial when some flags could not be checked | Check it before treating a result without flags as clean |
flagged | true when at least one flag was raised | Your first verdict |
flags | Each raised flag with its confidence, 0 to 1 | Decide per flag |
checked | Every flag that was looked for | A flag here but not in flags was looked for and not found |
unchecked | Flags that could not be looked for | Treat them as unknown; a partial result is free |
tookMs | How long the check took, in milliseconds | Your own monitoring; the value above is not a measurement |
usage | charged: what this check cost; remaining: credits left for the type | Alert yourself before a balance runs out |
metadata | Your JSON, unchanged | Match the result to the comment |
Detectivision's flags judge the whole text or image: a result says what was found, not where.
How the decision is made
AI content moderation combines three kinds of judgement, in proportions that differ by vendor and category:
- Classifiers: models trained on labelled examples that score each category.
- Language models asked to judge: a general model reads the content against a written rule, such as "is this a personal attack?", and returns a score or a label.
- Rules and lists: word lists, patterns, and fingerprint lists of known illegal files.
Inside one Detectivision check:
- The API reads the request and the flags to check.
- Each model that feeds one of those flags scores what it finds. Models that feed none of them are not run.
- A flag is raised when its score passes the flag's threshold, 0.5 by default. Findings below it are dropped and never come back.
- The answer lists the raised flags, every flag checked, and any that could not be.
- Your code applies your rules: block, hold for review or publish.
A confidence is a score, not a probability you can compare across flags: 0.8 for hate and 0.8 for insult do not mean the same. Act above your own line, per flag (flags). Software is consistent at volume but can miss context such as sarcasm, quotes and new slang, which is why unclear cases go to people.
What it does not do
- It does not write your policy. You decide which flags block, which go to review and which you ignore.
- It does not act on your platform. Detectivision never removes a post or bans a user; your system does, when a result or a
moderation.actionwebhook arrives (actions). - It does not verify age. Finding out how old a user is, called age assurance, is a separate job; see age assurance.
- It does not say where. No word positions, boxes or censored copies come back.
- It does not read every language. Text results are reliable in English, Spanish, Portuguese, French, German, Italian, Turkish, Arabic, Russian and Hindi only (text).
- It does not check video, audio or live streams yet. They are coming soon.
How moderation APIs charge
Vendors price in different units: per request or per 1,000 requests, per image, per block of characters, or in credits that come with a monthly plan. Some offer free tiers with limits: free content moderation APIs compares them with dated facts.
Detectivision charges credits per type. Text costs one credit per started 2,500 characters async, images are priced per image, and an answer given at once costs twice the async price. Errors and partial results are free (credits). Plans and the free trial are on pricing.
Choosing one
Compare APIs on your own content, against these points:
- Types today: which of your content types it checks now, by its status page, not its roadmap.
- Languages: results on text your users write, including slang and text typed without accents.
- Categories: whether its flags match your rules, and whether you can check only some.
- Results: separate flags or one score; what a partial or failed check looks like.
- Timing and price: the price at once and async, and what is free.
- Delivery: signed webhooks with retries, and a field for your own ids.
- Data: what it keeps, for how long, and where it is processed.
For vendors side by side, see content moderation APIs compared; for the ways to use one, see types of content moderation.
Or read the quickstart first.
Frequently asked
Is a content moderation API the same as a word filter?
No. A word filter blocks text that contains a word from its list. It is fast and free to run, but it also blocks harmless words that contain a listed one, and it misses misspellings and insults that use no listed word. A moderation API checks the text or image against categories and returns a confidence for each category it finds. You can run both: a short list for terms you always block, and an API for everything else.
Can I call a moderation API from a browser or a mobile app?
Not directly. The request carries your API key, and anyone can read a key shipped in a web page or an app and spend your credits. Send the content to your own server and call the API from there. Detectivision also refuses cross-origin requests from browsers.
What is the difference between a moderation API and a moderation service?
A moderation service usually means people: an outsourced team that reviews your content against your rules. A moderation API is software: your server sends content, gets categories and confidence back as JSON, and your code acts on them. Detectivision is an API. Its dashboard gives your own moderators Logs, actions and webhooks, but it supplies no reviewers.
Who decides what is allowed, the API or my platform?
Your platform. The API reports what it found and how confident it is. Your written rules turn that into publish, hold or block, per flag and per place in your product, and your moderators decide the unclear cases. The same flag can mean block in a space for children and allow in an adult forum.
Six ways to moderate user content, from checking before anything is posted to acting on reports: how each works, what it costs in delay, and when it fits.
Get started with the Detectivision content moderation API: create an API key, run your first image moderation check and read its result in minutes.
Every field of a Detectivision moderation result explained, the same object for every type: flags, confidence, status, usage and your metadata.
Rekognition, Azure, Google Cloud, Hive, OpenAI, Sightengine, WebPurify and Detectivision side by side: what each checks, languages, and published prices.
What each check costs, whose credits it uses, and when nothing is charged.