Skip to main content

updateOrganizationMetadata()

Updates the metadata for the given Organization, 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 Organization.

Tip

If you want to fully replace the existing metadata instead of merging, use replaceOrganizationMetadata().

function updateOrganizationMetadata(organizationId: string, params: { privateMetadata?: OrganizationPrivateMetadata; publicMetadata?: OrganizationPublicMetadata }): Promise<Organization>

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 response = await clerkClient.organizations.updateOrganizationMetadata(organizationId, {
  publicMetadata: {
    example: 'metadata',
  },
})

Backend API (BAPI) endpoint

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

Feedback

What did you think of this content?

Last updated on