Help Center/ Host Security Service/ API Reference/ API Description/ Vulnerability Management/ Querying the List of Servers Corresponding to a Vulnerability Scan Task
Updated on 2026-04-03 GMT+08:00

Querying the List of Servers Corresponding to a Vulnerability Scan Task

Function

This API is used to query the list of servers corresponding to 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

GET /v5/{project_id}/vulnerability/scan-task/{task_id}/hosts

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

task_id

Yes

String

Definition

Vulnerability scan task 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.

limit

No

Integer

Definition

Number of records displayed on each page.

Constraints

N/A

Range

Value range: 10-200

Default Value

10

offset

No

Integer

Definition

Offset, which specifies the start position of the record to be returned.

Constraints

N/A

Range

The value range is 0 to 2,000,000.

Default Value

The default value is 0.

scan_status

No

String

Definition

Vulnerability scan task status.

Constraints

N/A

Range

  • scanning: scanning

  • success: The scan succeeded.

  • failed: The scan failed.

Default Value

N/A

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

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_num

Long

Definition

Total number.

Range

The value range is 0 to 2,147,483,647.

data_list

Array of VulScanTaskHostInfo objects

Definition

Indicates the list of servers corresponding to a vulnerability scan task.

Range

The value range is 0 to 2,147,483,647.

Table 5 VulScanTaskHostInfo

Parameter

Type

Description

host_id

String

Definition

Host ID

Range

The value can contain 1 to 128 characters.

host_name

String

Definition

Host Name

Range

The value can contain 0 to 128 characters.

public_ip

String

Definition

Elastic IP Address (EIP)

Range

The value can contain 0 to 128 characters.

private_ip

String

Definition

Private IP Address

Range

The value can contain 0 to 128 characters.

asset_value

String

Definition

Server asset importance.

Range

  • important

  • common

  • test

scan_status

String

Definition

Server scan status.

Range

  • scanning: scanning

  • success: The scan succeeded.

  • failed: The scan failed.

failed_reasons

Array of failed_reasons objects

Definition

List of reasons why vulnerabilities fail to be scanned. (This field is to be deprecated. You are advised to use the vul_scan_details field.)

Range

The value range is 0 to 2,147,483,647.

vul_scan_details

Array of vul_scan_details objects

Definition

Server scan details.

Range

The value range is 0 to 2,147,483,647.

Table 6 failed_reasons

Parameter

Type

Description

vul_type

String

Definition

Types of the vulnerabilities you want to scan.

Range

  • linux_vul: Linux vulnerabilities

  • windows_vul: Windows vulnerabilities

  • web_cms: Web-CMS vulnerabilities

  • app_vul: application vulnerabilities

    • urgent_vul: emergency vulnerabilities

failed_reason

String

Definition

Cause of the scanning failure.

Range

The value can contain 0 to 128 characters.

Table 7 vul_scan_details

Parameter

Type

Description

vul_type

String

Definition

Types of the vulnerabilities you want to scan.

Range

  • linux_vul: Linux vulnerabilities

  • windows_vul: Windows vulnerabilities

  • web_cms: Web-CMS vulnerabilities

  • app_vul: application vulnerabilities

    • urgent_vul: emergency vulnerabilities

status

String

Definition

Vulnerability scan status of the specified type.

Range

  • scanning: scanning

  • success: The scan succeeded.

  • failed: The scan failed.

failed_reason

String

Definition

Reason why a scan failed. This field is available only if a type of vulnerabilities fails to be scanned.

Range

The value contains 0 to 1,024 characters.

scan_vul_list

Array of scan_vul_list objects

Definition

Scanned emergency vulnerability list. This field is available only when the vulnerability type is emergency.

Range

The value range is 0 to 2,147,483,647.

Table 8 scan_vul_list

Parameter

Type

Description

vul_id

String

Definition

Vulnerability ID

Range

The value can contain 0 to 256 characters.

vul_name

String

Definition

Vulnerability name

Range

The value contains 0 to 1,024 characters.

status

String

Definition

Vulnerability scan status.

Range

  • scanning: scanning

  • success: The scan succeeded.

  • failed: The scan failed.

failed_reason

String

Definition

Reason why the vulnerability fails to be scanned. This field is available only for vulnerabilities that fail to be scanned.

Range

The value contains 0 to 1,024 characters.

Example Requests

This API is used to query details of vulnerability scan task whose ID is 2b31ed520xxxxxxebedb6e57xxxxxxxx. The list of failed servers and failure causes are displayed. By default, 10 servers on the first page are queried.

GET https://{endpoint}/v5/{project_id}/vulnerability/scan-task/{task_id}/hosts?offset=0&limit=10&scan_status=failed&enterprise_project_id=XXX

{
  "scan_status" : "failed",
  "task_id" : "2b31ed520xxxxxxebedb6e57xxxxxxxx"
}

Example Responses

Status code: 200

Request succeeded.

{
  "total_num" : 1,
  "data_list" : [ {
    "host_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "host_name" : "ecs-ubuntu-abc123",
    "public_ip" : "112.10.10.3",
    "private_ip" : "192.168.10.1",
    "asset_value" : "important",
    "scan_status" : "failed",
    "failed_reasons" : [ {
      "vul_type" : "linux_vul",
      "failed_reason" : "this_is_failed_reason"
    } ],
    "vul_scan_details" : [ {
      "vul_type" : "linux_vul",
      "status" : "failed",
      "failed_reason" : "this_is_failed_reason"
    }, {
      "vul_type" : "urgent_vul",
      "status" : "scanning",
      "scan_vul_list" : [ {
        "vul_id" : "URGENT-CVE-2024-6387",
        "vul_name" : "OpenSSH Race Condition Vulnerability ( CVE-2024-6387)",
        "status" : "failed",
        "failed_reason" : "this_is_vul_failed_reason"
      }, {
        "vul_id" : "URGENT-CVE-2024-3094",
        "vul_name" : "XZ-Utils 5.6.0-5.6.1 Backdoor Risks (CVE-2024-3094)",
        "status" : "scanning"
      } ]
    } ]
  } ]
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.