Cancel an invitation
Deletes a pending, expired or rejected invitation, with its metadata. A
pending invitation's link can no longer be redeemed. An accepted
invitation answers the same opaque 404 as a miss.
Authenticate with a project secret (oauth2) or a console session cookie
(sessionCookie). Cancelling needs the same project admin check as
createGrant (POST /grants). Cookie requests follow that scheme's CSRF
rules.
AuthorizationBearer <token>Scope: project.write
invitation_id*stringThe invitation ID (inv_<opaque>): the id that createInvitation
(POST /invitations) returns or listInvitations (GET /invitations) lists.
^[a-zA-Z0-9_-]+$project_id*stringThe project ID: the id that createProject (POST /projects) returns. zitadel setup prints
it as "Project id" in its summary and as project_id with --json, and
writes it to .env.local as ZITADEL_PROJECT_ID.
^[a-zA-Z0-9_-]+$The invitation was deleted.
import { configureZitadel, getApi } from "@zitadel/api/config";import { setApiCsrfToken } from "@zitadel/api/runtime/auth";// In the browser, through the SDK proxy: the session cookie authenticates the call.const client = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));// A write the session cookie authenticates carries the session's CSRF token.setApiCsrfToken((await client.getMySessionCsrfToken()).csrf_token);await client.cancelInvitation("inv_01JD3B7K2M9P4R6T8V0X2Z4C6E", { project_id: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" });Was this helpful?