Docs

Revoke a session

DELETE
/sessions/{session_id}

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.

Authorization

oauth2 session.delete
headerAuthorizationBearer <token>

Scope: session.delete

Path Parameters

session_id*string

The session_id that createSession (POST /sessions) or exchangeHandoff (POST /sessions/exchange) returns, or that querySessions (POST /sessions/query) lists.

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

Response Body

The session was revoked. Also returned when the session was already absent.

Example Request
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");
Example Response
Empty

Was this helpful?