Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

createOrganizationMembership()

Creates membership to an organization for a user directly (circumventing the need for an invitation).

const organizationId = 'my-organization-id'; const userId = 'my-user-id'; const role = 'role-to-assign-user'; const organization = await clerkClient.organizations.createOrganizationMembership({organizationId, userId, role});

CreateOrganizationMembershipParams

NameTypeDescription
organizationIdstringThe organization ID of the organization a user is being added to.
userIdstringThe user ID of the user being added to the organization.
role'admin' | 'basic_member' | 'guest_member'The role to assign the added user within the organization.

Last updated on August 16, 2023

What did you think of this content?

Clerk © 2023