> ## Documentation Index
> Fetch the complete documentation index at: https://developers.meshapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Classify content against the content policy

> Check text or images against the content policy before you act on them.

OpenAI-compatible: `input` accepts a string, a batch of strings, or multimodal parts
with image URLs. Each result reports `flagged` plus per-category booleans and scores,
so you can set your own threshold rather than only trusting the flag.

Images must be PNG, JPEG, GIF or WebP; anything else is rejected up front rather
than failing upstream.

Moderation is deliberately **not** gated by per-model allow-lists or usage caps — it
is a safety primitive, and making it refusable would push callers toward skipping the
check. Your key's rate limits still apply.



## OpenAPI

````yaml /api/openapi.json post /v1/moderations
openapi: 3.1.0
info:
  title: MeshAPI
  description: One key, all AI models.
  version: 0.1.0
servers:
  - url: https://api.meshapi.ai
security:
  - BearerAuth: []
paths:
  /v1/moderations:
    post:
      tags:
        - Moderations
      summary: Classify content against the content policy
      description: >-
        Check text or images against the content policy before you act on them.


        OpenAI-compatible: `input` accepts a string, a batch of strings, or
        multimodal parts

        with image URLs. Each result reports `flagged` plus per-category
        booleans and scores,

        so you can set your own threshold rather than only trusting the flag.


        Images must be PNG, JPEG, GIF or WebP; anything else is rejected up
        front rather

        than failing upstream.


        Moderation is deliberately **not** gated by per-model allow-lists or
        usage caps — it

        is a safety primitive, and making it refusable would push callers toward
        skipping the

        check. Your key's rate limits still apply.
      operationId: create_moderation
      parameters:
        - in: header
          name: X-Mesh-Version
          required: false
          schema:
            type: string
            enum:
              - 2026-08
            default: 2026-08
          example: 2026-08
          description: >-
            Dated version of the API contract to pin this request to. Omit it
            and the request is served under `2026-08` — the oldest supported
            version, so an existing integration is never moved by a release. A
            malformed or unsupported value is rejected with `400
            invalid_api_version` rather than falling back silently. The version
            actually served is echoed as `X-Mesh-Version` on every response,
            including errors.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModerationRequest'
            examples:
              default:
                summary: Example request
                value:
                  model: omni-moderation-latest
                  input: I want to build a harmless science project.
      responses:
        '200':
          description: Moderation result(s).
          content:
            application/json:
              schema: {}
              example:
                id: modr-0123
                model: omni-moderation-latest
                results:
                  - flagged: true
                    categories:
                      sexual: true
                      violence: false
                    category_scores:
                      sexual: 0.97
                      violence: 0.0007
        '401':
          description: Missing or invalid API key
        '403':
          description: API key is suspended
        '422':
          description: Request validation failed
        '429':
          description: Rate limit exceeded (RPM or RPD)
        '500':
          description: Upstream provider error or gateway timeout
        '503':
          description: OpenAI credentials not configured on this server
      security:
        - BearerAuth: []
components:
  schemas:
    ModerationRequest:
      properties:
        input:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
            - items:
                $ref: '#/components/schemas/ModerationInputItem'
              type: array
          title: Input
          description: Text, list of texts, or list of multimodal (text/image_url) items.
        model:
          type: string
          title: Model
          description: Moderation model to use. Defaults to omni-moderation-latest.
          default: omni-moderation-latest
      type: object
      required:
        - input
      title: ModerationRequest
      description: Request body for ``POST /v1/moderations`` (OpenAI-compatible).
      example:
        input:
          - image_url:
              url: data:image/png;base64,iVBORw0KGgo...
            type: image_url
        model: omni-moderation-latest
    ModerationInputItem:
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
          title: Type
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        image_url:
          anyOf:
            - $ref: '#/components/schemas/ModerationImageUrl'
            - type: 'null'
      type: object
      required:
        - type
      title: ModerationInputItem
      description: A single multimodal moderation input object (OpenAI format).
    ModerationImageUrl:
      properties:
        url:
          type: string
          title: Url
          description: Image URL or base64 data URL (data:image/{fmt};base64,{b64}).
      type: object
      required:
        - url
      title: ModerationImageUrl
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter your MeshAPI key (`rsk_...`) — sent as `Authorization: Bearer
        <key>`.

````