--- title: "Revoke an API key" canonical: "https://admiral.io/docs/api/users/ApiKeyAPI_RevokeApiKey" --- # Revoke an API key `POST https://api.admiral.io/v1/users/{user}/apiKeys/{apiKey}/revoke` - NOT_FOUND when the caller has no key with that resource name. Scope: `apikey:write` ### Path parameters - `user` (string, required): The user id. - `apiKey` (string, required): The apiKey id. ### Response 200 Success - `api_key` (ApiKey): The key metadata with updated status. - `id` (string): `key-` and twelve base36 characters. Never changes and is never reused, so it is what a reference to the key holds. Pattern `^key-[0-9a-z]+$`. Read-only. - `name` (string, required): (IMMUTABLE) The name, such as `ci-deploy`. Unique among the owner's keys that can still authenticate, set on create and changed only by RenameApiKey. Lowercase letters, digits and hyphens, starting with a letter and ending with a letter or digit, 1 to 63 characters. It may not have the shape of an id (`key-` and twelve characters). name.not_uid // an API key name may not have the shape of an id Pattern `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. Length 1 to 63. - `display_name` (string): A label for people, such as "CI deploy". Optional; clients show the name when it is unset. Length at most 128. - `resource_name` (string): (IDENTIFIER) The resource name, such as `users/usr-01j9t5b6c3h1/apiKeys/ci-deploy`. Its parent says whose key it is. Built from the key's name, so it changes when the key is renamed; refer to a key by `id` to keep a reference stable. Identifies the key on update. Pattern `^users/(usr-[0-9a-z]+|-)/apiKeys/[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. - `owner_id` (string): The `usr-` id of the user who owns the key, the same user its resource name's parent names. Access tokens minted from the key act as this user. Pattern `^usr-[0-9a-z]+$`. Read-only. - `scopes` (array of string): The scopes granted to this key, and the ceiling on any access token minted from it. Must be a subset of the caller's own scopes. Items at most 255. - `expires_at` (Timestamp): (IMMUTABLE) When the key expires. Unset never expires. Fixed at creation; organization policy may cap it. - `status` (ApiKeyStatus): ApiKeyStatus represents the lifecycle state of an API key. One of `API_KEY_STATUS_UNSPECIFIED`, `ACTIVE`, `REVOKED`. Read-only. - `last_used_at` (Timestamp): When the key was last exchanged for an access token. Minted tokens are reused for their lifetime, so this reads as "still in use" at that granularity, not as the time of the last request. Read-only. - `revoked_at` (Timestamp): Set when the key was revoked. Read-only. - `etag` (string): Changes whenever the key does. Send it back on update or rename to refuse the change if someone else changed the key first. Read-only. - `created_by` (ActorRef): ActorRef is a lightweight reference to the user or agent that performed an action. Server-populated on all resource responses. Clients should never send this. Read-only. - `id` (string): The actor's typed id: a `usr-` user id or an `sa-` service account id. - `display_name` (string): Human-readable name (e.g., "John Smith", "deploy-bot"). - `email` (string): Email address (empty for non-human actors). - `created_at` (Timestamp): A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC. Read-only. - `updated_at` (Timestamp): A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC. Read-only.