---
title: "POST /v1/moderations"
method: POST
path: "/v1/moderations"
---

# POST /v1/moderations

`POST /v1/moderations`

Classify text, image, or mixed content for safety

## Request body

- ModerationRequest
  - `model` string — Moderation model ID. Omit to use the default moderation model.
  - `input` union, required — Content to classify
    - string — Single text string to classify
    - union[] — Array of text strings or content parts to classify. Batch support and supported modalities depend on the selected model.
      - union
        - string
        - ModerationTextContentPart
          - `type` 'text', required — Text content part
          - `text` string, required — Text to classify
        - ModerationImageContentPart
          - `type` 'image_url', required — Image URL content part
          - `image_url` object, required
            - `url` string, uri, required — Public image URL to classify

## Response `200`

Moderation classification response

- ModerationResponse
  - `id` string, required — Moderation request identifier
  - `model` string, required — Moderation model used for classification
  - `results` object[], required — Moderation results for each classified input
    - `flagged` boolean, required — Whether the selected model classified the content as unsafe
    - `categories` object, required — Model-dependent category-level boolean results
    - `category_scores` object — Model-dependent category-level confidence scores when available
  - `usage` object — Token usage used for billing and diagnostics
    - `prompt_tokens` integer — Input tokens billed or recorded
    - `completion_tokens` integer — Output tokens billed or recorded, when applicable
    - `total_tokens` integer — Total tokens billed or recorded

## Other responses

- `400` — Bad Request - Missing input, unsupported modality, unsupported batch input, or context length exceeded
- `401` — Unauthorized - Invalid or missing API key
- `402` — Payment Required - Insufficient balance
- `403` — Forbidden - Paid API features are disabled for the account
- `404` — Model not found
- `429` — Rate limit exceeded
- `503` — Upstream moderation service unavailable or returned an invalid response

---

[API](https://skmtc.dev/nano-gpt/apis/nanogpt-api.md) · [All operations](https://skmtc.dev/nano-gpt/apis/nanogpt-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nano-gpt/nanogpt-api/revisions/584e96d146b0/schema)
