POST/organizations/{organization_id}/memberships

Create a new organization membership

Adds a user as a member to the given organization. Only users in the same instance as the organization can be added as members.

This organization will be the user's [active organization] (https://clerk.com/docs/organizations/overview#active-organization) the next time they create a session, presuming they don't explicitly set a different organization as active before then.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 4 body fields
organization_idstringrequired
The ID of the organization where the new membership will be created
user_idstringrequired
The ID of the user that will be added as a member in the organization. The user needs to exist in the same instance as the organization and must not be a member of the given organization already.
rolestringrequired
The role that the new member will have in the organization.
public_metadataobjectoptional
Metadata saved on the organization membership, that is visible to both your frontend and backend.
private_metadataobjectoptional
Metadata saved on the organization membership that is only visible to your backend.

5 status codes
200Success
idstringrequired
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:organization_membership
rolestringrequired
role_namestringoptional
permissionsarray<string>required
public_metadataobjectrequired
Metadata saved on the organization membership, accessible from both Frontend and Backend APIs
private_metadataobjectoptional
Metadata saved on the organization membership, accessible only from the Backend API
organizationobjectrequired
public_user_dataobjectoptional
An organization membership with public user data populated
created_atintegerrequired
Unix timestamp of creation.
updated_atintegerrequired
Unix timestamp of last update.
400Request was not successful
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
403Authorization invalid
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
404Resource not found
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
422Invalid request parameters
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional

Error handling

A 400 is returned: Request was not successful. A 403 is returned: Authorization invalid. A 404 is returned: Resource not found. A 422 is returned: Invalid request parameters.