Skip to content
Laya AI

Decision template · content moderation API

Unofficial community documentation

Content moderation API for user text

Moderate UGC with allow / review / block plus toxicity, threats, and spam scores. Fast typed decisions via hosted Laya.

POST https://api.layaaimodel.com/v1/content/moderate

When to use it

Comments, DMs, and chat strings that need a policy gate before publish or before an LLM replies.

UGC pipelines need a hard gate: allow, send to review, or block. Vision and multimodal stacks can wait; plain text comments and DMs are the hot path. A content moderation API that returns action plus toxicity/threats/spam flags is easier to enforce than a model that “explains” why something is bad.

Call the template synchronously on submit. If action is block, reject. If review, enqueue for a human. If allow, publish or hand off to a generative reply. Because answers are typed, you can unit-test thresholds and keep audit logs as JSON instead of scraped paragraphs.

This landing targets people searching for content moderation API, toxicity scoring, or UGC allow/review/block — demand terms, not only the Laya brand.

How the request works

POST the raw text. Get a choice action and noul flags for toxicity, threats, and spam. Confidence and probabilities come back calibrated — no free-text rationale to parse.

bash
curl https://api.layaaimodel.com/v1/content/moderate \
  -H "Authorization: Bearer laya_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"You're an idiot and I'll find where you live."}'

Questions you get back

Each id is a typed decision (choice / score / noul) — the System One shape, not a chat completion.

text
action (choice): Moderation action? [allow | review | block]
toxicity (noul): Contains toxic or harassing language? [yes/no probability]
threats (noul): Contains threats of harm? [yes/no probability]
spam (noul): Looks like spam? [yes/no probability]

Example result shape

Harassing or threatening language should prefer review/block with elevated toxicity/threats. Neutral product feedback should allow with low flags.

sample answers
action: block · 81%
toxicity: yes · 88%
threats: yes · 74%
spam: no · 6%

Live calibrated bars and a free anonymous try: open the homepage playground or the interactive tools runner.

Pricing & keys

Create a laya_ key on Account, buy prepaid packs on Pricing, or read the full decide reference under API docs. Output tokens are free; input is metered.