Submit text moderation

Submit text for moderation. Returns a job ID for polling or webhook delivery. The pipeline runs keyword filtering and an LLM prohibition check; prohibited text is rejected, with the reason returned on the completed job. The prohibition check also evaluates every custom category enabled on your account, and names the one that tripped in the reason. Multipart requests allow at most eight non-file fields. Each field other than text must be at most 16,384 UTF-8 bytes. Oversized fields return 400; too many fields return 413.

POSThttps://api.omnifence.ai/api/v1/moderate/text

Requires the moderate:text scope. Requests without this scope receive a 403 FORBIDDEN response. See authentication.

The text field is limited to 20,000 characters. Longer input is rejected with 400 INVALID_REQUEST before a job is created or billed. Split longer documents into chunks and submit each one.

Request#

Headers#

Name Type Required Description
Authorization string Yes Your API key as a Bearer token: Bearer YOUR_API_KEY.

The request fields are described in Text moderation.

Example request#

cURLShell
curl -X POST https://api.omnifence.ai/api/v1/moderate/text \
  -H "Authorization: Bearer $OMNIFENCE_API_KEY" \
  -F "text=A beautiful sunset over the ocean" \
  -F "webhook_url=https://your-app.com/webhooks/omnifence"  # optional

Responses#

202 Accepted#

Field Type Always present Description
job_id string (uuid) Yes
status string Yes One of queued.
Example responseJSON
{
  "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "queued"
}

503 Service Unavailable#

Moderation intake is busy or a dependency is unavailable. Capacity rejections include Retry-After (seconds); retry with backoff and jitter. SUBMISSION_STATUS_UNKNOWN includes a job_id: poll it before submitting again because acceptance could not be confirmed.

Field Type Always present Description
error string Yes
message string Yes
statusCode integer Yes One of 503.
job_id string (uuid) No Recovery ID when the acceptance outcome is unknown.
Example responseJSON
{
  "error": "string",
  "message": "string",
  "statusCode": 503,
  "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}