New Ory Agent Security is now live! Claim your complimentary test drive. Get Started!

Skip to main content

Revoke API Key (self-service)

POST 

/v2alpha1/apiKeys:selfRevoke

Proof-of-possession variant of revocation. The Self* prefix on the request/response messages disambiguates from the admin variants (AdminRevokeIssuedApiKey / AdminRevokeImportedApiKey).

Allows an API key holder to revoke their own non-public issued or imported key by providing the full secret as proof of possession. Active public keys require an admin revocation endpoint and return PermissionDenied (HTTP 403 Forbidden) here. Already-revoked keys return success. JWT and macaroon tokens cannot be self-revoked (they are stateless).

The PRIVILEGE_WITHDRAWN reason is not allowed for self-revocation (admin-only).

POST /v2alpha1/apiKeys:selfRevoke
{
"credential": "sk_live_abc123...",
"reason": "REVOCATION_REASON_KEY_COMPROMISE"
}
SDK ReferenceTypeScript
revokeApiKey(selfRevokeApiKeyRequest)
ParametersTypeRequiredDescription
selfRevokeApiKeyRequestSelfRevokeApiKeyRequestrequiredSelfRevokeApiKeyRequest allows an API key holder to revoke their own key by providing the full key secret as proof of possession.
VariableType
dataobject