Docs

Revoke my consent

DELETE
/users/me/consents/{consent_id}

Revokes one of the signed-in user's consents, by the id that listMyConsents (GET /users/me/consents) lists, and ends every refresh token its client holds for the user.

The client is asked for consent again at its next sign-in. An access token it already holds stays valid until it expires, within minutes. The user's sessions are not touched, and neither is a personal access token the user created through the client.

With project_id, the consent is revoked only when the session belongs to that project. Cookie requests follow the sessionCookie scheme's CSRF rules. Only the person's session revokes a consent: a token issued to a client does not, as it does not end a session either.

Authorization

sessionCookie
cookie__Host-zitadel_session<token>

The session cookie issued at session creation or superseding handoff exchange.

A browser holds it as __Host-zitadel_session, with Secure. Over plain http to a loopback host (localhost, 127.0.0.1, ::1) the server sets it as zitadel_session instead, without Secure or the prefix, so that Safari keeps it, and accepts that name there too; __Host-zitadel_session takes precedence. A program sends __Host-zitadel_session over any transport.

A missing or invalid cookie yields 401 with code auth.unauthorized and the message Missing or invalid session token.

Cross-site request forgery (CSRF) protection: a state-changing request that this cookie authenticates must come from the same origin. A cross-site browser request is refused with 403 and code auth.csrf_invalid. Every such request must also send the session's token from GET /sessions/me/csrf in the X-Zitadel-CSRF header, or it answers the same 403. The only exceptions are the POST …/query reads and POST /invitations/lookup, which need no token. Safe methods (GET) are not checked. A request a project secret authenticates is not affected.

Path Parameters

consent_id*string

The consent ID (consent_<opaque>): the id that listMyConsents (GET /users/me/consents) lists.

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

Query Parameters

project_id?string

The project the caller signs its users in to. The cookie's session is used only when it belongs to this project; a session of any other project answers 403 with sess.project_mismatch.

A session belongs to one project, while a browser sends its cookie to every app on the same host. An app passes its own project, so that a session of another project never reads or acts as one of its users, and signing out of the app never ends it. The SDKs pass it when they read the session or sign out.

sess.project_mismatch does not mean the session is invalid: it is live in its own project, so keep its cookie.

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

Response Body

The consent was revoked and its client's refresh tokens ended.

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.revokeMyConsent("consent_01JD3B7K2M9P4R6T8V0X2Z4C6E");
Example Response
Empty

Was this helpful?