createOrganizationMembership()
Creates a membership to an Organization for a user directly (circumventing the need for an invitation).
Returns the newly created OrganizationMembership object.
function createOrganizationMembership(params: CreateOrganizationMembershipParams): Promise<OrganizationMembership>- Name
-
role - Type
- OrganizationCustomRoleKey
- Description
The Role to assign to the user.
In the following example, an OrganizationMembership is created for a user with the Role org:member.
const organizationId = 'org_123'
const userId = 'user_123'
const role = 'org:member'
const response = await clerkClient.organizations.createOrganizationMembership({
organizationId,
userId,
role,
})Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint POST/organizations/{organization_id}/memberships. See the BAPI reference for more information.
Feedback
Last updated on