Text Moderation

Submit text for moderation to detect policy, safety, fraud, privacy, and prompt attack risks.

Submit text for moderation to detect policy, safety, fraud, privacy, and prompt attack risks.

Requirements

ItemSpecification
EncodingUTF-8
MethodPOST
Recommended timeout1s

Request

Request URL

ClusterRequest URL
USA (Virginia)http://api-text-fjny.fengkongcloud.com/text/v4
Singaporehttp://api-text-xjp.fengkongcloud.com/text/v4

Request Parameters

ParameterTypeRequiredDescription
accessKeystringYesAPI authentication key. The default accessKey is sent in your onboarding email.
appIdstringYesApplication identifier, such as web for your web application or app for your mobile app. The default appId is sent in your onboarding email. Contact DeepCleer if you need a new appId.
eventIdstringYesEvent identifier used to distinguish moderation scenarios in your application, such as prompt for user prompts or modelOutput for LLM output. The default eventId is sent in your onboarding email. Contact DeepCleer if you need a new eventId.
typestringYesRisk detection types. Detailed type refers to Detection Types. The type field accepts multiple detection categories joined with underscores — for example, set type to BAN_EROTIC to moderate for prohibited and pornographic content in a single call. TEXTRISK is a bundled general-risk check that covers POLITY, VIOLENT, BAN, EROTIC, DIRTY, ADVERT, PRIVACY, ADLAW, and MEANINGLESS. When TEXTRISK is combined with any of these individual categories, the result is their union — so TEXTRISK_POLITY behaves the same as TEXTRISK alone, because POLITY is already included.
datajson_objectYesRequest data content. Max 1 MB. See data Object.
translationTargetLangstringNoEnables online translation of the input before it is moderated. When set, the service translates text (and nickname / relateText if provided) into the target language and applies all policy checks to the translated output. Supported values: en (English). Contact DeepCleer to enable this feature.
acceptLangstringYesLanguage for returned labels. Set en by default.
callbackstringNoCallback HTTP URL. When provided, DeepCleer posts the moderation result to this endpoint as soon as it becomes available.

Detection Types

ValueDescription
POLITYPolitical content
VIOLENTViolence and terrorism
BANProhibited content
EROTICSexual or pornographic content
DIRTYProfanity and abusive language
ADVERTGeneral advertising
PRIVACYPersonally identifiable information
ADLAWAdvertising law violations
MEANINGLESSMeaningless or junk text
FRAUDOnline fraud and scams
UNPOACHHigh-value user poaching attempts
TEXTMINORContent involving minors
PROMPTATTACKPrompt injection and instruction-override attacks
PUBLICFIGUREPublic-figure recognition

data Object

ParameterTypeRequiredDescription
textstringYesThe text to moderate. Up to 10,000 characters per request; longer inputs are rejected with an error. If relateText or nickname is also set, all three fields are moderated together in the same request.
relateTextstringNoRelated context text moderated alongside text — for example, the parent comment when moderating a reply. Up to 128 characters; longer values are truncated.
tokenIdstringYesStable identifier for the end user, typically your internal user UID (an encrypted UID is fine). Used for behavioral-risk signals such as spam and repeat-offender detection. Alphanumeric with underscores and hyphens, up to 64 characters.
langstringYesLanguage of the text. Pass en by default. For international traffic when the language is combined, pass auto to enable automatic language detection. See Supported Languages.
nicknamestringNoThe end user's display name, moderated alongside text. Up to 150 characters; longer values are truncated.
ipstringNoPublic IP address of the user who submitted the text. Accepts IPv4 or IPv6.
deviceIdstringNoDevice-fingerprint identifier issued by DeepCleer.
dataIdstringNoClient-side identifier attached to the moderation call. DeepCleer echoes it back with the result, letting you correlate your source record (a post ID, message ID, review ID, etc.) with the moderation verdict — typically used to look up historical decisions in your own database or in the DeepCleer console.
extrajson_objectNoAuxiliary parameters. See extra Object.

extra Object

ParameterTypeRequiredDescription
receiveTokenIdstringNotokenId of the message recipient in a one-to-one chat. Alphanumeric with underscores and hyphens, up to 64 characters. Required when eventId is message.
topicstringNoIdentifier for the conversation container — for example, a forum thread, blog post, or book-review section. Strongly recommended when eventId is article; without it, context-aware moderation cannot be applied.
atIdstringNotokenId of the @‑mentioned user in a group-chat message. Alphanumeric with underscores and hyphens, up to 64 characters. Required when eventId is groupChat.
roomstringNoLive-room or game-room ID. Strongly recommended when eventId is groupChat; without it, context-aware moderation cannot be applied.
sexintNoUser's gender. 0 male, 1 female, 2 unknown.
passThroughjsonNoArbitrary pass-through data. The value is echoed back verbatim in the response, unchanged.

Supported Languages

ValueLanguage
enEnglish
zhChinese
arArabic
hiHindi
esSpanish
frFrench
ruRussian
ptPortuguese
idIndonesian
deGerman
jaJapanese
trTurkish
viVietnamese
itItalian
thThai
tlFilipino
koKorean
msMalay

Response

Response Parameters

ℹ️

Parameters other than code, message, and requestId are only guaranteed to be returned when code is 1100.

ParameterTypeRequiredDescription
codeintYesResponse code. See Response Codes.
messagestringYesResponse message corresponding to the code.
requestIdstringYesUnique identifier for this request. We strongly recommend logging it on your side — it's the key piece of information DeepCleer needs to help you investigate a specific moderation decision or tune your integration.
riskLevelstringYesDisposition recommendation. PASS — content is clean; allow it. REVIEW — content is suspicious; better to route to human review. REJECT — content violates policy; block it.
riskLabel1stringYesLevel-1 risk label. Returns normal when riskLevel is PASS; otherwise returns a violation tag such as POLITY, Erotic.
riskLabel2stringYesLevel-2 risk label. Returns normal when riskLevel is PASS; otherwise returns a violation tag.
riskLabel3stringYesLevel-3 risk label. Returns normal when riskLevel is PASS; otherwise returns a violation tag.
riskDescriptionstringYesHuman-readable summary of the detected risk, formed by concatenating the three riskLabel levels (for example, Advertising: Contact information). Returns Normal when riskLevel is PASS.
riskDetailjson_objectYesRisk detail information. See riskDetail Object.
tokenLabelsjson_objectYesAccount risk profile label information.
tokenLabels.UGC_account_riskjson_objectNoUGC content risk.
tokenLabels.UGC_account_risk.sexy_risk_tokenidfloatNoPornographic account risk score (0–1).
auxInfojson_objectYesAuxiliary information. See auxInfo Object.
allLabelsjson_arrayYesAll matched risk labels and details. See allLabels Array.
businessLabelsjson_arrayYesAll matched business labels and details. See businessLabels Array.
tokenProfileLabelsjson_arrayNoAccount attribute labels.
tokenRiskLabelsjson_arrayNoAccount risk labels.
langResultjson_objectNoLanguage information. See langResult Object.
finalResultintYesWhether this is the final result. 1: final result (can be used directly for downstream processing). 0: intermediate result (machine moderation; human review will follow).
resultTypeintYesCurrent result stage. 0: machine moderation. 1: human moderation.

Response Codes

CodeMessage
1100Success
1901QPS limit exceeded
1902Invalid parameters
1903Service failure
1905Character count exceeded
9101Unauthorized operation

riskDetail Object

ParameterTypeRequiredDescription
matchedListsjson_arrayNoCustom keyword lists that were triggered by this call. Each entry names a list you've configured in the DeepCleer console and enumerates the specific terms from that list that matched the input. Returned only when at least one configured keyword appears in text.
matchedLists[].namestringNoName of the triggered list, as configured in the DeepCleer console.
matchedLists[].wordsjson_arrayNoThe matched term, as it appeared on the list.
matchedLists[].words[].wordstringNoThe matched term, as it appeared on the list.
matchedLists[].words[].positionint_arrayNoCharacter offsets [start, end] of the match in the input text. Zero-indexed; end is exclusive.
riskSegmentsjson_arrayNoContiguous spans of the input judged to be high-risk. Returned when political, terrorism, prohibited, or advertising-law content is detected.
riskSegments[].segmentstringNoThe high-risk span, extracted verbatim from the input.
riskSegments[].positionint_arrayNoCharacter offsets [start, end] of the span in the input text. Zero-indexed; end is exclusive.

auxInfo Object

ParameterTypeRequiredDescription
filteredTextstringNoText with risky segments replaced by asterisks (*).
passThroughjson_objectNoPass-through field. Same value as data.extra.passThrough in the request.
contactResultjson_arrayNoContact information detection results, including WeChat, QQ, and phone numbers.
contactResult[].contactTypeintNoContact type. 0: phone number. 1: QQ number. 2: WeChat ID. 3: other.
contactResult[].contactStringstringNoDetected contact information string.
contextTextstringNoReturned when context recognition is enabled.
unauthorizedTypestringNoModeration types that are not enabled. Contact DeepCleer to enable this feature.

allLabels Array

Each element in the array:

ParameterTypeRequiredDescription
riskLabel1stringYesLevel 1 risk label.
riskLabel2stringYesLevel 2 risk label.
riskLabel3stringYesLevel 3 risk label.
riskDescriptionstringYesRisk description.
riskLevelstringYesRisk level: PASS, REVIEW or REJECT.
probabilityfloatYesConfidence score (0–1). Higher values indicate greater confidence.
riskDetailjson_objectYesRisk detail with same structure as riskDetail Object.

businessLabels Array

Each element in the array:

ParameterTypeRequiredDescription
businessLabel1stringYesLevel 1 business label.
businessLabel2stringYesLevel 2 business label.
businessLabel3stringYesLevel 3 business label.
businessDescriptionstringYesBusiness label description.
probabilityfloatYesConfidence score (0–1).
businessDetailjson_objectYesBusiness detail information.

Token Labels

Both tokenProfileLabels and tokenRiskLabels share the same structure:

ParameterTypeRequiredDescription
label1stringNoLevel 1 label.
label2stringNoLevel 2 label.
label3stringNoLevel 3 label.
descriptionstringNoLabel description.
timestampintNoLabel timestamp. 13-digit Unix timestamp in milliseconds.

langResult Object

ParameterTypeRequiredDescription
detectedLangstringNoLanguage detection result. Returned when lang is set to auto on an international text product. Value is a standard language code (e.g., en, ar).
translatedTextstringNoTranslation result. Returned when translationTargetLang is provided in the request.

Risk Label Reference

Level 1 LabelIdentifierTypeRequired type Value
PoliticalPoliticsRegulatoryTEXTRISK
Violence & TerrorismViolenceRegulatoryTEXTRISK
PornographicEroticRegulatoryTEXTRISK
ProhibitedProhibitRegulatoryTEXTRISK
AbusiveAbuseRegulatoryTEXTRISK
AdvertisingAdsRegulatoryTEXTRISK
BlocklistBlacklistRegulatoryTEXTRISK

Examples

Request Example

{
  "accessKey": "YOUR_ACCESS_KEY",
  "appId": "default",
  "eventId": "text",
  "type": "TEXTRISK",
  "data": {
    "text": "A biological father and daughter engaged in a sexual act.",
    "tokenId": "user_ID_001",
    "ip": "118.89.214.89",
    "deviceId": "device_fingerprint_id",
    "nickname": "user_nickname",
    "extra": {
      "topic": "12345",
      "atId": "username1",
      "room": "test_room_001",
      "receiveTokenId": "user_ID_002"
    }
  }
}

Response Example

{
    "allLabels": [
        {
            "probability": 0.851256158682228,
            "riskDescription": "Erotic:EroticDescription:IncestDescription:IncestOverview",
            "riskDetail": {},
            "riskLabel1": "Erotic",
            "riskLabel2": "EroticDescription",
            "riskLabel3": "IncestDescription",
            "riskLabel4": "IncestOverview",
            "riskLevel": "REJECT"
        }
    ],
    "auxInfo": {
        "filteredText": "*********************************************************"
    },
    "businessLabels": [],
    "code": 1100,
    "finalResult": 1,
    "langResult": {
        "detectedLang": "en"
    },
    "message": "success",
    "requestId": "41b2a64ef2c0bf47ecc10c615ed4dcb0",
    "resultType": 0,
    "riskDescription": "Erotic:EroticDescription:IncestDescription:IncestOverview",
    "riskDetail": {},
    "riskLabel1": "Erotic",
    "riskLabel2": "EroticDescription",
    "riskLabel3": "IncestDescription",