Docs

Revoke my personal access token

DELETE
/users/me/personal_access_tokens/{personal_access_token_id}

Revokes one of the caller's personal access tokens by deleting its record, so the token is refused from the next call on.

Authenticate with a console session cookie, an access token issued for the person, or one of their personal access tokens, the one revoked included; a token needs the scope personal_access_token.delete. A token that is not the caller's answers 404, as one that does not exist. Records an auth.token.revoked event. Cookie requests follow that scheme's CSRF rules.

Authorization

headerAuthorizationBearer <token>

Scope: personal_access_token.delete

Path Parameters

personal_access_token_id*string

The personal access token's ID (tkn_<opaque>): the id that createMyPersonalAccessToken (POST /users/me/personal_access_tokens) returns or listMyPersonalAccessTokens lists.

Match^tkn_[a-zA-Z0-9_-]+$

Response Body

The token was revoked.

Example Request
import { createZitadelApi } from "@zitadel/api/client";import { configureZitadel, getApi } from "@zitadel/api/config";// In the browser, through the SDK proxy: the session cookie authenticates the call.const session = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));// A write the session cookie authenticates carries the session's CSRF token.const { csrf_token } = await session.getMySessionCsrfToken();const api = createZitadelApi(  session.client.with({    fetch: (input, init) => {      const headers = new Headers(init?.headers);      headers.set("X-Zitadel-CSRF", csrf_token);      return fetch(input, { ...init, headers });    },  }),);await api.revokeMyPersonalAccessToken("tkn_01JD3B7K2M9P4R6T8V0X2Z4C6E");
Example Response
Empty

Was this helpful?