Skip to content

Bulk revoke API keys for a user

POST /api/v1/api-keys/bulk-revoke

POST /maas/api/v1/api-keys/bulk-revoke

Revokes all active API keys for a specific user. Regular users can only bulk revoke their own keys. Admins can bulk revoke any user's keys.

Authorization

Request body

Required.

Content type: application/json

Schema: object

Property Type Required Description
username string Yes

Username whose keys should be revoked

Example:

{
  "username": "alice"
}

Responses

Status Description Response body
200 OK

OK response.

object

application/json

400 Bad Request

Bad Request. Invalid request.

ErrorResponse

application/json

401 Unauthorized

Unauthorized response.

None
403 Forbidden

Forbidden. User trying to revoke another user's keys.

ErrorResponse

application/json

500 Internal Server Error

Internal Server Error

None

200 OK response body

Property Type Required Description
revokedCount integer No

Number of keys that were revoked

message string No

Success message

Example request

curl -X POST "/maas/api/v1/api-keys/bulk-revoke" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "username": "alice"
}'

Example response

200 OK, application/json

{
  "revokedCount": 5,
  "message": "Successfully revoked 5 active API key(s) for user alice"
}