プロアクティブ一括審査インターフェース
Overview
Once Content Understanding is enabled, you can proactively invoke this REST API from your application backend to submit batches of text and image content for moderation. For audio and video moderation, see Synchronous Moderation.
API Call Instructions
Request URL Example
https://xxxxxx/v4/im_msg_audit/batch_content_moderation?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
Query Parameters
The table below lists only parameters relevant to this API call. For details on additional parameters, see the REST API Overview.
Parameter | Description |
xxxxxx | Only supported in Singapore. Use the dedicated domain for the region where your SDKAppID is located: Singapore: adminapisgp.im.qcloud.com Other data centers are not supported. |
v4/im_msg_audit/batch_content_moderation | API endpoint. |
sdkappid | SDKAppID assigned by the Chat console when creating the application. |
identifier | |
usersig | |
random | Enter a random 32-bit unsigned integer, range 0 - 4294967295. |
contenttype | Request format; must be json. |
Rate Limit
Maximum of 200 requests per second.
Request Example
{"AuditName":"Group","Contents":[{"ContentId":0,"ContentType":"Text","Content":"abc123"},{"ContentId":1,"ContentType":"Text","Content":"abc1234"},{"ContentId":2,"ContentType":"Image","Content":"https://www.simple.com/1.jpg"},{"ContentId":3,"ContentType":"Text","Content":"tttcccc"}],"ExtSender":"sender_xx","ExtReceiver":"receiver_yy"}
Request Fields
Field | Type | Required | Description |
AuditName | String | Required | Specifies the moderation configuration. For general configurations: C2C / Group / UserInfo / GroupInfo / GroupMemberInfo / RelationChainFor custom configurations: Custom Moderation Configuration ID. Custom moderation configurations must be created in the console. The proactive moderation API uses the custom configuration ID as the value for AuditName, directing moderation to the corresponding scenario. |
Contents | Array | Required | Array of items for batch moderation, supports up to 10 content items per batch. |
ContentId | Integer | Required | Unique content identifier. Each item in the array must have a distinct ContentId. |
ContentType | String | Required | Type of content to moderate. Allowed values: Text/Image for batch moderation. For audio and video. |
Content | String | Required | Content to be moderated. Maximum size: 8KB. For files, provide the corresponding URL. For images, maximum size is 5MB. |
ExtSender | String | Optional | Sender identifier. Can be left blank, or filled with Chat UserID or a custom sender identifier. If provided, enables filtering and analysis in the Content Understanding console. |
ExtReceiver | String | Optional | Receiver identifier. Can be left blank, filled with Chat UserID/GroupID, or a custom receiver identifier. If provided, enables filtering and analysis in the Content Understanding console. |
Response Example
{"ActionStatus": "OK","ErrorCode": 0,"ErrorInfo": "","AuditResults": [{"ErrorCode": 0,"ErrorInfo": "","ContentId": 0,"Result": "Block","Score": 99,"Label": "Polity","SubLabel": "ChinesePresident","Keywords": ["abc","mnt"],"RequestId": "c442f95e-35b9-47d7-8e01-3f9d644965fd"},{"ErrorCode": 0,"ErrorInfo": "","ContentId": 1,"Result": "Pass","Score": 0,"Label": "Normal","SubLabel": "","RequestId": "bf422ad2-cb2e-40cb-9b81-5936305c7b41"},{"ErrorCode": 0,"ErrorInfo": "","ContentId": 2,"Result": "Block","Score": 97,"Label": "Porn","SubLabel": "SexualBehavior","RequestId": "1ad85364-2bc1-454e-86bf-bbf1cc41fdff"},{"ErrorCode": 0,"ErrorInfo": "","ContentId": 3,"Result": "Pass","Score": 0,"Label": "Normal","SubLabel": "","RequestId": "ff7dad79-cb0c-4bea-aa99-1815b4de7591"}]}
Response Fields
Field | Type | Description |
ActionStatus | String | Request processing result: OK: Success. FAIL: Failure. |
ErrorCode | Integer | Error code: 0: Success. Non-zero: Failure. |
ErrorInfo | String | Detailed error information. |
AuditResults | Array | Array containing batch moderation results. |
ContentId | Integer | Content identifier, matches ContentId in request. |
RequestId | String | Unique moderation identifier. |
Result | String | Moderation recommendation for text/image: Pass/Review/Block. |
Keywords | Array | Keywords detected when content violates policy. May be empty if detected by the model. |
Score | Integer | Malicious score for text/image moderation, range 0–100. Higher scores indicate greater severity. |
Label | String | Category label assigned to content: Normal/Polity/Porn/Illegal/Abuse/Terror/Ad/Sexy/Composite. |
SubLabel | String | Secondary category assigned to content. |
Error Codes
Unless a network error occurs (such as a 502 error), this API always returns HTTP status code 200. Actual error codes and messages are provided in the ErrorCode and ErrorInfo fields of the response body.
Private error codes for this API:
Error Code | Description |
60003 | Invalid request parameters. |
60020 | Content Understanding service not enabled. |
60022 | Internal request error. Please contact support. |
93000 | Submitted content exceeds the maximum size limit of 8KB. |
93001 | Internal request error. If retrying does not resolve the issue, please contact support. |
93005 | Batch moderation API only supports text and image moderation. |
93006 | Batch moderation API timeout. Timeout is 5 seconds. |
93007 | Duplicate ContentId values are not supported in batch moderation API. |
93008 | Batch moderation API supports a maximum of 10 content items per request. |