Skip to main content
POST
/
v2
/
router
/
moderations
Create moderation
curl --request POST \
  --url https://api.orq.ai/v2/router/moderations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "input": "<string>",
  "model": "<string>"
}
'
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({input: '<string>', model: '<string>'})
};

fetch('https://api.orq.ai/v2/router/moderations', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
import requests

url = "https://api.orq.ai/v2/router/moderations"

payload = {
    "input": "<string>",
    "model": "<string>"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "id": "<string>",
  "model": "<string>",
  "results": [
    {
      "flagged": true,
      "categories": {
        "hate": true,
        "hate/threatening": true,
        "harassment": true,
        "harassment/threatening": true,
        "illicit": true,
        "illicit/violent": true,
        "self-harm": true,
        "self-harm/intent": true,
        "self-harm/instructions": true,
        "sexual": true,
        "sexual/minors": true,
        "violence": true,
        "violence/graphic": true
      },
      "category_scores": {
        "hate": 123,
        "hate/threatening": 123,
        "harassment": 123,
        "harassment/threatening": 123,
        "illicit": 123,
        "illicit/violent": 123,
        "self-harm": 123,
        "self-harm/intent": 123,
        "self-harm/instructions": 123,
        "sexual": 123,
        "sexual/minors": 123,
        "violence": 123,
        "violence/graphic": 123
      },
      "category_applied_input_types": {
        "hate": [
          "<string>"
        ],
        "hate/threatening": [
          "<string>"
        ],
        "harassment": [
          "<string>"
        ],
        "harassment/threatening": [
          "<string>"
        ],
        "illicit": [
          "<string>"
        ],
        "illicit/violent": [
          "<string>"
        ],
        "self-harm": [
          "<string>"
        ],
        "self-harm/intent": [
          "<string>"
        ],
        "self-harm/instructions": [
          "<string>"
        ],
        "sexual": [
          "<string>"
        ],
        "sexual/minors": [
          "<string>"
        ],
        "violence": [
          "<string>"
        ],
        "violence/graphic": [
          "<string>"
        ]
      }
    }
  ]
}
{
  "error": {
    "message": "<string>",
    "type": "<string>",
    "param": "<string>",
    "code": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Classifies if text violates content policy

input
required

Input (or inputs) to classify. Can be a single string, an array of strings, or an array of multi-modal input objects similar to other models.

model
string
required

The content moderation model you would like to use. Defaults to omni-moderation-latest

Response

Returns moderation classification results

id
string
required

The unique identifier for the moderation request

model
string
required

The model used to generate the moderation results

results
object[]
required

A list of moderation objects