Batch Delete Audio Moderation Words
API Description
1、批量删除账号的音频审核词库词条(敏感词或严禁词),词库为账号级配置,账号下所有频道共用同一份词库
2、管理后台和开放API读写同一份词库,任一入口保存成功后,另一入口查询到相同结果
3、已开通直播音频消音的账号保存词库时,系统将敏感词和严禁词的合集同步到腾讯消音词库,同步成功后删除的词最迟在10分钟内对直播消音生效
4、接口支持https协议
API URL
http://api.polyv.net/live/v4/user/audio-moderation/word/delete
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
The audio moderation feature must be enabled. If not enabled, error code
1041is returned. The API determines the target account based onappIdin the signature and does not accept user IDs or channel numbers.A single batch submission supports up to 2000 words. If any content in the request is non-compliant, the entire batch fails, and the original word list remains unchanged.
Deleting non-existent words in a batch is treated as successful and counted in
notFoundCount. Repeated requests with the same parameters will not accidentally delete other words.Set the request header contentType to application/json. JSON request body parameters are not included in the signature. The signature only uses URL parameters.
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details for obtaining keys |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| 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 stored 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 |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| wordType | true | String | Word type keyword: Delete from sensitive words badword: Delete from prohibited words |
| words | true | Array | Words to delete, up to 2000 |
Example
http://api.polyv.net/live/v4/user/audio-moderation/word/delete?appId=frlr1zazn3&sign=49428741C1D7BEE8BE1EE545F066ECC7×tamp=1677167340447
Request body JSON parameters:
{
"wordType": "badword",
"words": [
"示例严禁词一",
"示例严禁词二"
]
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine the basic response status |
| status | String | Response result, determined by business logic. Returns success on success, error on failure |
| success | Boolean | Whether the response was successful |
| requestId | String | Request ID, a unique UUID generated for each request. Only used for troubleshooting and debugging, not for business logic |
| error | Object | Error information when status code is not 200 See Error parameter description |
| data | Object | Data on successful response See data parameter description |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error reason, e.g., 1041 indicates the account has not enabled audio moderation |
| desc | String | Error description, corresponding to error.code |
data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| wordType | String | Word type for this operation keyword: Sensitive word badword: Prohibited word |
| requestedCount | Integer | Number of words after deduplication in the request |
| deletedCount | Integer | Actual number of words deleted |
| notFoundCount | Integer | Number of words that did not originally exist |
| totalCount | Long | Total number of words in the current category after the operation |
| muteEffectiveWithinMinutes | Integer | Returns the maximum effective minutes (10) when live audio muting is enabled. Not returned when muting is not enabled |
| words | Array | Word details See words parameter description |
words Parameter Description
| Parameter | Type | Description |
|---|---|---|
| word | String | Word content |
| id | Long | Word ID |
| existed | Boolean | Whether the word already existed in the word list at the time of the operation |
Java Request Example
For quick integration of the base code, download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. The 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 testAudioModerationWordDelete() 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/user/audio-moderation/word/delete";
String wordType = "badword";
List<String> words = Arrays.asList("示例严禁词一", "示例严禁词二");
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("wordType", wordType);
jsonMap.put("words", words);
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.71.16771673423081591",
"data": {
"wordType": "badword",
"requestedCount": 2,
"deletedCount": 1,
"notFoundCount": 1,
"totalCount": 180,
"muteEffectiveWithinMinutes": 10,
"words": [
{
"word": "示例严禁词一",
"id": 10001,
"existed": true
},
{
"word": "示例严禁词二",
"id": 10002,
"existed": false
}
]
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 1041,
"desc": "audio moderation is not enabled."
},
"success": false
}
