āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/clerk/clerk-docs/reference/backend/organization/update-organization-membership-metadata ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
updateOrganizationMembershipMetadata()'
description: Use Clerk's JS Backend SDK to update the metadata associated with a user's organization membership.
sdk: js-backend{/* clerk/javascript file: https://github.com/clerk/javascript/blob/main/packages/backend/src/api/endpoints/OrganizationApi.ts#L214 */}
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>
UpdateOrganizationMembershipMetadataParamsThe ID of the organization this membership belongs to.
userIdstringThe ID of the user that this membership belongs to.
publicMetadata?OrganizationMembershipPublicMetadataMetadata that can be read from both the Frontend API and Backend API{{ target: '_blank' }}, but can be set only from the Backend API.
privateMetadata?OrganizationMembershipPrivateMetadataMetadata that is only visible to your Backend API{{ target: '_blank' }}. </Properties>
const organizationId = 'org_123'
const userId = 'user_123'
const response = await clerkClient.organizations.updateOrganizationMembershipMetadata({
organizationId,
userId,
publicMetadata: {
example: 'this value is updated!',
},
})
This method in the SDK is a wrapper around the BAPI endpoint PATCH/organizations/{organization_id}/memberships/{user_id}/metadata. See the BAPI reference{{ target: '_blank' }} for more information.
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā