Revoke a session
Revokes a session by deleting it, immediately and for good. A later
getSession (GET /sessions/{session_id}) for it answers 404.
It requires the session.delete scope, and is allowed to the session's own
user, to an admin of its project and to the deployment's operators.
End-user sign-out with the session cookie is DELETE /sessions/me
(sessionCookie scheme).
Idempotent: revoking a session that does not exist, or was already revoked,
still returns 204. After revocation, any tokens derived from the session are
invalidated.
oauth2 session.deleteAuthorizationBearer <token>Scope: session.delete
session_id*stringThe session_id that createSession (POST /sessions) or exchangeHandoff (POST /sessions/exchange) returns, or that
querySessions (POST /sessions/query) lists.
^sess_[a-zA-Z0-9_-]+$The session was revoked. Also returned when the session was already absent.
import { createZitadelApi, ZitadelClient } from "@zitadel/api/client";const api = createZitadelApi( new ZitadelClient({ baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080", token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only }),);await api.revokeSession("sess_01J0Z9KX7Y0Q2Y7JX5M9K2YF3C");Was this helpful?