Skip to main content
POST
/
moderate
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'

Authorizations

Authorization
string
header
required

Body

application/json
content
object
required
  • Option 1
  • Option 2
  • Option 3
  • Option 4
  • Option 5
channel
string
contentId
string
Maximum length: 100
metaType
enum<string>
Available options:
profile,
message,
post,
comment,
event,
product,
review,
other
authorId
string
conversationId
string
metadata
object
doNotStore
boolean

Response

content
object
required
author
object | null
required
evaluation
object
required
recommendation
object
required
policies
object[]
required
  • Option 1
  • Option 2
insights
object[]
required
  • Option 1
  • Option 2
meta
object
required
errors
object[]