Skip to Content
You are viewing a beta version of Clerk Docs
Visit the latest docs
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

deleteOrganizationMembership()

Removes a user from the specified organization.

function getOrganizationList: (params: DeleteOrganizationMembershipParams) => Promise<OrganizationMembership>;

DeleteOrganizationMembershipParams

NameTypeDescription
organizationIdstringThe ID of the organization the user will be removed from.
userIdstringThe user ID to remove from the organization.

deleteOrganizationMembership() example

const organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'; const userId = 'user_2VdArFEn2gfBqt8sRePmsVPyDHv'; const response = await clerkClient.organizations.deleteOrganizationMembership({ organizationId, userId }); console.log(response); /* _OrganizationMembership { id: 'orgmem_2b6TUmlDXlo3e9XPq3Wd9EyfIfj', role: 'org:member', publicMetadata: {}, privateMetadata: {}, createdAt: 1705534546701, updatedAt: 1705534546701, organization: _Organization { id: 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh', name: 'Test Updated', slug: 'test', imageUrl: 'https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18yVjdKRFdyclJwRmZFZTlqQUM2dWpSMG8xSlQiLCJyaWQiOiJvcmdfMlpVdGJrMnl2bkZHSXRkZXplMWl2Q2gzdXFoIiwiaW5pdGlhbHMiOiJUIn0', hasImage: false, createdBy: 'user_2V7JJKmoA9HqzHhfMqK5cpgLl56', createdAt: 1702488558853, updatedAt: 1705536790529, publicMetadata: [Object], privateMetadata: {}, maxAllowedMemberships: 3, adminDeleteEnabled: true, members_count: undefined }, publicUserData: _OrganizationMembershipPublicUserData { identifier: 'testclerk123@gmail.com', firstName: 'test', lastName: 'account', imageUrl: 'https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvb2F1dGhfZ29vZ2xlL2ltZ18yVmRBckFNNWNyRUpxaGdmb3cydVBHZ29US2QifQ', hasImage: true, userId: 'user_2VdArFEn2gfBqt8sRePmsVPyDHv' } } */

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint DELETE/organizations/{organization_id}/memberships/{user_id}. See the BAPI reference(opens in a new tab) for more details.

Last updated on August 16, 2023

What did you think of this content?

Clerk © 2024