Updated on 2026-10-27 GMT+08:00

Querying the API Key List

Function

The query API provides a comprehensive view for API Key asset inventory and security auditing. Administrators can use this API to retrieve a list of all keys associated with the current account, along with their detailed metadata, including creation time, source, permission scope, and current status.

API constraints:

  • Authentication: Requests to this API must include a valid IAM token in the request header (X-Auth-Token) and have the corresponding fine-grained permission: modelarts:apiKey:list for query.

  • Only records that are not deleted are returned. The api_key plaintext is not returned. Only the masked string is returned.

URI

GET /v2/{project_id}/maas/api-auth/api-keys

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Project ID, which uniquely identifies tenant resources in Huawei Cloud and is associated with a specific region. It is used to locate the project space to which the resources belong when calling Huawei Cloud APIs. You can obtain the value by calling the API for obtaining a project ID and name.

Constraints: N/A

Range: N/A

Default Value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition: Offset.

Constraints: The value must be greater than or equal to 0.

Range: The value must be greater than or equal to 0.

Default Value: 0

limit

No

Integer

Definition: Maximum number of records on each page.

Constraints: The minimum value is 1.

Range: an integer greater than or equal to 1.

Default Value: 30.

order

No

String

Definition: Sorting rule of the API key list.

Constraints: N/A

Range:

  • desc: descending order

  • asc: ascending order

Default Value: desc

sort_by

No

String

Definition: Field used for sorting by default.

Constraints: N/A

Range: Fields that exist in the data

Default Value: create_at

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

api_key_list

ListApiKeysRespPage object

Definition: API keys on the current page.

Range: N/A

user_api_key_quota

Integer

Definition: Maximum number of API keys that can be created.

Range: Positive integers

Table 4 ListApiKeysRespPage

Parameter

Type

Description

items

Array of ApiKeyInfo objects

Definition: All existing API keys.

Range: N/A

total

Integer

Definition: Total number of API keys.

Range: An integer greater than or equal to 0.

count

Integer

Definition: Number of current pages.

Range: Integer greater than 0.

default_sort_by

String

Definition: Field used for sorting by default.

Range: empty

default_order

String

Definition: Specifies whether the sorting order is ascending or descending.

Range:

  • desc: descending order

  • asc: ascending order

Table 5 ApiKeyInfo

Parameter

Type

Description

id

String

Definition: Unique ID of an API key.

Range: N/A

api_key

String

Definition: Masked authentication information, which is encrypted using SHA-256 for storage.

Range: N/A

label

String

Definition: API key tag.

Range: The tag can contain 0 to 100 characters, including letters, digits, underscores (_), and hyphens (-).

description

String

Definition: Description of the API key.

Range: a string of up to 100 characters.

mask

String

Definition: Masked authentication information.

Range: N/A

allow_all

Boolean

Definition: Specifies whether access to all resources is allowed. The value can be true (yes) or false (no).

Range:

  • true: Access to all resources is allowed.

  • false: Access to all resources is not allowed.

ip_whitelist

Array of strings

Definition: The API key IP address whitelist is a security feature in Huawei Cloud Model as a Service (MaaS) that restricts the use of an API key to specified IP addresses when calling model services. This helps prevent unauthorized use if the API key is compromised.

Format:

  • Single IP address (e.g., 192.168.1.1);

  • IP address range (e.g., 192.168.1.10-192.168.1.100);

  • CIDR block (e.g., 192.168.10.0/24).

IP address validation rules: Validation of individual IP segments: Each IPv4 octet must be a valid decimal integer between 0 and 255.

IP address format and subnet mask validation:

  • The overall format must match the regular expression for x.x.x.x or x.x.x.x/y.

  • If a subnet mask is specified, its value must be between 0 and 32.

Special rule: The subnet mask prefix length must be greater than or equal to the position of the rightmost 1 bit in the 32-bit binary representation of the IP address (that is, the mask must not truncate the IP address's significant bits).

IP address comparison rule: To compare two IP addresses, compare their numerical values segment by segment from left to right (most significant to least significant) to determine their relative order.

IP range validation: A valid IP range must contain exactly two IP addresses. Both addresses must pass the format and subnet mask validation rules described above, and the starting IP address must be less than or equal to the ending IP address.

resident_model_version_whitelist

ResidentModelVersionWhitelist object

Definition: Whitelist of resident model versions, which restricts the resident model versions that can be accessed.

endpoint_whitelist

EndpointWhitelist object

Definition: Whitelist of endpoints, which restricts the endpoints that can be accessed.

create_at

Integer

Definition: Time when the API key is created. The value is a timestamp, in milliseconds. Example: 1773065452790.

Range: N/A

channel

String

Definition: Channel type, which can be either maas or a channel-specific API key.

Range:

  • maas: Creates an API key for the default MaaS channel.

  • codearts: Creates an API key for the dedicated channel.

Table 6 ResidentModelVersionWhitelist

Parameter

Type

Description

overall

String

Definition: Model service scope (including the model services and their versions) where the API key takes effect.

Range:

  1. all: The API key takes effect for all model services.

  2. Empty string: The API key does not take effect for all model services.

whitelist

Array of Whitelist objects

Definition: Whitelist of resident model versions. Each entry specifies a resident model and its version that can be accessed.

Range: Whitelist object array. For details, see the field breakdown below.

Table 7 Whitelist

Parameter

Type

Description

resident_model_id

String

Definition: Resident model ID. The following uses the Chrome browser as an example to describe how to obtain the resident model ID:

On the Real-Time Inference > Built-in Services page in the MaaS console, press F12 to open DevTools. Choose the Network tab and search for query. Click the entry whose name starts with query?business_type=payment. In the Response tab, search for the desired model name, such as DeepSeek-V4.1-Flash. The value of the resident_model_id parameter is the resident model ID.

Range: N/A

version_whitelist

String

Definition: Whitelisted versions of the resident model that can be accessed. Separate multiple versions with commas (,). The following uses the Chrome browser as an example to describe how to obtain the resident model version name:

On the Real-Time Inference > Built-in Services page in the MaaS console, press F12 to open DevTools. Choose the Network tab and search for query. Click the entry whose name starts with query?business_type=payment. In the Response tab, search for the desired model name, such as DeepSeek-V4.1-Flash. The ID of the data whose version_name is DeepSeek-V4.1-Flash under version_list is the resident model version.

Range: N/A

Table 8 EndpointWhitelist

Parameter

Type

Description

overall

String

Definition: Overall bypass policy.

Range: The value "all" indicates that all requests are allowed to bypass. An empty string indicates that the overall bypass function is disabled.

whitelist

Array of strings

Definition: Whitelist of endpoint IDs. Only the endpoints in the whitelist can be accessed. You can obtain the ID by calling the API for querying endpoints.

Example Requests

GET https://{endpoint}/v2/{project_id}/maas/api-auth/api-keys?offset=0&limit=30&order=desc&sort_by=create_at

Example Responses

Status code: 200

{
  "user_api_key_quota" : 30,
  "api_key_list" : {
    "total" : 19,
    "count" : 10,
    "default_order" : "desc",
    "items" : [ {
      "id" : "145528d0-5afe-468e-80ad-e1091e323fdf",
      "label" : "xsxs",
      "description" : "xsxs",
      "create_at" : 1773065452790,
      "mask" : "pL2v******AhoQ",
      "allow_all" : true,
      "ip_whitelist" : [ ],
      "resident_model_version_whitelist" : {
        "overall" : "",
        "whitelist" : [ {
          "resident_model_id" : "ce15e584-bb43-46ff-a215-febb27501353",
          "version_whitelist" : "all"
        }, {
          "resident_model_id" : "1a848aa4-6493-4da0-bd5a-e1e918fad55f",
          "version_whitelist" : "all"
        } ]
      },
      "endpoint_whitelist" : {
        "overall" : "",
        "whitelist" : [ "d8d76767-637a-4040-8835-39bdc39b79b6", "6a9cba80-3594-4611-a8c0-a5a1fd34985d" ]
      },
      "channel" : "maas"
    }, {
      "id" : "6d088782-609a-4db5-b7c8-a7028858c0c7",
      "label" : "asdfasd",
      "description" : "asfdasdf",
      "create_at" : 1787911404440,
      "mask" : "Q-Kw******KsOg",
      "allow_all" : true,
      "ip_whitelist" : [ ],
      "resident_model_version_whitelist" : {
        "overall" : "",
        "whitelist" : null
      },
      "endpoint_whitelist" : {
        "overall" : "",
        "whitelist" : null
      },
      "channel" : "maas"
    } ]
  }
}

Status Codes

Status Code

Description

200

The API key authentication information list is successfully obtained.

Error Codes

See Error Codes.