TypeScript
Moderate a record
Persist a record and return its moderation result immediately
Call moderateARecord when moderation must complete before your application continues.
const result = await client.moderateARecord({
clientId: "post-123",
name: "A post",
entity: "post",
content: "Hello world",
metadata: { source: "community" },
});clientId, name, entity, and content are required. content can be text or an object with text, imageUrls, and externalUrls. Include user to associate the record with a user, or set passthrough: true to moderate without persisting record or user content.
Returns ModerateResponse, including the record ID, moderation status, matching rule IDs, and moderation ID.
Request fields
| Field | Required | Description |
|---|---|---|
clientId | Yes | Your stable identifier for this record. |
name | Yes | A title or name for the record. |
entity | Yes | The record kind, such as post, comment, or message. |
content | Yes | Text, or text with image and external URLs. |
metadata | No | Up to 50 serializable values for filtering and context. |
user | No | The associated user profile. |
passthrough | No | Moderate without storing the record or user content. |
Check result.status for the moderation decision and result.categoryIds for the rules that matched.