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

# Create Moderation

> Classifies whether text or multi-modal input is potentially harmful across categories.



## OpenAPI

````yaml /gateway-openapi.json post /moderations
openapi: 3.0.0
info:
  title: LLM Gateway
  description: API for LLM Gateway
  version: 1.0.0
servers:
  - url: https://{gatewayBaseURL}
    variables:
      gatewayBaseURL:
        default: gateway.truefoundry.ai
        description: Gateway base URL
    description: Gateway base URL
security:
  - AuthorizationBearer: []
tags:
  - name: Chat
  - name: Agent
  - name: Messages
  - name: MCP
  - name: Embeddings
  - name: Rerank
  - name: Responses
  - name: Image
  - name: Audio
  - name: Batch
  - name: Files
  - name: Fine-tuning
  - name: Moderations
  - name: Models
paths:
  /moderations:
    post:
      tags:
        - Moderations
      summary: Create Moderation
      description: >-
        Classifies whether text or multi-modal input is potentially harmful
        across categories.
      parameters:
        - schema:
            type: string
            description: Optional metadata for the request
          required: false
          name: x-tfy-metadata
          in: header
      requestBody:
        description: Text or multi-modal input to classify.
        content:
          application/json:
            schema:
              type: object
              properties:
                input:
                  anyOf:
                    - type: string
                    - type: array
                      items:
                        type: string
                    - type: array
                      items: {}
                  description: >-
                    Input (or inputs) to classify. Can be a string, array of
                    strings, or array of multi-modal inputs
                model:
                  type: string
                  nullable: true
                  description: Model to use for moderation
              required:
                - input
      responses:
        '200':
          description: Moderation result with per-category flags and scores.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique moderation ID
                  model:
                    type: string
                    description: Model used for moderation
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        flagged:
                          type: boolean
                          description: True if content violates policies
                        categories:
                          type: object
                          properties:
                            hate:
                              type: boolean
                              description: Contains hate speech
                            hate/threatening:
                              type: boolean
                              description: Contains threatening hate speech
                            harassment:
                              type: boolean
                              description: Contains harassment
                            harassment/threatening:
                              type: boolean
                              description: Contains threatening harassment
                            self-harm:
                              type: boolean
                              description: Contains self-harm content
                            self-harm/intent:
                              type: boolean
                              description: Expresses intent of self-harm
                            self-harm/instructions:
                              type: boolean
                              description: Contains self-harm instructions
                            sexual:
                              type: boolean
                              description: Contains sexual content
                            sexual/minors:
                              type: boolean
                              description: Contains sexual content with minors
                            violence:
                              type: boolean
                              description: Contains violent content
                            violence/graphic:
                              type: boolean
                              description: Contains graphic violence
                          required:
                            - hate
                            - hate/threatening
                            - harassment
                            - harassment/threatening
                            - self-harm
                            - self-harm/intent
                            - self-harm/instructions
                            - sexual
                            - sexual/minors
                            - violence
                            - violence/graphic
                          description: Binary flags for content violations
                        category_scores:
                          type: object
                          properties:
                            hate:
                              type: number
                              description: Hate score
                            hate/threatening:
                              type: number
                              description: Threatening hate score
                            harassment:
                              type: number
                              description: Harassment score
                            harassment/threatening:
                              type: number
                              description: Threatening harassment score
                            self-harm:
                              type: number
                              description: Self-harm score
                            self-harm/intent:
                              type: number
                              description: Self-harm intent score
                            self-harm/instructions:
                              type: number
                              description: Self-harm instructions score
                            sexual:
                              type: number
                              description: Sexual content score
                            sexual/minors:
                              type: number
                              description: Sexual content with minors score
                            violence:
                              type: number
                              description: Violence score
                            violence/graphic:
                              type: number
                              description: Graphic violence score
                          required:
                            - hate
                            - hate/threatening
                            - harassment
                            - harassment/threatening
                            - self-harm
                            - self-harm/intent
                            - self-harm/instructions
                            - sexual
                            - sexual/minors
                            - violence
                            - violence/graphic
                          description: Confidence scores for each category
                      required:
                        - flagged
                        - categories
                        - category_scores
                    description: Moderation results per input
                required:
                  - id
                  - model
                  - results
        '400':
          description: Bad Request
components:
  securitySchemes:
    AuthorizationBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````