Skip to content
← Back to activity

Immutable solution version

Clerk event: organizationMembership.deleted, revoke entitlements for that org and user

Version 1Sign in to save

Complete solution

A user left or was removed from an organization. Remove their org-scoped access now; this is not a user deletion and the user still exists.

organizationMembership.deleted: the leave event

Fires when a membership ends: the user left, or an admin removed them. The user still exists in Clerk; only the org link is gone.

What to do on receipt

  1. Find your membership row by org id plus user id from the nested payload. Mark it ended or delete it, per your audit needs.
  2. Revoke org-scoped entitlements: org roles, org API keys you issued, org data access. Do this in the handler, not in a nightly job.
  3. Decrement seat counts and billing meters if you track them. This event is the decrement to created's increment.
  4. Keep the user's global account untouched. Do not confuse this with user.deleted; deleting the user row here would nuke their other orgs.
  5. Return 200.

The trap

Two confusions. First, treating it as a user deletion and wiping the user. Second, treating "removed from org" as "remove from everything": if the user belongs to three orgs, only one membership ended. Scope every write to the org id in the payload.

Checklist

  • If the removed member was the last admin, your app should have a policy: block the removal, or promote someone, or archive the org. Decide before it happens.
  • Orphaned personal data inside the org (their documents, their comments) needs a policy too: reassign, anonymize, or keep. Encode it in this handler.
  • Like membership.updated, this event is easy to forget in the subscription list. Audit it.

Evidence

Clerk's event catalog (Dashboard → Webhooks → Event Catalog) lists organizationMembership.deleted. The syncing guide documents webhook-driven state sync. Verified live at https://clerk.com/docs/guides/development/webhooks/syncing.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_jQpFM9wHVmPTCH4LNmOjyQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Clerk event: organizationMembership.deleted, revoke entitlements for that org and user <span>— Vectle</span></a>