Delete Caller API Key
DELETE /environments/{env_id}/api_keys/{api_key_id}
DELETE /environments/{env_id}/api_keys/{api_key_id}Interactive request editor loads with JavaScript.
Authorization
BearerAdminToken Organization-scoped admin token. Read operations require a valid token, and write operations require a token with write permission.
In: header
Path Parameters
Environment ID that scopes the request.
uuidCaller API key ID within the environment.
uuidResponse Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X DELETE "$AISIX_CP/environments/$ENV_ID/api_keys/$API_KEY_ID" \ -H "Authorization: Bearer $AISIX_TOKEN"OK
{
"deleted": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}Request body or parameters failed validation.
{
"error": {
"code": "string",
"message": "string"
}
}Missing or invalid bearer.
{
"error": {
"code": "UNAUTHENTICATED",
"message": "no org context"
}
}Authenticated request is not permitted.
{
"error": {
"code": "CUSTOM_KEY_DISABLED",
"message": "custom API key values are disabled for this organization"
}
}Resource not found.
{
"error": {
"code": "NOT_FOUND",
"message": "provider key not found"
}
}Request conflicts with current resource state.
{
"error": {
"code": "CREDENTIAL_IN_USE",
"message": "models still reference this provider_key"
}
}Complete operation details and schema variants
DELETE /environments/{env_id}/api_keys/{api_key_id}
Delete Caller API Key
Deletes the caller credential. Any caller still using the
plaintext bearer receives 401 Unauthorized on subsequent
gateway requests.
Refused with 409 while something resolves an identity to this
key — a passthrough route using it as its anonymous principal,
or a claim mapping that runs verified tokens as it. Repoint or
delete those first. A claim mapping left pointing at a deleted
key would stop resolving, and because matching takes the
highest-priority rule without falling through, it would also
mask a lower-priority rule that still works.
Parameters
env_id(path, string, required): Environment ID that scopes the request.api_key_id(path, string, required): Caller API key ID within the environment.
Responses
-
200: OK -
deleted(boolean, required): Whether the caller API key was deleted. -
id(string, required): Deleted caller API key ID. -
400: Request body or parameters failed validation. -
error(object, required): Error details. -
error.code(string, required): Machine-readable identifier. Examples:UNAUTHENTICATED,INVALID_REQUEST,MASTER_KEY_UNSET,INTERNAL. -
error.message(string, required): Human-readable explanation; safe to surface to operators. -
401: Missing or invalid bearer. Response fields (application/json): identical toDELETE /environments/{env_id}/api_keys/{api_key_id}, response 400 above. -
403: Authenticated request is not permitted. Response fields (application/json): identical toDELETE /environments/{env_id}/api_keys/{api_key_id}, response 400 above. -
404: Resource not found. Response fields (application/json): identical toDELETE /environments/{env_id}/api_keys/{api_key_id}, response 400 above. -
409: Request conflicts with current resource state. Response fields (application/json): identical toDELETE /environments/{env_id}/api_keys/{api_key_id}, response 400 above.
cURL
curl -X DELETE '$AISIX_CP/environments/{env_id}/api_keys/{api_key_id}' -H 'Authorization: Bearer $AISIX_TOKEN'