Domain name for API request: vm.tencentcloudapi.com.
This API is used to submit a video file or stream for smart moderation. Before using it, you need to log in to the console with the Tencent Cloud root account to activate VM and adjust the business configuration.
Go to the "CMS console - VM" to activate AMS.
This API is a paid API. For its billing mode, see VM Pricing.
Default API request rate limit: 20 requests/sec. When this limit is exceeded, requests for async moderation tasks (video on demand) will automatically join the queue of requests pending moderation, while an error will be reported for sync moderation tasks (video live streaming).
Default limit on the number of concurrent moderation channels: 10. When this limit is exceeded, requests for async moderation tasks (video on demand) will automatically join the queue of requests pending moderation, while an error will be reported for sync moderation tasks (video live streaming).
A maximum of 500 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: CreateVideoModerationTask. |
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. |
Type | Yes | String | This parameter is used to pass in the task type of a moderation task. Valid values: VIDEO (video on demand), LIVE_VIDEO (video live streaming). |
Tasks.N | Yes | Array of TaskInput | This field indicates the input video 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. |
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.. |
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. Note: by default, audio segments are captured at intervals of 15 seconds, and video frames are captured at intervals of 5 seconds. If you configure the capturing interval, segments will be returned according to the configuration. |
Priority | No | Integer | This parameter is optional and used to pass in the priority of a moderation task. When you have multiple tasks in the queue, you can use this parameter to control their priorities for processing the queue jumping logic. Default value: 0. |
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, which is returned for each request. RequestId is required for locating a problem. |
This example shows you how to create a video moderation task.
POST / HTTP/1.1
Host: vm.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateVideoModerationTask
<Common request parameters>
{
"Type": "VIDEO",
"Tasks": [
{
"DataId": "0a782332-c9db-4cf5-a66e-20d60b4ea469",
"Input": {
"Url": "https://test.myqcloud.com/test.mp4"
}
}
]
}
{
"Response": {
"Results": [
{
"DataId": "0a782332-c9db-4cf5-a66e-20d60b4ea469",
"TaskId": "c933aca1-90d2-4ab8-b045-f1b08069d76f",
"Code": "OK",
"Message": "Success"
}
],
"RequestId": "c933aca1-90d2-4ab8-b045-f1b08069d76f"
}
}
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:
,
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: vm.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateVideoModerationTask
<Common request parameters>
{
"Type": "VIDEO",
"CallbackUrl": "https://apis.example.com/callback/video",
"Seed": "dedb6dcc1cb7c63fde8fa5abfd57",
"Tasks": [
{
"DataId": "test",
"Input": {
"Url": "https://test.myqcloud.com/test.mp4"
}
}
]
}
{
"Response": {
"Results": [
{
"DataId": "test",
"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 | |
UnknownParameter | The parameter is unknown. |
UnsupportedOperation | The operation is not supported. |
Was this page helpful?