- Get started
- Introduction
- Authentication
- Making requests
- Streaming
- Audio
- Batch
- Models
- Invites
- Chat
- Users
- Projects
- Project users
- Project service accounts
- Project API keys
- Audit logs
- Usage
- Project rate limits
- Completions
- Uploads
- Embeddings
- Files
- Moderations
- Assistants (v1)
- Threads (v1)
- Messages (v1)
- Runs (v1)
- Images
- Fine-tuning
Create moderation
POST
https://api.openai.com/v1/moderations
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Header Params
Authorization
stringÂ
optional
Example:
Bearer {{YOUR_API_KEY}}
Body Params application/json
input
stringÂ
required
model
stringÂ
required
text-moderation-stable
 and text-moderation-latest
. The default is text-moderation-latest
 which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use text-moderation-stable
, we will provide advanced notice before updating the model. Accuracy of text-moderation-stable
 may be slightly lower than for text-moderation-latest
.Example
{
"input": "I want to kill them."
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/moderations' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": "I want to kill them."
}'
Responses
🟢200Create moderation
application/json
Body
id
stringÂ
required
model
stringÂ
required
results
array [object {3}]Â
required
categories
objectÂ
optional
category_scores
objectÂ
optional
flagged
booleanÂ
optional
Example
{
"id": "modr-5MWoLO",
"model": "text-moderation-001",
"results": [
{
"categories": {
"hate": false,
"hate/threatening": true,
"self-harm": false,
"sexual": false,
"sexual/minors": false,
"violence": true,
"violence/graphic": false
},
"category_scores": {
"hate": 0.22714105248451233,
"hate/threatening": 0.4132447838783264,
"self-harm": 0.005232391878962517,
"sexual": 0.01407341007143259,
"sexual/minors": 0.0038522258400917053,
"violence": 0.9223177433013916,
"violence/graphic": 0.036865197122097015
},
"flagged": true
}
]
}
Modified at 2024-12-13 10:20:37