Updated on 2025-07-29 GMT+08:00

Querying Project Tags

Function

This API is used to query all tags of instances in a specified project. Before calling this API:

URI

GET /v3/{project_id}/tags

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition

Index offset. The query starts from the next piece of data indexed by this parameter.

Constraints

The value cannot be a negative number.

Range

≥ 0

Default Value

0

limit

No

Integer

Definition

Number of records to be queried.

Constraints

The value cannot be a negative number.

Range

1–100

Default Value

100

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. To obtain this value, call the IAM API for obtaining a user token.

The value of X-Subject-Token in the response header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Request language type.

Constraints

N/A

Range

  • en-us

  • zh-cn

Default Value

en-us

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Definition

Total number of records.

Range

N/A

tags

Array of ProjectTagItem objects

Definition

Tag list.

Table 5 ProjectTagItem

Parameter

Type

Description

key

String

Definition

Tag key.

Range

It contains a maximum of 36 Unicode characters and cannot be null, an empty string, or a space. It is case-sensitive and can contain digits, letters, underscores (_), and hyphens (-).

values

Array of strings

Definition

Tag value.

Range

It contains a maximum of 43 Unicode characters. It can be an empty string but cannot be a space. It is case-sensitive and can contain digits, letters, underscores (_), periods (.), and hyphens (-).

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

Querying project tags

GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/tags?offset=0&limit=2

Example Response

Status code: 200

Success.

{
  "total_count" : 2,
  "tags" : [ {
    "key" : "key1",
    "values" : [ "value1", "value2" ]
  }, {
    "key" : "key2",
    "values" : [ "value3", "value4" ]
  } ]
}

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.