审核记录与违规
本页的接口查询和处理你的审核记录,查询和清除用户的违规,查询统计,以及以用户的名义举报。这些接口与控制台“内容安全”中的“审核记录”“平台处置”“用户违规”和“统计”相同,可以用来把审核接入你自己的审核系统或客服系统。审核记录的来源和处理规则见人工审核,在控制台中的操作见审核记录。
接入自己的审核系统时,一般这样做:
- 订阅回调事件
moderation.item_created(有新的审核记录),或定期按status=pending查询审核记录列表; - 读取审核记录的内容,交给审核人员判断;
- 作出结论,需要时同时撤回消息、清除资料、禁言或封禁作者。
说明:
- 只能看到你的队列:接口只返回你的审核记录(包括你转交平台的记录的状态),平台规则命中、由平台审核的记录不会出现。平台对你的应用执行的处置用查询平台的处置查看。
- 内容与列表分开:列表和单个记录都不含用户的内容,内容只能通过读取审核记录的内容取得。通过接口读取内容不写操作日志,请在你的系统中自行记录谁看过哪些内容。
- 操作日志:作出结论、转交平台和清除违规写入操作日志,操作人为调用所用的服务端密钥;记录中的结论显示为“App 凭据”。
- 调用额度:批量作出结论按记录数计入应用的 OpenAPI 调用额度,见批量接口。
查询审核记录列表
分页查询审核记录,见分页。默认只返回未结束的记录(pending、auto_violation),按优先级、再按创建时间从新到旧排列;order=oldest 时同一优先级中从旧到新,处理积压时使用。只查询已结束的状态时,不按优先级,只按创建时间排列。
/{org_name}/{app_name}/moderation/items路径参数
org_name、app_name 见接入概述。
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
status | String | 否 | 状态,可以重复给出多个,如 status=violation&status=no_violation,取值见审核记录对象。默认为 pending 和 auto_violation |
scene | String | 否 | 场景,取值见审核的内容和时机;举报用户、群、聊天室的记录为 report |
target_type | String | 否 | 对象的类型,取值见审核记录对象 |
category | String | 否 | 含有这个类别的记录 |
source | String | 否 | 含有这种来源的记录:word_list 词库、provider 第三方审核、report 举报、url_rejected 地址无法审核、escalation 转交平台 |
author | String | 否 | 作者的用户名。用户不存在时返回空列表 |
priority | Number | 否 | 优先级,0 到 2 |
from、to | String | 否 | 创建时间的范围,RFC 3339 格式,如 2026-10-04T19:50:00Z |
escalated | Boolean | 否 | 为 true 时改为查询你转交平台的记录 |
order | String | 否 | 为 oldest 时从旧到新排列 |
limit | Number | 否 | 每页的条数,默认 20,最大 100 |
cursor | String | 否 | 上一页返回的 next_cursor |
请求示例
curl "$IM_API/$ORG/$APP/moderation/items?source=word_list&limit=20" \
-H "Authorization: Bearer $APP_TOKEN"响应
成功返回 200 OK:
| 字段 | 类型 | 说明 |
|---|---|---|
items | Array<Object> | 审核记录对象的数组,不含 actions |
next_cursor | String | 下一页的游标,没有下一页时为 null |
{
"items": [
{
"item_id": "100319142342557696",
"queue": "tenant",
"status": "pending",
"scene": "message",
"target_type": "message",
"target_id": "100319140375429120",
"target_username": null,
"target_group_id": null,
"conversation_id": "100311226008993792",
"author": "lisi",
"sources": [
{
"type": "word_list",
"list_id": "100311111852621824",
"list_name": "疑似诈骗",
"word": "兼职刷单",
"category": "fraud"
}
],
"categories": [
"fraud"
],
"suggestion": "review",
"auto_actions": [],
"report_count": 0,
"priority": 2,
"decision": null,
"escalated_at": null,
"content_available": true,
"version": 1,
"created_at": "2026-10-04T19:52:27.376Z",
"closed_at": null,
"close_reason": null
}
],
"next_cursor": null
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 400 | invalid_argument | 取值不合法,details.field 为 status、scene、category、source、priority、from 或 to |
查询审核记录
查询一条审核记录,包括它引起的处置 actions。
/{org_name}/{app_name}/moderation/items/{item_id}路径参数
org_name、app_name 见接入概述。
| 参数 | 类型 | 说明 |
|---|---|---|
item_id | String | 审核记录 ID |
请求示例
curl "$IM_API/$ORG/$APP/moderation/items/100311227732852736" \
-H "Authorization: Bearer $APP_TOKEN"响应
成功返回 200 OK,响应体为审核记录对象。下面这条记录先由词库送审,又被用户举报;审核人员确认违规并撤回了消息,之后改判为无违规:
{
"item_id": "100311227732852736",
"queue": "tenant",
"status": "no_violation",
"scene": "message",
"target_type": "message",
"target_id": "100311226352926720",
"target_username": null,
"target_group_id": null,
"conversation_id": "100311226008993792",
"author": "zhangsan",
"sources": [
{
"type": "word_list",
"list_id": "100311111852621824",
"list_name": "疑似诈骗",
"word": "兼职刷单",
"category": "fraud"
},
{
"type": "report",
"count": 1,
"reason": "fraud"
}
],
"categories": [
"fraud"
],
"suggestion": "review",
"auto_actions": [],
"report_count": 1,
"priority": 0,
"decision": {
"result": "no_violation",
"by_type": "account",
"by": "文档(d***@example.com)",
"note": "用户申诉,确认误判",
"decided_at": "2026-10-04T19:26:40.754Z"
},
"escalated_at": null,
"content_available": true,
"version": 4,
"created_at": "2026-10-04T19:21:00.386Z",
"closed_at": "2026-10-04T19:26:32.494Z",
"close_reason": "decided",
"actions": [
{
"action_id": "100312620694765568",
"kind": "recall_message",
"authority": "tenant",
"trigger": "review",
"status": "done",
"last_error": null,
"created_at": "2026-10-04T19:26:32.497Z",
"done_at": "2026-10-04T19:26:32.545Z"
}
]
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 404 | not_found | 审核记录不存在,或不是你的审核记录 |
读取审核记录的内容
读取审核记录的内容快照和其中的举报。内容是第一次被发现时的快照:之后消息被撤回、资料被修改,读到的仍是当时的内容。记录结束 30 天后内容被清空,content 为 null,举报的说明和证据同时清空。
/{org_name}/{app_name}/moderation/items/{item_id}/content路径参数
org_name、app_name 见接入概述。
| 参数 | 类型 | 说明 |
|---|---|---|
item_id | String | 审核记录 ID |
请求示例
curl "$IM_API/$ORG/$APP/moderation/items/100312464440164352/content" \
-H "Authorization: Bearer $APP_TOKEN"响应
成功返回 200 OK:
| 字段 | 类型 | 说明 |
|---|---|---|
item_id | String | 审核记录 ID |
content | Object | 内容快照,结构随对象的类型不同,见内容快照;已清空时为 null |
reports | Array<Object> | 这条记录中的举报,见举报详情;没有举报时为空数组 |
举报用户的记录:profile 为举报时的资料,之后资料又被修改过的,新的资料在 versions 中:
{
"item_id": "100312464440164352",
"content": {
"profile": {
"avatar_url": "",
"nickname": "zhangsan"
},
"versions": [
{
"captured_at": "2026-10-04T19:27:35.838Z",
"profile": {
"avatar_url": "https://cdn.example.com/avatars/zhangsan.png",
"nickname": "zhangsan"
}
}
]
},
"reports": [
{
"report_id": "100312464440164353",
"reporter": "lisi",
"reason": "abuse",
"description": "多次辱骂",
"evidence": [
{
"message_id": "100311226034159616",
"conversation_id": "100311226008993792",
"sender": "zhangsan",
"type": "text",
"body": {
"text": "你这个**,周末一起吃饭"
},
"created_at": "2026-10-04T19:20:59.978Z"
}
],
"via": "openapi",
"created_at": "2026-10-04T19:25:55.240Z"
},
{
"report_id": "100312886391341057",
"reporter": "wangwu",
"reason": "ad",
"description": "",
"evidence": [],
"via": "client",
"created_at": "2026-10-04T19:27:35.841Z"
}
]
}消息的记录:
{
"item_id": "100311227732852736",
"content": {
"body": {
"text": "在家兼职刷单,日结300"
},
"created_at": "2026-10-04T19:21:00.055Z",
"edits": [],
"ext": null,
"review_urls": [],
"type": "text"
},
"reports": [
{
"report_id": "100312442805944321",
"reporter": "lisi",
"reason": "fraud",
"description": "冒充兼职,要求先垫付",
"evidence": [],
"via": "openapi",
"created_at": "2026-10-04T19:25:50.082Z"
}
]
}送审的资料(如昵称)的记录:
{
"item_id": "100312702043291648",
"content": {
"fields": [
{
"captured_at": "2026-10-04T19:26:51.887Z",
"name": "nickname",
"value": "兼职刷单达人"
}
]
},
"reports": []
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 404 | not_found | 审核记录不存在,或不是你的审核记录 |
作出结论
对一条审核记录作出结论:确认违规(可以同时处置),或无违规。也用于改判:作出结论后 30 天内可以把“确认违规”改为“无违规”。
/{org_name}/{app_name}/moderation/items/{item_id}/decide结论的效果:
| 当前状态 | 结论 | 效果 |
|---|---|---|
pending | violation | 状态改为 violation,执行选择的处置;count_violation 为 true 时计入作者的违规,可能触发自动处罚 |
pending | no_violation | 状态改为 no_violation |
auto_violation | violation | 状态改为 violation。自动处置和违规已经有了,不重复,只执行这次另外选择的处置 |
auto_violation、violation | no_violation | 改判为无违规:删除这条记录引起的、按你的规则记下的违规,解除它屏蔽的文件。已撤回的消息不能恢复,已执行的禁言和封禁不会解除,需要时调用解除禁言、解封用户 |
no_violation | violation | 不允许,返回 403 permission_denied(not_revisable)。发现新的违规时等新的命中或举报 |
expired(超过 30 天未处理) | 两者都可以 | 与 pending 相同;曾自动处置的与 auto_violation 相同 |
处置在结论提交后执行,响应中的处置通常还是 pending,稍后查询审核记录可以看到结果。前一次请求已经成功、因为超时而重试的(结论相同、没有新的处置),直接返回当前的记录,不重复处置。
路径参数
org_name、app_name 见接入概述。
| 参数 | 类型 | 说明 |
|---|---|---|
item_id | String | 审核记录 ID |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
decision | String | 是 | violation 确认违规,no_violation 无违规 |
actions | Array<Object> | 否 | 同时执行的处置,只用于 violation,见处置 |
count_violation | Boolean | 否 | 是否计入作者的违规,默认为 true。作者被盗号等情况可以传 false;没有作者的记录忽略这一项 |
note | String | 否 | 说明,最多 256 个字符,记入结论和操作日志 |
version | Number | 否 | 读取到的记录的 version。给出时与当前版本不一致返回 409 version_conflict,details.current 为当前的记录,可以据此看到别人作出的结论 |
请求示例
确认违规,撤回消息并禁言作者 1 小时:
curl -X POST "$IM_API/$ORG/$APP/moderation/items/100319140232822784/decide" \
-H "Authorization: Bearer $APP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"decision": "violation",
"actions": [
{ "kind": "recall_message" },
{ "kind": "mute_user", "scopes": ["chat", "group"], "duration_seconds": 3600 }
],
"count_violation": true,
"note": "发布刷单兼职",
"version": 1
}'改判为无违规:
curl -X POST "$IM_API/$ORG/$APP/moderation/items/100319140232822784/decide" \
-H "Authorization: Bearer $APP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"decision": "no_violation",
"note": "用户申诉成功",
"version": 2
}'响应
成功返回 200 OK,响应体为作出结论后的审核记录对象:
{
"item_id": "100319140232822784",
"queue": "tenant",
"status": "violation",
"scene": "message",
"target_type": "message",
"target_id": "100319139314270208",
"target_username": null,
"target_group_id": null,
"conversation_id": "100311226008993792",
"author": "lisi",
"sources": [
{
"type": "word_list",
"list_id": "100311111852621824",
"list_name": "疑似诈骗",
"word": "兼职刷单",
"category": "fraud"
}
],
"categories": [
"fraud"
],
"suggestion": "review",
"auto_actions": [],
"report_count": 0,
"priority": 2,
"decision": {
"result": "violation",
"by_type": "app",
"by": "App 凭据",
"note": "发布刷单兼职",
"decided_at": "2026-10-04T19:53:11.258Z"
},
"escalated_at": null,
"content_available": true,
"version": 2,
"created_at": "2026-10-04T19:52:26.872Z",
"closed_at": "2026-10-04T19:53:11.258Z",
"close_reason": "decided",
"actions": [
{
"action_id": "100319326401200128",
"kind": "recall_message",
"authority": "tenant",
"trigger": "review",
"status": "pending",
"last_error": null,
"created_at": "2026-10-04T19:53:11.263Z",
"done_at": null
},
{
"action_id": "100319326401200129",
"kind": "mute_user",
"authority": "tenant",
"trigger": "review",
"status": "pending",
"last_error": null,
"created_at": "2026-10-04T19:53:11.263Z",
"done_at": null
}
]
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 400 | invalid_argument | details.field 为 decision、note 或 actions:取值不合法,如禁言没有给出 scopes、时长超出范围 |
| 400 | invalid_argument | details.reason 为 invalid_action:处置不适用于这个对象,如对用户资料撤回消息、对没有本应用文件的消息屏蔽文件、对没有作者的记录禁言;或者 no_violation 带了处置 |
| 403 | permission_denied | details.reason 为 not_revisable:把无违规改为违规;改判超过 30 天;记录已转交平台,或因转交、对象被删除而结束;平台作出的结论只有平台能改判 |
| 404 | not_found | 审核记录不存在 |
| 409 | version_conflict | version 与当前版本不一致,details.current 为当前的审核记录对象 |
{
"error": {
"code": "permission_denied",
"message": "不能把无违规改为违规",
"details": {
"reason": "not_revisable"
},
"request_id": "ZGPHLUYW77R3JNTDAUUSGNTOHP"
}
}批量作出结论
对多条记录作出同样的结论,一次 1 到 100 条,例如处理一批刷屏的广告。每条记录分别处理,某条失败不影响其他记录。
- 只处理还没有结论的记录(
pending、auto_violation,以及超过 30 天未处理而结束的),已被作出结论的返回version_conflict,不在批量中改判; - 处置只能是撤回消息、撤回聊天室消息、屏蔽文件、清除资料和删除聊天室属性,不能禁言、封禁用户,也不能封禁群和聊天室;
- 不需要
version,按每条记录当前的版本处理。
/{org_name}/{app_name}/moderation/items/batch-decide路径参数
org_name、app_name 见接入概述。
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
item_ids | Array<String> | 是 | 审核记录 ID,1 到 100 个 |
decision | String | 是 | violation 或 no_violation |
actions | Array<Object> | 否 | 对每条记录执行的处置,只用于 violation,见处置。每条记录都必须适用这些处置,否则这条记录失败 |
count_violation | Boolean | 否 | 是否计入作者的违规,默认为 true |
note | String | 否 | 说明,最多 256 个字符 |
请求示例
curl -X POST "$IM_API/$ORG/$APP/moderation/items/batch-decide" \
-H "Authorization: Bearer $APP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"item_ids": ["100319140253794304", "100319140253794311", "100319140232822784"],
"decision": "violation",
"actions": [{ "kind": "recall_message" }],
"count_violation": false,
"note": "批量刷单广告"
}'响应
成功返回 200 OK,results 按请求的顺序给出每条记录的结果:成功的为 item_id 和作出结论后的记录 item,失败的为 item_id 和 error(code、message,有时有 details)。下例中第三条记录已经有了结论(中间的记录省略):
{
"results": [
{
"item": {
"item_id": "100319140253794304",
"queue": "tenant",
"status": "violation",
"scene": "message",
"target_type": "message",
"target_id": "100319139679174656",
"target_username": null,
"target_group_id": null,
"conversation_id": "100311226008993792",
"author": "lisi",
"sources": [
{
"type": "word_list",
"list_id": "100311111852621824",
"list_name": "疑似诈骗",
"word": "兼职刷单",
"category": "fraud"
}
],
"categories": [
"fraud"
],
"suggestion": "review",
"auto_actions": [],
"report_count": 0,
"priority": 2,
"decision": {
"result": "violation",
"by_type": "app",
"by": "App 凭据",
"note": "批量刷单广告",
"decided_at": "2026-10-04T19:53:27.498Z"
},
"escalated_at": null,
"content_available": true,
"version": 2,
"created_at": "2026-10-04T19:52:26.878Z",
"closed_at": "2026-10-04T19:53:27.498Z",
"close_reason": "decided",
"actions": [
{
"action_id": "100319394516697088",
"kind": "recall_message",
"authority": "tenant",
"trigger": "review",
"status": "pending",
"last_error": null,
"created_at": "2026-10-04T19:53:27.498Z",
"done_at": null
}
]
},
"item_id": "100319140253794304"
},
{
"error": {
"code": "version_conflict",
"message": "数据已被其他人修改,请刷新后重试",
"details": {
"current": {
"item_id": "100319140232822784",
"queue": "tenant",
"status": "violation",
"scene": "message",
"target_type": "message",
"target_id": "100319139314270208",
"target_username": null,
"target_group_id": null,
"conversation_id": "100311226008993792",
"author": "lisi",
"sources": [
{
"type": "word_list",
"list_id": "100311111852621824",
"list_name": "疑似诈骗",
"word": "兼职刷单",
"category": "fraud"
}
],
"categories": [
"fraud"
],
"suggestion": "review",
"auto_actions": [],
"report_count": 0,
"priority": 2,
"decision": {
"result": "violation",
"by_type": "app",
"by": "App 凭据",
"note": "发布刷单兼职",
"decided_at": "2026-10-04T19:53:11.258Z"
},
"escalated_at": null,
"content_available": true,
"version": 2,
"created_at": "2026-10-04T19:52:26.872Z",
"closed_at": "2026-10-04T19:53:11.258Z",
"close_reason": "decided",
"actions": [
{
"action_id": "100319326401200128",
"kind": "recall_message",
"authority": "tenant",
"trigger": "review",
"status": "done",
"last_error": null,
"created_at": "2026-10-04T19:53:11.263Z",
"done_at": "2026-10-04T19:53:11.320Z"
},
{
"action_id": "100319326401200129",
"kind": "mute_user",
"authority": "tenant",
"trigger": "review",
"status": "done",
"last_error": null,
"created_at": "2026-10-04T19:53:11.263Z",
"done_at": "2026-10-04T19:53:11.347Z"
}
]
}
}
},
"item_id": "100319140232822784"
}
]
}错误
以下错误针对整个请求,这时没有处理任何记录。
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 400 | invalid_argument | details.field 为 item_ids:为空、超过 100 个或有不合法的 ID |
| 400 | invalid_argument | details.reason 为 invalid_action:处置中有禁言、封禁 |
单条记录的失败可能为 not_found、version_conflict、invalid_argument(invalid_action)、permission_denied(not_revisable)。
转交平台
把一条未结束的审核记录转交给平台处理,用于你认为内容可能违法、需要平台处理的情况。转交后记录由平台审核,你仍能查看它的状态(查询审核记录列表时带 escalated=true),但不能再作出结论。平台已经有同一个对象的记录时,这条记录并入平台的记录,状态改为 expired,close_reason 为 escalated。
/{org_name}/{app_name}/moderation/items/{item_id}/escalate路径参数
org_name、app_name 见接入概述。
| 参数 | 类型 | 说明 |
|---|---|---|
item_id | String | 审核记录 ID |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
note | String | 否 | 转交的说明,最多 256 个字符。没有请求体时可以省略 Content-Type |
请求示例
curl -X POST "$IM_API/$ORG/$APP/moderation/items/100312522434805760/escalate" \
-H "Authorization: Bearer $APP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"note": "群公告疑似违法,请平台处理"
}'响应
成功返回 200 OK,响应体为转交后的审核记录对象,queue 为 platform:
{
"item_id": "100312522434805760",
"queue": "platform",
"status": "pending",
"scene": "report",
"target_type": "group",
"target_id": "100311656273281024",
"target_username": null,
"target_group_id": null,
"conversation_id": null,
"author": null,
"sources": [
{
"type": "report",
"count": 1,
"reason": "other"
},
{
"type": "escalation",
"note": "群公告疑似违法,请平台处理"
}
],
"categories": [
"other"
],
"suggestion": null,
"auto_actions": [],
"report_count": 1,
"priority": 2,
"decision": null,
"escalated_at": "2026-10-04T19:53:39.067Z",
"content_available": true,
"version": 2,
"created_at": "2026-10-04T19:26:09.067Z",
"closed_at": null,
"close_reason": null
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 400 | invalid_argument | details.field 为 note:说明超过 256 个字符 |
| 403 | permission_denied | details.reason 为 not_revisable:记录已经结束或已经转交 |
| 404 | not_found | 审核记录不存在 |
查询平台的处置
查询平台规则命中后,以平台的身份对你的应用执行的处置,如撤回消息、屏蔽文件、封禁,按时间从新到旧分页。只返回对象、类别和处置,不含内容。平台撤回的消息由平台留证,平台屏蔽的文件和平台的封禁你不能解除。
/{org_name}/{app_name}/moderation/platform-actions路径参数
org_name、app_name 见接入概述。
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
limit | Number | 否 | 每页的条数,默认 20,最大 100 |
cursor | String | 否 | 上一页返回的 next_cursor |
请求示例
curl "$IM_API/$ORG/$APP/moderation/platform-actions" \
-H "Authorization: Bearer $APP_TOKEN"响应
成功返回 200 OK,items 的每一项:
| 字段 | 类型 | 说明 |
|---|---|---|
target_type、target_id、target_username、target_group_id | String | 处置的对象,含义同审核记录对象 |
category | String | 主要的类别 |
kind | String | 处置的种类,见处置 |
status | String | pending 待执行、done 已执行、skipped 已跳过、failed 失败 |
created_at | String | 处置的时间 |
done_at | String | 执行完成的时间,未完成为 null |
next_cursor 为下一页的游标,没有下一页时为 null。
{
"items": [
{
"category": "porn",
"created_at": "2026-10-04T19:25:27.939Z",
"done_at": "2026-10-04T19:25:27.995Z",
"kind": "recall_message",
"status": "done",
"target_group_id": null,
"target_id": "100312348417327104",
"target_type": "message",
"target_username": null
}
],
"next_cursor": null
}查询用户的违规
查询用户的违规记录(按时间从新到旧分页)、当前的违规次数和最近的处罚。哪些情况计入违规见违规记录与自动处罚。
/{org_name}/{app_name}/moderation/users/{username}/violations路径参数
org_name、app_name 见接入概述。
| 参数 | 类型 | 说明 |
|---|---|---|
username | String | 用户名 |
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
limit | Number | 否 | 每页的违规记录条数,默认 20,最大 100 |
cursor | String | 否 | 上一页返回的 next_cursor |
请求示例
curl "$IM_API/$ORG/$APP/moderation/users/zhaoliu/violations" \
-H "Authorization: Bearer $APP_TOKEN"响应
成功返回 200 OK:
| 字段 | 类型 | 说明 |
|---|---|---|
items | Array<Object> | 违规记录,见下表 |
next_cursor | String | 下一页的游标,没有下一页时为 null |
violation_count | Number | 当前的违规次数(180 天内、没有被清除的),参与自动处罚规则 |
penalties | Array<Object> | 最近 10 次处罚(自动处罚和结论中的禁言、封禁),见下表 |
items 的每一项:
| 字段 | 类型 | 说明 |
|---|---|---|
violation_id | String | 违规记录 ID |
scene | String | 场景;举报用户、群、聊天室引起的为 report |
category | String | 类别 |
source | String | 来源:sync 发送前、保存前检查被拒绝,async 事后审核自动处置,review 审核人员确认违规 |
authority | String | 按谁的规则:tenant 你的规则,platform 平台规则 |
item_id | String | 对应的审核记录 ID;发送前、保存前被拒绝的为 null。平台规则的违规对应平台的记录,查询它返回 404 |
created_at | String | 违规的时间 |
penalties 的每一项:
| 字段 | 类型 | 说明 |
|---|---|---|
kind | String | mute_user 全局禁言、disable_user 封禁 |
params | Object | scopes 禁言的场景,duration_seconds 时长(null 为永久),reason 原因 |
status | String | pending 待执行、done 已执行、skipped 已跳过、failed 失败 |
created_at | String | 处罚的时间 |
{
"items": [
{
"violation_id": "100312349927276546",
"scene": "message",
"category": "porn",
"source": "async",
"authority": "platform",
"item_id": "100312349927276544",
"created_at": "2026-10-04T19:25:27.941Z"
},
{
"violation_id": "100312269543440386",
"scene": "message",
"category": "ad",
"source": "async",
"authority": "tenant",
"item_id": "100312269543440384",
"created_at": "2026-10-04T19:25:08.777Z"
},
{
"violation_id": "100312045760544768",
"scene": "message",
"category": "ad",
"source": "sync",
"authority": "tenant",
"item_id": null,
"created_at": "2026-10-04T19:24:15.419Z"
}
],
"next_cursor": null,
"penalties": [
{
"kind": "mute_user",
"params": {
"scopes": [
"chat",
"group"
],
"duration_seconds": 3600,
"reason": "内容安全:自动处罚(24 小时内违规 3 次)"
},
"status": "done",
"created_at": "2026-10-04T19:25:27.943Z"
}
],
"violation_count": 3
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 404 | not_found | 用户不存在或已删除 |
清除用户的违规
删除用户按你的规则记下的全部违规,违规次数相应减少,例如确认他的账号曾被盗用。平台规则的违规保留。已执行的禁言和封禁不会解除,penalties 中的记录也保留。
/{org_name}/{app_name}/moderation/users/{username}/violations路径参数
org_name、app_name 见接入概述。
| 参数 | 类型 | 说明 |
|---|---|---|
username | String | 用户名 |
请求示例
curl -X DELETE "$IM_API/$ORG/$APP/moderation/users/lisi/violations" \
-H "Authorization: Bearer $APP_TOKEN"响应
成功返回 200 OK,removed 为删除的违规记录数:
{
"removed": 6
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 404 | not_found | 用户不存在或已删除 |
查询统计
按天、按场景查询内容安全的统计,以及你的待审核记录的数量。日期按北京时间划分,数字最多落后 5 分钟。
/{org_name}/{app_name}/moderation/stats路径参数
org_name、app_name 见接入概述。
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
from | String | 是 | 开始日期,格式为 2026-10-01 |
to | String | 是 | 结束日期,包含这一天,不能早于 from,与 from 相差最多 89 天(合计 90 天) |
scene | String | 否 | 只查询这个场景,取值见审核的内容和时机 |
请求示例
curl "$IM_API/$ORG/$APP/moderation/stats?from=2026-10-05&to=2026-10-05" \
-H "Authorization: Bearer $APP_TOKEN"响应
成功返回 200 OK:
| 字段 | 类型 | 说明 |
|---|---|---|
days | Array<Object> | 每天每个场景一项:date 日期,scene 场景(举报用户、群、聊天室的为 report),metrics 指标。没有数据的日期和场景不返回,值为 0 的指标不返回 |
pending | Object | 你的待审核记录(pending、auto_violation,不含转交平台的):count 数量,oldest_wait_seconds 最早一条已等待的秒数,没有时为 null |
metrics 中的指标:
| 指标 | 说明 |
|---|---|
checked | 检查的次数 |
rejected、replaced、flagged | 结果为拒绝、替换、送审的次数 |
auto_actioned | 事后审核自动处置的次数 |
provider_calls | 调用第三方审核的次数 |
platform_calls_text、platform_calls_image、platform_calls_audio、platform_calls_video | 其中使用平台账号审核文本、图片、语音、视频的次数 |
cache_hits | 图片、语音、视频命中已有的审核结果、没有调用服务商的次数 |
provider_errors | 调用第三方审核失败的次数 |
timeouts | 同步审核超时的次数 |
quota_skipped | 超出每分钟的事后审核速率或平台账号每天的次数,只按词库检查的次数 |
reports | 举报的次数 |
{
"days": [
{
"date": "2026-10-05",
"metrics": {
"checked": 3,
"rejected": 1,
"replaced": 1,
"reports": 1
},
"scene": "chatroom_message"
},
{
"date": "2026-10-05",
"metrics": {
"checked": 1
},
"scene": "chatroom_profile"
},
{
"date": "2026-10-05",
"metrics": {
"checked": 3,
"rejected": 2,
"replaced": 1
},
"scene": "friend_request"
},
{
"date": "2026-10-05",
"metrics": {
"checked": 1,
"rejected": 1
},
"scene": "group_member"
},
{
"date": "2026-10-05",
"metrics": {
"checked": 3,
"rejected": 1,
"replaced": 1
},
"scene": "group_profile"
},
{
"date": "2026-10-05",
"metrics": {
"checked": 3,
"rejected": 2
},
"scene": "group_request"
},
{
"date": "2026-10-05",
"metrics": {
"auto_actioned": 2,
"checked": 15,
"flagged": 2,
"provider_calls": 8,
"provider_errors": 2,
"rejected": 8,
"replaced": 3,
"reports": 1,
"timeouts": 2
},
"scene": "message"
},
{
"date": "2026-10-05",
"metrics": {
"reports": 5
},
"scene": "report"
},
{
"date": "2026-10-05",
"metrics": {
"checked": 13,
"flagged": 1,
"provider_calls": 2,
"rejected": 4,
"replaced": 2
},
"scene": "user_profile"
}
],
"pending": {
"count": 7,
"oldest_wait_seconds": 1783
}
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 400 | invalid_argument | details.field 为 from 或 to:日期格式不对、to 早于 from 或超过 90 天;为 scene:场景不合法 |
代用户举报
以某个用户的名义提交举报,例如你在自己的网页或客服系统中收集的用户举报。规则与客户端举报相同,包括可见范围的检查,但不受 report_enabled 和按用户的频率限制,改为每个应用每分钟最多 600 次。
/{org_name}/{app_name}/moderation/reports路径参数
org_name、app_name 见接入概述。
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
reporter | String | 是 | 举报人的用户名。按他的可见范围判断能否举报 |
target_type | String | 是 | 举报的对象:message 消息、user 用户、group 群、chatroom 聊天室、chatroom_message 聊天室消息 |
message_id | String | 视对象而定 | 被举报的消息 ID,target_type 为 message、chatroom_message 时必填 |
username | String | 视对象而定 | 被举报的用户名,target_type 为 user 时必填 |
group_id | String | 视对象而定 | 被举报的群 ID,target_type 为 group 时必填 |
room_id | String | 视对象而定 | 聊天室 ID,target_type 为 chatroom、chatroom_message 时必填 |
reason | String | 是 | 举报原因,见举报原因 |
description | String | 否 | 举报说明,最多 500 个字符,不能包含控制字符(可以换行) |
evidence_message_ids | Array<String> | 否 | 证据消息的 ID,最多 5 个,只用于举报用户和群:举报用户时必须是被举报的用户发的,举报群时必须是这个群里的消息,并且都是举报人能看到的 |
请求示例
举报一条消息:
curl -X POST "$IM_API/$ORG/$APP/moderation/reports" \
-H "Authorization: Bearer $APP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"reporter": "lisi",
"target_type": "message",
"message_id": "100311226352926720",
"reason": "fraud",
"description": "冒充兼职,要求先垫付"
}'举报一个用户,附上证据消息:
curl -X POST "$IM_API/$ORG/$APP/moderation/reports" \
-H "Authorization: Bearer $APP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"reporter": "lisi",
"target_type": "user",
"username": "zhangsan",
"reason": "abuse",
"description": "多次辱骂",
"evidence_message_ids": ["100311226034159616"]
}'响应
成功返回 201 Created,响应体为举报对象。这个人已经举报过同一个对象时返回 200 OK 和原来的举报,不重复记录,也不计入频率限制。
{
"report_id": "100312442805944321",
"target_type": "message",
"username": null,
"message_id": "100311226352926720",
"group_id": null,
"room_id": null,
"reason": "fraud",
"status": "pending",
"created_at": "2026-10-04T19:25:50.082Z"
}错误
| HTTP 状态码 | code | 说明 |
|---|---|---|
| 400 | invalid_argument | details.field 为 reporter:没有给出举报人,或举报人不存在 |
| 400 | invalid_argument | details.field 为 target_type、reason、description 或 evidence_message_ids:取值不对,或说明、证据消息超过上限 |
| 400 | invalid_argument | details.reason 为 self_report:举报自己或自己的消息 |
| 400 | invalid_argument | details.reason 为 invalid_evidence:举报消息、聊天室或聊天室消息时附了证据消息;证据消息不存在、举报人看不到、已撤回,不是被举报的用户发的,或不在被举报的群里 |
| 404 | not_found | 举报的对象不存在,或举报人看不到:消息不存在、已撤回或不在举报人的可见范围内;用户不存在或已删除;群不存在、已解散,或是举报人不在其中的私有群;聊天室不存在或已解散;聊天室消息已不在最近的消息中 |
| 429 | rate_limited | 超过每个应用每分钟 600 次的限制,details.reason 为 request_rate |
举报自己的消息时:
{
"error": {
"code": "invalid_argument",
"message": "不能举报自己的消息",
"details": {
"reason": "self_report"
},
"request_id": "N6YRITSEUZQRKK6376PMPGLSXB"
}
}数据结构
审核记录对象
| 字段 | 类型 | 说明 |
|---|---|---|
item_id | String | 审核记录 ID |
queue | String | tenant 你的队列;platform 已转交平台 |
status | String | pending 待审核;auto_violation 已自动处置,等待确认;violation 违规;no_violation 无违规;expired 已结束,原因见 close_reason |
scene | String | 场景,见审核的内容和时机;举报用户、群、聊天室的记录为 report |
target_type | String | 对象的类型:message 消息、chatroom_message 聊天室消息、user_profile 用户资料、group_profile 群资料、group_member 群昵称、group_request 入群申请、friend_request 好友申请、chatroom_profile 聊天室资料、chatroom_attribute 聊天室属性、file 文件、user 被举报的用户、group 被举报的群、chatroom 被举报的聊天室 |
target_id | String | 对象的 ID:消息 ID;聊天室消息为 {聊天室 ID}:{消息 ID};群资料、被举报的群为群 ID;聊天室资料、被举报的聊天室为聊天室 ID;聊天室属性为 {聊天室 ID}:{属性的键};文件为文件 ID。对象涉及用户的(user、user_profile、group_member、group_request、friend_request)为 null,改用下面两项 |
target_username | String | 对象涉及的用户:user、user_profile 为这个用户,group_member 为被修改群昵称的成员,group_request 为申请人或被邀请人,friend_request 为接收申请的人;其他对象和用户已删除时为 null |
target_group_id | String | group_member、group_request 所在的群 ID,其他为 null |
conversation_id | String | 消息所在的会话 ID,不是消息时为 null |
author | String | 作者的用户名:发出这条内容的用户,被举报的用户。你的服务端提交的内容、被举报的群和聊天室没有作者,作者已删除时也为 null |
sources | Array<Object> | 来源,见下表 |
categories | Array<String> | 命中的类别 |
suggestion | String | 机器的建议:block 拦截、review 人工审核;只有举报时为 null |
auto_actions | Array<String> | 已执行的自动处置,如 recall_message、block_file |
report_count | Number | 举报的人数 |
priority | Number | 优先级:0 最高(含平台强制处理的类别,或原因为诈骗、涉政、暴恐、涉及未成年人的举报);1 高(已自动处置,或 3 人以上举报);2 普通 |
decision | Object | 结论,没有结论时为 null。result 为 violation 或 no_violation;by_type 为作出结论的一方:account 控制台成员、app 你的服务端、platform_admin 平台;by 为作出结论的人,控制台成员为姓名和部分隐藏的邮箱,服务端为 App 凭据,平台为 null;note 为说明;decided_at 为时间 |
escalated_at | String | 转交平台的时间,没有转交为 null |
content_available | Boolean | 内容快照是否还在。记录结束 30 天后清空 |
version | Number | 记录的版本号,每次变化加一 |
created_at | String | 创建时间 |
closed_at | String | 结束的时间,未结束为 null |
close_reason | String | 结束的原因:decided 作出了结论;timeout 超过 30 天未处理;escalated 已并入平台的记录;target_deleted 对象已随用户删除。未结束为 null |
actions | Array<Object> | 只在查询审核记录和作出结论的响应中返回:这条记录引起的处置,每项为 action_id、kind 处置的种类、authority(tenant 或 platform)、trigger(auto 自动处置、review 结论、penalty 自动处罚)、status(pending、done、skipped、failed)、last_error 跳过或失败的原因、created_at、done_at |
sources 的每一项,type 为来源的种类:
type | 其他字段 |
|---|---|
word_list | list_id 词库 ID、list_name 词库名称、word 命中的词条、category 类别。平台词库的命中只有 platform(为 true)和 category |
provider | provider 审核服务商,如 aliyun、tencent、netease;labels 为服务商的结果,每项为 category 类别、label 服务商的原始标签、score 分数 |
url_rejected | note:图片的地址不能交给审核服务的原因 |
report | count 举报的次数、reason 举报原因 |
escalation | note:转交平台的说明 |
内容快照
content 的结构随 target_type 不同:
| 对象 | 字段 |
|---|---|
message、chatroom_message | type 消息类型,body、ext 消息内容,created_at 发送时间;edits 为之后编辑过的版本,每项为 body、ext、edited_at;review_urls 为消息中的图片、语音、视频的查看地址 |
file | file_id 文件 ID,kind 类型,name 文件名,review_urls 查看地址 |
user、group、chatroom | profile 为举报时的资料(用户为 nickname、avatar_url;群为 name、avatar_url、description、announcement;聊天室为 name、description、announcement);versions 为之后的资料,每项为 profile、captured_at |
| 其他(资料、群昵称、申请、聊天室属性) | fields 为被审核的字段,每项为 name 字段名、value 当时的值、captured_at 时间。同一个字段之后的值也列在其中 |
消息和资料合计最多保留 5 个版本,超过时保留第一个和最近的 4 个。
review_urls 的每一项:
| 字段 | 类型 | 说明 |
|---|---|---|
source | String | 快照中的原地址 |
url | String | 查看地址。本服务的文件为 10 分钟内有效的下载地址(已被屏蔽的文件也可以查看);被平台规则屏蔽的文件为 null;外部地址就是原地址 |
external | Boolean | 是否为外部地址。打开外部地址时,对方的服务器能看到访问者的 IP,请谨慎在审核人员的浏览器中直接加载 |
举报详情
| 字段 | 类型 | 说明 |
|---|---|---|
report_id | String | 举报 ID |
reporter | String | 举报人的用户名,用户已删除时为 null |
reason | String | 举报原因 |
description | String | 举报说明,没有时为空字符串 |
evidence | Array<Object> | 证据消息,每项为 message_id、conversation_id、sender 发送者、type、body、created_at |
via | String | client 客户端举报,openapi 你的服务端代用户举报 |
created_at | String | 举报的时间 |
处置
结论中 actions 的每一项为 kind 和它的参数。各种对象可以选择的处置:
| 对象 | 可以选择的 kind |
|---|---|
message | recall_message;消息中有本应用的文件时另可 block_file |
chatroom_message | recall_chatroom_message;消息中有本应用的文件时另可 block_file |
file | block_file |
user_profile、group_member、user | clear_profile |
group_profile、group | clear_profile、disable_group |
chatroom_profile、chatroom | clear_profile、disable_chatroom |
chatroom_attribute | remove_chatroom_attribute |
有作者的对象、user | 另可 mute_user、disable_user |
入群申请和好友申请的附言、理由不能清除,只能禁言或封禁作者。
kind | 参数 | 说明 |
|---|---|---|
recall_message | — | 撤回消息,recalled.role 为 server |
recall_chatroom_message | — | 撤回聊天室消息 |
block_file | file_ids:要屏蔽的文件 ID,省略时为消息中全部本应用的文件 | 屏蔽文件,之后下载返回 file_blocked |
clear_profile | fields:要清除的字段名,省略时为快照中的全部字段。被举报的用户为 nickname、avatar_url;被举报的群为 name、description、announcement、avatar_url;被举报的聊天室为 name、description、announcement | 把字段清为空。只在字段仍是当时被审核的值时清除,之后改过的不受影响 |
remove_chatroom_attribute | — | 删除聊天室属性,只在值没有变化时删除 |
mute_user | scopes:必填,chat、group、room 中的一个或多个;duration_seconds:1 到 315360000,省略为永久 | 全局禁言作者 |
disable_user | duration_seconds:同上 | 封禁作者 |
disable_group | — | 封禁群 |
disable_chatroom | — | 封禁聊天室 |
处置都以你的应用的身份执行,与你调用对应接口的效果相同,可以照常解除。对象已不存在或已处于目标状态(如消息已被撤回)的,处置的状态为 skipped。
举报对象
| 字段 | 类型 | 说明 |
|---|---|---|
report_id | String | 举报 ID |
target_type | String | 举报的对象:message、user、group、chatroom、chatroom_message |
username | String | 被举报的用户名,target_type 为 user 时才有,其他为 null;用户已删除时为 null |
message_id | String | 被举报的消息 ID,target_type 为 message、chatroom_message 时才有,其他为 null |
group_id | String | 被举报的群 ID,target_type 为 group 时才有,其他为 null |
room_id | String | 聊天室 ID,target_type 为 chatroom、chatroom_message 时才有,其他为 null |
reason | String | 举报原因,见举报原因 |
status | String | pending 处理中,closed 已处理 |
created_at | String | 举报的时间 |
