Skip to main content

updateOrganizationMembershipMetadata()

Updates the metadata for the given Organization membership, by merging existing values with the provided parameters.

A "deep" merge will be performed - "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.

Returns the updated OrganizationMembership.

function updateOrganizationMembershipMetadata(params: UpdateOrganizationMembershipMetadataParams): Promise<OrganizationMembership>
  • Name
    organizationId
    Type
    string
    Description

    The ID of the Organization the membership belongs to.

  • Name
    privateMetadata?
    Type
    OrganizationPrivateMetadata
    Description

    Metadata that can be read and set only from the Backend API.

  • Name
    publicMetadata?
    Type
    OrganizationPublicMetadata
    Description

    Metadata that can be read from the Frontend API and Backend API, but can be set only from the Backend API.

  • Name
    userId
    Type
    string
    Description

    The ID of the user the membership belongs to.

Note

Using clerkClient varies based on the SDK you're using. Refer to the 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