> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://uploadcare.com/docs/_mcp/server.

# Unsafe content moderation

> Detect and identify NSFW or offensive user-generated content in order to ensure brand integrity, and comply with local and global regulations.

Uploadcare provides a content moderation feature that detects and identifies unwanted
or offensive images right on upload, preventing inappropriate content from being published.

This feature applies only to images and can operate in two modes:
automatically via the Dashboard and through the REST API.

## Automatically via Dashboard

To automatically scan all uploaded images, enable the **Scan images on upload** toggle
in the [Image moderation](https://app.uploadcare.com/projects/-/settings/) section of the Dashboard.

You can define what happens to images containing unsafe content by selecting an **Action**
— either automatically deleting flagged files or allowing them to be uploaded
(in which case, information about the detected unsafe content will be added to the file's `appdata`).
See the [example](#example) below for details on how to check the `appdata`.

You can fine-tune moderation by selecting content **categories** to check for.
For each category, set a threshold value: a percentage that defines the confidence
level above which a file will be automatically deleted.

## Using REST API

For a custom solution, integrate Uploadcare's [REST API add-on](https://uploadcare.com/docs/api/rest/add-ons/aws-rekognition-execute),
which detects and flags inappropriate content for further review.

Unsafe content moderation add-on works asynchronously:

1. Start a processing job via REST API. Send an input file UUID with
   the necessary processing operations.
2. Wait until the processing job status becomes `done`.
3. Detected moderation labels will be stored in the JSON response in the
   `appdata` section of the processed file.

### Example \[#example]

Execute unsafe content detection on a target UUID:

```bash
curl -L "https://api.uploadcare.com/addons/aws_rekognition_detect_moderation_labels/execute/" \
     -X POST \
     -H "Content-Type: application/json" \
     -H "Accept: application/vnd.uploadcare-v0.7+json" \
     -H "Authorization: Uploadcare.Simple $YOUR_PUBLIC_KEY:$YOUR_SECRET_KEY" \
     -d "{\"target\": \"$UUID\"}"
```

Check out [REST API reference](https://uploadcare.com/docs/api/rest/add-ons/aws-rekognition-detect-moderation-labels-execute)
to see how to execute an add-on on a target UUID.

To get the job result, you need to enable `file.info_updated` in the
[Webhook section](/docs/webhooks/#webhook-notifications) of the dashboard.

After completing the processing job, the webhook will be sent to
the endpoint you specified in the webhook settings.

File information in response:

```json
 "initiator": {
    "type": "addon",
    "detail": {
      "addon_name": "aws_rekognition_detect_moderation_labels",
    }
  },
  "hook": {
    ...
    "event": "file.info_updated",
    "is_active": true,
    "version": "0.7",
    ...
  },
    "uuid": ":UUID",
    "is_image": true,
    "is_ready": true,
    "metadata": {},
    "appdata": {
      "aws_rekognition_detect_moderation_labels": {
        "data": {
          "ModerationLabels": [
            {
              "Confidence": 99.87886810302734,
              "Name": "Weapons",
              "ParentName": "Violence"
            },
            {
              "Confidence": 99.87886810302734,
              "Name": "Violence",
              "ParentName": ""
            }
          ],
          "ModerationModelVersion": "6.1"
        },
        "version": "2016-06-27",
        "datetime_created": "2023-11-08T09:35:08.907Z",
        "datetime_updated": "2023-11-08T09:35:08.907Z"
      },
    }
```

If your application does not have a backend or uses a mobile version,
you can submit the request yourself to check the execution status.

Use the request ID returned by the add-on execution request described above:

```bash
curl -L "https://api.uploadcare.com/addons/aws_rekognition_detect_moderation_labels/execute/status/?request_id=$REQUEST_ID" \
     -X GET \
     -H "Content-Type: application/json" \
     -H "Accept: application/vnd.uploadcare-v0.7+json" \
     -H "Authorization: Uploadcare.Simple $YOUR_PUBLIC_KEY:$YOUR_SECRET_KEY"
```

As a request result, you will receive a UUID of the file when the status is done.

```json
{
  "result": {
    "file_id": "22240276-2f06-41f8-9411-755c8ce926ed"
  },
  "status": "done"
}
```

Check out the [execution status](https://uploadcare.com/docs/api/rest/add-ons/aws-rekognition-detect-moderation-labels-execution-status).

Once the status changes to `done`, `appdata` will contain the result of the execution.

To get it, run file info request, specifying the `include` parameter.
There are two methods for getting info on detected objects via GET requests
for [single-file](/docs/api/rest/file/info) and [multi-file](/docs/api/rest/file/files-list) cases:

```bash
curl -L "https://api.uploadcare.com/files/?include=appdata" \
     -H "Accept: application/vnd.uploadcare-v0.7+json" \
     -H "Authorization: Uploadcare.Simple $YOUR_PUBLIC_KEY:$YOUR_SECRET_KEY"
```

or

```bash
curl -L "https://api.uploadcare.com/files/$UUID/?include=appdata" \
     -H "Accept: application/vnd.uploadcare-v0.7+json" \
     -H "Authorization: Uploadcare.Simple $YOUR_PUBLIC_KEY:$YOUR_SECRET_KEY"
```

You'll get JSON with `appdata`:

```json
"appdata": {
  "aws_rekognition_detect_moderation_labels": {
    "data": {
      "ModerationModelVersion": "6.0",
      "ModerationLabels": [
        {
          "Confidence": 93.41645812988281,
          "Name": "Weapons",
          "ParentName": "Violence"
        }
      ]
    },
    "version": "2016-06-27",
    "datetime_created": "2023-02-21T11:25:31.259763Z",
    "datetime_updated": "2023-02-21T11:27:33.359763Z"
  },
}
```

## Billing

* This feature is available on Trial and [paid plans](https://uploadcare.com/pricing/).
* Learn how we [charge](/docs/billing/#file-management) for this operation.