Authorizations
Body
application/json
import ModerationAPI from "@moderation-api/sdk";
// Uses environment variable MODAPI_SECRET_KEY
const moderationApi = new ModerationAPI();
// Or pass key explicitly
// const moderationApi = new ModerationAPI({ key: '<token>' });
const result = await moderationApi.content.submit({
content: {
type: "text",
text: "Hello world",
},
contentId: "post-123",
authorId: "user-123",
conversationId: "room-123",
metadata: {
source: "chat",
},
});
// Check result
console.log(result.evaluation.flagged); // boolean
console.log(result.recommendation.action); // 'allow', 'review', or 'reject'
{
"content": {
"id": "<string>",
"masked": true,
"modified": "<string>"
},
"author": {
"id": "<string>",
"external_id": "<string>",
"block": {
"until": 123,
"reason": "<string>"
},
"status": "enabled",
"trust_level": {
"level": 123,
"manual": true
}
},
"evaluation": {
"flagged": true,
"flag_probability": 123,
"severity_score": 123,
"unicode_spoofed": true
},
"recommendation": {
"action": "review",
"reason_codes": [
"severity_reject"
]
},
"policies": [
{
"id": "<string>",
"type": "<string>",
"probability": 0.5,
"flagged": true,
"flagged_fields": [
"<string>"
],
"labels": [
{
"id": "<string>",
"probability": 0.5,
"flagged": true
}
]
}
],
"insights": [
{
"id": "<string>",
"type": "<string>",
"probability": 0.5,
"value": "positive"
}
],
"meta": {
"status": "success",
"timestamp": 123,
"channel_key": "<string>",
"usage": 123,
"processing_time": "<string>"
},
"errors": [
{
"id": "<string>",
"message": "<string>"
}
]
}import ModerationAPI from "@moderation-api/sdk";
// Uses environment variable MODAPI_SECRET_KEY
const moderationApi = new ModerationAPI();
// Or pass key explicitly
// const moderationApi = new ModerationAPI({ key: '<token>' });
const result = await moderationApi.content.submit({
content: {
type: "text",
text: "Hello world",
},
contentId: "post-123",
authorId: "user-123",
conversationId: "room-123",
metadata: {
source: "chat",
},
});
// Check result
console.log(result.evaluation.flagged); // boolean
console.log(result.recommendation.action); // 'allow', 'review', or 'reject'
{
"content": {
"id": "<string>",
"masked": true,
"modified": "<string>"
},
"author": {
"id": "<string>",
"external_id": "<string>",
"block": {
"until": 123,
"reason": "<string>"
},
"status": "enabled",
"trust_level": {
"level": 123,
"manual": true
}
},
"evaluation": {
"flagged": true,
"flag_probability": 123,
"severity_score": 123,
"unicode_spoofed": true
},
"recommendation": {
"action": "review",
"reason_codes": [
"severity_reject"
]
},
"policies": [
{
"id": "<string>",
"type": "<string>",
"probability": 0.5,
"flagged": true,
"flagged_fields": [
"<string>"
],
"labels": [
{
"id": "<string>",
"probability": 0.5,
"flagged": true
}
]
}
],
"insights": [
{
"id": "<string>",
"type": "<string>",
"probability": 0.5,
"value": "positive"
}
],
"meta": {
"status": "success",
"timestamp": 123,
"channel_key": "<string>",
"usage": 123,
"processing_time": "<string>"
},
"errors": [
{
"id": "<string>",
"message": "<string>"
}
]
}import ModerationAPI from "@moderation-api/sdk";
// Uses environment variable MODAPI_SECRET_KEY
const moderationApi = new ModerationAPI();
// Or pass key explicitly
// const moderationApi = new ModerationAPI({ key: '<token>' });
const result = await moderationApi.content.submit({
content: {
type: "text",
text: "Hello world",
},
contentId: "post-123",
authorId: "user-123",
conversationId: "room-123",
metadata: {
source: "chat",
},
});
// Check result
console.log(result.evaluation.flagged); // boolean
console.log(result.recommendation.action); // 'allow', 'review', or 'reject'
Show child attributes
100profile, message, post, comment, event, product, review, other Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?