Help Center/ Content Moderation/ API Reference/ APIs/ Video Moderation/ Creating a Video Moderation Job
Updated on 2024-03-27 GMT+08:00

Creating a Video Moderation Job

Function

This API is used to create a video moderation job. After the job is created, the job ID is returned.

URI

POST /v3/{project_id}/moderation/video/jobs

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token which can be obtained by calling the IAM API (The token is the value of X-Subject-Token in the response header.)

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

data

Yes

data object

Input video data

event_type

Yes

String

Event type. The value is default, which indicates the default event.

image_categories

Yes

Array of strings

Types of risks to be detected in video images. The list cannot be empty.

  • terrorism: terrorism-related content
  • porn: pornographic content
  • image_text: non-compliant image and text content (including advertisements, pornographic content, terrorism-related content, and QR code in images)

audio_categories

No

Array of strings

Types of risks to be detected in the audio of a video. If this parameter is not set or set to null, audio of the video is not moderated. The options are as follows:

  • porn
  • ad
  • moan
  • abuse

callback

No

String

HTTP callback interface. If this field is not null, the callback interface is invoked to notify you of the moderation result.

Table 4 data

Parameter

Mandatory

Type

Description

url

Yes

String

Video URL

frame_interval

No

Integer

Frame capturing interval, in seconds. The value ranges from 1s to 60s. If this parameter is not specified, frames are captured every five seconds by default.

language

No

String

Supported language. The following three languages are available:

  • zh: Chinese
  • en: English
  • ar: Arabic

The default value is zh.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Unique ID of the request, which is used for troubleshooting. You are advised to save the ID.

job_id

String

Unique job ID

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code of a failed API call. For details, see Error Codes.

This parameter is not included when the API is successfully called.

error_msg

String

Error message of a failed API call.

This parameter is not included when the API is successfully called.

Example Request

Create a default video moderation job to detect pornographic and terrorism-related content in images and text.

endpoint is the request URL for calling an API. Endpoints vary depending on services and regions. For details, see Endpoints.

POST https://{endpoint}/v3/{project_id}/moderation/video/jobs
{
  "data" : {
    "url" : "https://xxxx",
    "frame_interval" : 5
  },
  "event_type" : "default",
  "image_categories" : [ "porn","terrorism", "image_text" ],
  "audio_categories" : [ "porn", "ad", "moan", "abuse" ],
  "callback" : "http://xxxx"
}

Example Response

Status code: 200

Example of a successful response

{
  "job_id" : "01661356800_7c0fe871f80543358917e4faebca4a48",
  "request_id" : "07490f57ac5e034c077ab25b5f9e1da5"
}

Status code: 400

Example of a failed response

{
  "error_code" : "AIS.0401",
  "error_msg" : "The input parameter event_type is incorrect."
}

Status Codes

Status Code

Description

200

Response body for a success

400

Response body for a failure