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

Deleting an API Key

Function

The delete API serves as the last line of defense against security threats and the removal of obsolete assets. If an API Key is compromised beyond control or a service is permanently decommissioned, this API can be used to permanently destroy the key. Deletion is irreversible. Once executed, all access permissions associated with the key are immediately and permanently revoked. This mechanism ensures that even if an attacker obtains a copy of the key, it can no longer be used to send valid requests to model services, completely eliminating the path to unauthorized access and establishing a robust security baseline for the platform.

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:delete for deletion.

  • Tenant Isolation: The scope of API operations is determined by the project/domain associated with the current token. The project_id is automatically populated from the authentication context. Cross-tenant operations are not supported.

  • Ensure that the account has a sufficient balance; otherwise, the deletion operation will fail.

URI

DELETE /v1/{project_id}/maas/api-auth/api-keys/{key_id}

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

key_id

Yes

String

Definition: ID of the API key to be deleted. You can obtain the ID by calling the API for querying the API key list.

Constraints: The ID must exist in the domain to which the current user belongs.

Range: N/A

Default Value: N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

result

String

Definition: Operation result flag. The value is fixed at success.

Range: N/A

Status code: 403

Table 3 Response body parameters

Parameter

Type

Description

error_msg

String

Definition: Error message.

Range: N/A

error_code

String

Definition: Error code.

Range: N/A

Example Requests

Delete an API key.

DELETE https://{endpoint}/v1/{project_id}/maas/api-auth/api-keys/fe777039-a2b8-42ff-ac59-194509b8f331

Example Responses

Status code: 200

success

Status code: 403

{
  "error_msg" : "Invalid token.",
  "error_code" : "ModelArts.0104"
}

Status Codes

Status Code

Description

200

Deletion succeeded.

403

The user authentication token is abnormal.

Error Codes

See Error Codes.