Skip to main content
Docs

updateOrganizationMembershipMetadata()

Update the metadata attributes of an OrganizationMembership by merging existing values with the provided parameters. Metadata values will be updated via a "deep" merge - "deep" means that any nested JSON objects will be merged as well. You can remove metadata keys at any level by setting their value to null.

function updateOrganizationMembershipMetadata(
  params: UpdateOrganizationMembershipMetadataParams,
): Promise<OrganizationMembership>

Note

Importing clerkClient varies based on your framework. Refer to the Backend SDK overview for usage details, including guidance on how to access the userId and other properties.

const organizationId = 'org_123'

const userId = 'user_123'

const response = await clerkClient.organizations.updateOrganizationMembershipMetadata({
  organizationId,
  userId,
  publicMetadata: {
    example: 'this value is updated!',
  },
})

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint PATCH/organizations/{organization_id}/memberships/{user_id}/metadata. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on