Domain name for API request: ams.intl.tencentcloudapi.com.
This API is used to submit audio content (such as an audio file or stream URL) for smart moderation. Before using it, you need to log in to the console with the Tencent Cloud root account to activate AMS and adjust the business configuration.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: CreateAudioModerationTask. |
Version | Yes | String | Common Params. The value used for this API: 2020-12-29. |
Region | No | String | Common Params. This parameter is not required for this API. |
Tasks.N | Yes | Array of TaskInput | This field indicates the input audio moderation task information. For the specific input content, see the detailed description of the TaskInput data structure.Note: you can create up to 10 tasks at a time. |
BizType | No | String | This field indicates the specific number of the policy, which is used for API scheduling and can be configured in the CMS console. If the Biztype parameter is passed in, a moderation policy will be used based on the business scenario; otherwise, the default moderation policy will be used.Note: Biztype can contain 3–32 digits, letters, and underscores; different Biztype values are associated with different business scenarios and moderation policies, so you need to verify the Biztype before calling this API. |
Type | No | String | This field indicates the input audio moderation type. Valid values: AUDIO (audio on demand), LIVE_AUDIO (audio live streaming). Default value: AUDIO. |
Seed | No | String | This field is optional and indicates the key information of the callback signature, which is used to ensure the data security. The signature algorithm is to add the X-Signature field to the returned HTTP header, whose value is the SHA256-encoded hex string of seed + body . After receiving the callback data, you can calculate X-Signature by using sha256(seed + body) based on the returned body for verification.For specific use cases, see Signature Algorithm v3. |
CallbackUrl | No | String | This field is optional and indicates the address for receiving the moderation information callback in the default format of URL. After it is configured successfully, the non-compliant audio/video segments generated during moderation will be sent through this API. For the format of the returned callback content, see Sample Callback Signature |
Parameter Name | Type | Description |
---|---|---|
Results | Array of TaskResult | This field is used to return the task creation result. For the specific output content, see the detailed description of the TaskResult data structure.Note: this field may return null, indicating that no valid values can be obtained. |
RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
If you configure Seed
when creating a moderation task, we will add the signature parameter to the callback to ensure the data security.
Signature algorithm: add the X-Signature
field to the returned HTTP header, whose value is the SHA256-encoded hex string of seed
+ body
.
For example:
If your CallbackUrl
is http://example.com
and Seed
is dedb6dcc1cb7c63fde8fa5abfd57
, and the returned callback data is:{"TaskId": "task-video-X0zpcRUMzVidxj20","DataId":"test","Suggestion": "Block"}
,
Then, after completing the moderation, we will pass in X-Signature
with the following value in the HTTP header when calling http://example.com
:74f0ae6d1f1e4eb1ffe4162da480a812f8a4dc19fe5a52bacbcd2c862d3edcfd
Note: for the callback body format, see the API for task details query.
POST / HTTP/1.1
Host: ams.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAudioModerationTask
<Common request parameters>
{
"Type": "AUDIO",
"CallbackUrl": "https://apis.example.com/callback/audio",
"Seed": "dedb6dcc1cb7c63fde8fa5abfd57",
"Tasks": [
{
"DataId": "test",
"Input": {
"Url": "https://test.myqcloud.com/test.mp3"
}
}
]
}
{
"Response": {
"Results": [
{
"DataId": "test",
"TaskId": "c933aca1-90d2-4ab8-b045-f1b08069d76f",
"Code": "OK",
"Message": "Success"
}
],
"RequestId": "c933aca1-90d2-4ab8-b045-f1b08069d76f"
}
}
This example shows you how to create an audio moderation task.
POST / HTTP/1.1
Host: ams.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAudioModerationTask
<Common request parameters>
{
"Type": "AUDIO",
"Tasks": [
{
"DataId": "0a782332-c9db-4cf5-a66e-20d60b4ea469",
"Input": {
"Url": "https://test.myqcloud.com/test.mp3"
}
}
]
}
{
"Response": {
"Results": [
{
"DataId": "0a782332-c9db-4cf5-a66e-20d60b4ea469",
"TaskId": "c933aca1-90d2-4ab8-b045-f1b08069d76f",
"Code": "OK",
"Message": "Success"
}
],
"RequestId": "c933aca1-90d2-4ab8-b045-f1b08069d76f"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
DryRunOperation | DryRun Operation. It means that the request would have succeeded, but the DryRun parameter was used. |
FailedOperation | The operation failed. |
InternalError | An internal error occurred. |
InvalidParameter | The parameter is incorrect. |
InvalidParameterValue | The parameter value is incorrect. |
LimitExceeded | The quota limit is exceeded. |
MissingParameter | The parameter is missing. |
OperationDenied | The operation was denied. |
RequestLimitExceeded | The number of requests exceeds the frequency limit. |
ResourceInUse | The resource is in use. |
ResourceInsufficient | The resource is insufficient. |
ResourceNotFound | The resource does not exist. |
ResourceUnavailable | The resource is unavailable. |
ResourcesSoldOut | The resources have been sold out. |
UnauthorizedOperation | The operation is unauthorized. |
UnauthorizedOperation.Unauthorized | Operation not authorized/Invalid package/Account overdue |
UnknownParameter | The parameter is unknown. |
UnsupportedOperation | The operation is not supported. |
本页内容是否解决了您的问题?