Updated on 2026-04-03 GMT+08:00

Creating a Vulnerability Scan Task

Function

This API is used to create a vulnerability scan task.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

POST /v5/{project_id}/vulnerability/scan-task

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that an asset belongs to. After the project ID is configured, you can query assets in the project using the project ID. For details about how to obtain it, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 1 to 256 characters.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Definition

Enterprise project ID, which is used to filter assets in different enterprise projects. For details, see Obtaining an Enterprise Project ID.

To query assets in all enterprise projects, set this parameter to all_granted_eps.

Constraints

You need to set this parameter only after the enterprise project function is enabled.

Range

The value can contain 1 to 256 characters.

Default Value

0: default enterprise project.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token, which contains user identity and permissions. The token can be used for identity authentication when an API is called. For details about how to obtain the token, see Obtaining a User Token.

Constraints

N/A

Range

The value can contain 1 to 32,768 characters.

Default Value

N/A

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

manual_scan_type

No

Array of strings

Definition

List of scanned vulnerability types

Constraints

N/A

Range

Minimum value: 1. Maximum value: 200.

Default Value

N/A

batch_flag

No

Boolean

Definition

Whether the scan is a batch operation.

Constraints

N/A

Range

  • true: The scan is a batch operation.

  • false: The scan is not a batch operation.

Default Value

N/A

range_type

No

String

Definition

Scope of servers to be scanned.

Constraints

N/A

Range

  • all_host: Scan all servers. You do not need to set agent_id_list for this type.

  • specific_host: specified servers

Default Value

N/A

agent_id_list

No

Array of strings

Definition

Agent ID list of the servers to be scanned.

Constraints

This parameter is valid only if range_type is set to specific_host.

Range

Minimum value: 1. Maximum value: 200.

Default Value

N/A

urgent_vul_id_list

No

Array of strings

Definition

Scan all ID list of emergency vulnerabilities. If this parameter is not specified, all emergency vulnerabilities are scanned.

Constraints

This parameter is valid only if the value of manual_scan_type contains urgent_vul.

Range

Minimum value: 1. Maximum value: 200.

Default Value

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

task_id

String

Definition

Vulnerability scan task ID.

Range

The value can contain 0 to 32 characters.

Example Requests

Create an emergency vulnerability detection task whose agent_id is 0253edfd-30e7-439d-8f3f-17c54c997064 and vulnerability ID list is urgent_vul_id_list.

POST https://{endpoint}/v5/{project_id}/vulnerability/scan-task?enterprise_project_id=XXX

{
  "manual_scan_type" : [ "urgent_vul" ],
  "batch_flag" : false,
  "range_type" : "specific_host",
  "agent_id_list" : [ "0253edfd-30e7-439d-8f3f-17c54c997064" ],
  "urgent_vul_id_list" : [ "URGENT-CVE-2023-46604", "URGENT-HSSVD-2020-1109", "URGENT-CVE-2022-26134", "URGENT-CVE-2023-22515", "URGENT-CVE-2023-22518", "URGENT-CVE-2023-28432", "URGENT-CVE-2023-37582", "URGENT-CVE-2023-33246", "URGENT-CNVD-2023-02709", "URGENT-CVE-2022-36804", "URGENT-CVE-2022-22965", "URGENT-CVE-2022-25845", "URGENT-CVE-2019-14439", "URGENT-CVE-2020-13933", "URGENT-CVE-2020-26217", "URGENT-CVE-2021-4034", "URGENT-CVE-2021-44228", "URGENT-CVE-2022-0847" ]
}

Example Responses

Status code: 200

Request succeeded.

{
  "task_id" : "d8a12cf7-6a43-4cd6-92b4-aabf1e917"
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.