Docs

Delete user by ID

DELETE
/users/{user_id}

Deletes a user, removes them from every team they belong to, and revokes every grant they hold, on any project.

The user is removed, not deactivated, and the deletion emits user.deleted, plus authz.revoked for each grant on that grant's project. With a project secret the request is idempotent: deleting a user that exists in no project succeeds without changing anything. Deleting the last active member of a project's owning team returns 409 proj.last_owner and changes nothing.

Authorization

headerAuthorizationBearer <token>

Scope: user.delete

Path Parameters

user_id*string

The unique identifier of the user.

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

Response Body

User deleted successfully.

Example Request
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.deleteUserByID("user_01KWH3B72K7M7F0N9WD3P2E4YM");
Example Response
Empty

Was this helpful?