Skip to main content

Self-revocation

The self-revoke endpoint lets an API key holder revoke their own key by proving possession of the secret. This is a data plane operation — it does not require admin access.

Prerequisites

A running Talos server. See the quickstart to start one locally.

When to use self-revocation

  • Key compromise — a user discovers their key was leaked and wants to revoke it immediately.
  • User-initiated cleanup — a user decommissions an integration and revokes unused keys.
  • Security automation — an automated system detects anomalous usage and revokes the key.

Self-revoke a key

First, issue a key to get a secret:

export SELF_REVOKE_SECRET=$(talos keys issue "self-revoke-demo" \
--actor user_99 \
--scopes "read:data" \
--format json \
-e "$TALOS_URL" 2>/dev/null | jq -er '.secret')

Send the full key secret as proof of possession:

talos keys self-revoke "$SELF_REVOKE_SECRET" \
--reason key_compromise \
-e "$TALOS_URL"

Verify the key is no longer active:

talos keys verify "$SELF_REVOKE_SECRET" --no-cache -e "$TALOS_URL" || true
echo "Self-revocation confirmed"

The request requires credential (the full API key secret) and optionally reason (revocation reason enum). For the complete field reference, see the SelfRevokeAPIKey API reference.

Only issued and imported API keys can be self-revoked. Derived tokens (JWTs and macaroons) are stateless and cannot be revoked. All revocation reasons except REVOCATION_REASON_PRIVILEGE_WITHDRAWN are allowed — that reason is reserved for admin-initiated revocations.

A successful self-revocation returns an empty response with HTTP status 200 OK. The key is immediately revoked.

Admin vs self-revocation

Admin revocationSelf-revocation
EndpointPOST /v2alpha1/admin/apiKeys/{key_id}:revokePOST /v2alpha1/apiKeys:selfRevoke
PlaneAdminData
AuthenticationRequires admin accessProof of possession (key secret)
IdentifierKey IDKey secret
PRIVILEGE_WITHDRAWNAllowedNot allowed

Next steps