Guide · Published · Updated

How to detect and remove explicit images automatically.

Check every image when it is uploaded, before anyone sees it: send its address to an image moderation API, and block, blur or hold it when the sexual flag comes back. Then check the images already on your site the same way. Detectivision does not keep the images it checks. It judges each image as a whole, so your app blurs or hides all of it.

How it works
  1. Check on upload

    When a user uploads an image, send its address with the sexual flag, and add violence, hate or scam if your rules cover them.

  2. Decide by confidence

    The flag comes with its confidence, 0 to 1. Block above one line, hold what falls between for a moderator, publish the rest.

  3. Blur instead of deleting

    Keep the image and show it blurred in your app until a moderator decides. The flag judges the whole image, so blur all of it.

  4. Send the images already on your site with "async": true, at half the price; each result comes by webhook. Up to 50 checks can wait at once per account; send more as results come in.

  5. Moderators take your own actions, such as Approve or Remove, from the dashboard’s Logs; your system gets each one by webhook.

When it is flagged

Four ways to handle an explicit image

ChoiceWhat happensFits
BlockThe upload is refused.Sites where explicit images are never allowed.
BlurYour app shows the image blurred in its place.Feeds and previews that should stay safe to scroll.
HoldThe image waits for a moderator.Confidences between your two lines.
Allow behind a warningThe image is shown after a click.Adult sites and art communities.
In code

Check an upload for sexual content

Request
curl https://api.detectivision.ai/api/v1/moderation \
  -H "Api-Key: $DETECTIVISION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "image_moderation",
    "input": "https://example.com/uploads/4410.jpg",
    "mode": "detect",
    "flags": ["sexual"],
    "metadata": { "uploadId": 4410 }
  }'
Response
{
  "id": 1043,
  "type": "image_moderation",
  "mode": "detect",
  "status": "completed",
  "flagged": true,
  "flags": [{ "flag": "sexual", "confidence": 0.94 }],
  "checked": ["sexual"],
  "unchecked": [],
  "tookMs": 1150,
  "usage": { "charged": 2, "remaining": 9998 },
  "metadata": { "uploadId": 4410 }
}

metadata comes back unchanged, so you know which upload the answer is about. An image costs 1 credit by webhook and 2 for an answer given at once.

Questions

Frequently asked

Which images can be checked?

JPEG, PNG, WebP, BMP and GIF, up to 10 MB, at an http or https address anyone can open. Signed links work while they are valid.

Are the images stored?

No. An image is downloaded, checked and not kept.

What does a check cost?

An image is 1 credit when the answer comes by webhook and 2 when it comes at once (the default). Errors and partial results cost nothing.

Can I keep the image and only hide the explicit part?

The answer says which flags the image raised, not where. Every flag judges the whole image, so the answer has no boxes and no censored copy comes back. Your app can blur the whole image, or hold it for a moderator.

Does Detectivision delete images from my site?

A moderator can open a check in the dashboard’s Logs and see its flags, your metadata and your actions. You define those actions, such as Approve or Ban; when a moderator takes one, your system gets a moderation.action webhook and carries it out. Detectivision never acts on your platform itself.

What about videos?

Videos go to the same endpoint with the type video_moderation: Detectivision samples frames at the rate you choose and answers with the flags it raised, and when and where each finding is.

Related
Related articles