Skip to main content
POST
Classifies messages in a conversation for harmful content. Unlike /v1/moderations, this endpoint accepts chat messages and supports a scope parameter to control which messages are evaluated. Not compatible with the OpenAI SDK. Use /v1/moderations for SDK compatibility.

Authorizations

Authorization
string
header
required

Your authentication credentials. Pass your API key as a Bearer token: Bearer $INWORLD_API_KEY. You can create a key in one command with the Inworld CLI: inworld workspace add-key.

Body

application/json
messages
object[]
required

Array of chat messages to classify.

scope
default:last

Which messages to classify. "last" (default) processes only the last message. "all" processes every message. A positive integer N processes the last N messages. Be mindful that including many messages increases response latency.

Available options:
all,
last
model
string
default:inworld/moderation-latest

The moderation model to use.

Response

A successful response.

id
string

Unique identifier for the moderation request.

model
string

The model used for classification.

result
object

A single aggregated moderation result for the conversation.