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

revokeOrganizationInvitation()

Revokes an organization invitation from a user for the specified organization.

function revokeOrganizationInvitation: (params: RevokeOrganizationInvitationParams) => Promise<OrganizationInvitation>;

RevokeOrganizationInvitationParams

NameTypeDescription
organizationIdstringThe ID of the organization the user was invited to.
invitationIdstringThe ID of the invitation to be revoked.
requestingUserIdstringThe ID of the user revoking the organization invitation.

revokeOrganizationInvitation() example

In this example, you can see that the returned OrganizationInvitation object has a status of 'revoked'.

const organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'; const invitationId = 'orginv_2b6b8BKxYmCdSNYtEBdk2aQSlyY'; const requestingUserId = 'user_2V7JJKmoA9HqzHhfMqK5cpgLl56'; const response = await clerkClient.organizations.revokeOrganizationInvitation({organizationId, invitationId, requestingUserId}); console.log(response); /* _OrganizationInvitation { id: 'orginv_2b6b8BKxYmCdSNYtEBdk2aQSlyY', emailAddress: 'testclerk123@gmail.com', role: 'org:member', organizationId: 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh', createdAt: 1705538313485, updatedAt: 1705538631145, status: 'revoked', publicMetadata: {}, privateMetadata: {} } */

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/organizations/{organization_id}/invitations/{invitation_id}/revoke. 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