Direct member provisioning
An administrator provisions a known user into an organization immediately.
Clerk · Module
Creates an organization membership directly for a user, without an invitation. It returns the newly created OrganizationMembership.
Pass the target organization ID, user ID, and role to the Clerk backend client. The method creates the relationship immediately rather than using an invitation, then resolves with the resulting membership object.
function createOrganizationMembership(params: CreateOrganizationMembershipParams): Promise<OrganizationMembership>| Name | Type | Description |
|---|---|---|
organizationId | string | The ID of the Organization the user is being added to. |
role | OrganizationCustomRoleKey | The Role to assign to the user. |
userId | string | The ID of the user to be added to the Organization. |
Promise<OrganizationMembership>
organizationId identifies where the user will be added.role determines the user's organization role.userId selects the user who receives the membership.const organizationId = 'org_123'
const userId = 'user_123'
const role = 'org:member'
const response = await clerkClient.organizations.createOrganizationMembership({
organizationId,
userId,
role,
})Creates a membership directly for an existing user in an organization.
An administrator provisions a known user into an organization immediately.
A backend workflow assigns a Clerk organization role while adding a user.
An internal automation synchronizes membership state from another system.
Call clerkClient.organizations.createOrganizationMembership() with organizationId, userId, and role. It returns a Promise resolving to the newly created OrganizationMembership.
Follow-up: What API operation does the SDK method wrap? It wraps the BAPI POST operation for /organizations/{organization_id}/memberships.
The organization is identified by organizationId, the member by userId, and the assigned role by role. The role uses the OrganizationCustomRoleKey type.
Follow-up: What should be checked before calling it? Confirm that the IDs identify the intended organization and user, and that the role is valid for the application.
Unlike an invitation-based workflow, this method creates the membership directly for the specified user. The returned value is an OrganizationMembership object.
Follow-up: When would an invitation be preferable? Use an invitation flow when the person should accept or join through an invitation rather than being added immediately.
OrganizationMembershipclerkClientCreateOrganizationMembershipParamsorganizations.createOrganizationorganizations.getOrganizationMemberships