Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Clerk · Module

organizations.createOrganizationMembership

Creates an organization membership directly for a user, without an invitation. It returns the newly created OrganizationMembership.

How it works

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.

Syntax

function createOrganizationMembership(params: CreateOrganizationMembershipParams): Promise<OrganizationMembership>

Parameters

NameTypeDescription
organizationIdstringThe ID of the Organization the user is being added to.
roleOrganizationCustomRoleKeyThe Role to assign to the user.
userIdstringThe ID of the user to be added to the Organization.

Returns

Promise<OrganizationMembership>

Key points

  • The method immediately establishes membership for the selected user and organization.
  • The resolved result is the membership resource created by the operation.
  • organizationId identifies where the user will be added.
  • role determines the user's organization role.
  • userId selects the user who receives the membership.
  • The SDK method delegates to Clerk's backend API operation.

Common mistakes

  • This operation adds the user immediately; it is not an invitation flow.
  • The way to obtain or configure clerkClient depends on the SDK in use.

Example: Create an organization 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.

When to use it

Direct member provisioning

An administrator provisions a known user into an organization immediately.

Role assignment during onboarding

A backend workflow assigns a Clerk organization role while adding a user.

Membership synchronization

An internal automation synchronizes membership state from another system.

Interview questions

QHow do you create a direct organization membership?

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.

QWhat parameters does the method require?

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.

QHow does this differ from inviting a user?

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.

  • OrganizationMembership
  • clerkClient
  • CreateOrganizationMembershipParams
  • organizations.createOrganization
  • organizations.getOrganizationMemberships

Source: createOrganizationMembership() - Organizations. Checked 2026-10-15.