Modify Channel Audio Moderation Settings
Updated: 2026-06-26 16:04:48
API Description
1、<p>更新频道音频审核设置</p>
2、(timestamp, appId, channelId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
4、按账号开通版本校验:audioModerationFunctionEnable 为 Y(金融版)或 AI(大模型版)即视为已开通;未开通(N、空或其他值)返回错误码 1041。请求体为合并结构,金融版提交金融版字段、大模型版提交大模型版字段,由服务端按账号版本校验【详见[校验规则](__PLV_KEEP_0__)】
API URL
http://api.polyv.net/live/v4/channel/audio-moderation/update
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See Get Secret Key |
| channelId | true | String | Channel ID |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be saved or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules |
| timestamp | true | String | Current 13-digit millisecond timestamp, valid for 3 minutes |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| badwordEnabled | true | String | Banned words switch, Y/N |
| customRule | false | String | Custom moderation rule (LLM version), max 2000 characters, effective when llmAuditEnabled=Y |
| illegalNotify | false | Object | Violation notification configuration See IllegalNotify Parameter Description |
| llmAuditEnabled | false | String | LLM moderation switch, Y/N (LLM version) |
| moderationEnabled | true | String | Moderation switch Y: Enable N: Disable |
| moderationStrategy | false | String | Moderation strategy (Required for Finance version) easy: Lenient moderation strategy normal: Normal moderation strategy strict: Strict moderation strategy |
IllegalNotify Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| assistantEnabled | false | String | Assistant notification Y: Enable N: Disable |
| monitorEnabled | false | String | Monitor notification Y: Enable N: Disable |
| notifyLevel | false | String | Notification level (LLM version) all: All risk items medium_plus: Medium risk and above high_only: High risk only |
| notifyUrl | false | String | External notification URL (LLM version); empty means external notification is disabled, when set, violation events will be pushed to this URL |
| platformEnabled | false | String | Platform notification Y: Enable N: Disable |
| talentEnabled | false | String | Host notification Y: Enable N: Disable |
Validation Rules
- Account version is determined by audioModerationFunctionEnable: Y=Finance version, AI=LLM version; if not enabled (N, empty, or other values), returns error code 1041.
- Finance version: moderationStrategy is required and must be valid (easy/normal/strict); if missing or invalid, returns error code 30130.
- LLM version: When moderationEnabled=Y, at least one of llmAuditEnabled or badwordEnabled must be Y, otherwise returns error code 30131; moderationStrategy can be omitted, server defaults to easy (not used in LLM version moderation).
- When llmAuditEnabled=Y, customRule is saved as the LLM moderation rule and participates in moderation; when llmAuditEnabled=N, customRule can be retained but does not participate in moderation.
- An empty notifyUrl means external notification is disabled; when notifyUrl has a value, the risk level to push is determined by notifyLevel (notifyLevel is converted to notifyScore for storage: all=0, medium_plus=50, high_only=80).
- When moderationEnabled=N, the system still saves sub-switch configurations, but audio moderation does not take effect.
Example
http://api.polyv.net/live/v4/channel/audio-moderation/update?appId=gga9dadhzm&sign=4D6E18824022FB69A10142E788E2F184&channelId=3775168×tamp=1678088144335
Request body JSON parameters:
Finance version request example:
{
"moderationEnabled": "Y",
"moderationStrategy": "normal",
"badwordEnabled": "N",
"illegalNotify": {
"monitorEnabled": "Y",
"talentEnabled": "Y",
"assistantEnabled": "Y",
"platformEnabled": "Y"
}
}
LLM version request example:
{
"moderationEnabled": "Y",
"llmAuditEnabled": "Y",
"customRule": "禁止主播引导观众添加微信、QQ等社交账号进行私下交易;禁止主播在直播中提及其他竞品平台名称;禁止主播使用攻击性语言。",
"badwordEnabled": "Y",
"illegalNotify": {
"monitorEnabled": "Y",
"talentEnabled": "N",
"assistantEnabled": "Y",
"platformEnabled": "N",
"notifyUrl": "https://example.com/audio-moderation/callback",
"notifyLevel": "medium_plus"
}
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine the basic response status |
| data | Boolean | Data on successful response |
| error | Object | Error information when status code is not 200 See Error Parameter Description |
| requestId | String | Request ID, a unique UUID generated for each request, only for troubleshooting and debugging, should not be tied to business logic |
| status | String | Response result, determined by business logic, returns success on success, error on failure |
| success | Boolean | Whether the response is successful |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error reason |
| desc | String | Error description, corresponding to error.code |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source code project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the download file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 更新频道音频审核设置
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void audioModerationUpdateTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/audio-moderation/update";
String channelId = "";
String badwordEnabled = "";
String illegalNotify = "";
String moderationEnabled = "";
String moderationStrategy = "";
String assistantEnabled = "";
String monitorEnabled = "";
String platformEnabled = "";
String talentEnabled = "";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("channelId", channelId);
jsonMap.put("badwordEnabled", badwordEnabled);
jsonMap.put("illegalNotify", illegalNotify);
jsonMap.put("moderationEnabled", moderationEnabled);
jsonMap.put("moderationStrategy", moderationStrategy);
jsonMap.put("assistantEnabled", assistantEnabled);
jsonMap.put("monitorEnabled", monitorEnabled);
jsonMap.put("platformEnabled", platformEnabled);
jsonMap.put("talentEnabled", talentEnabled);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试更新频道音频审核设置成功:{}", response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success example
{
"code": 200,
"status": "success",
"requestId": "414afeb28f1c4f0ca17e1c3c1e39d247.13959.16780881532635057",
"data": true,
"success": true
}
Error example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
Business Error Code Description
| Error Code | Description |
|---|---|
| 1041 | Account has not enabled audio moderation function (audioModerationFunctionEnable is N, empty, or other values) |
| 30130 | Moderation strategy cannot be empty (Finance version moderationStrategy is missing or invalid) |
| 30131 | Please enable at least LLM moderation or banned words (LLM version: when moderationEnabled=Y, neither llmAuditEnabled nor badwordEnabled is enabled) |
