Skip to Content
You are viewing a beta version of Clerk Docs
Visit the latest docs
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

updateOrganizationMetadata()

Updates the metadata associated with the specified organization ID.

function updateOrganizationMetadata: (organizationId: string, params: UpdateOrganizationMetadataParams) => Promise<Organization>;

UpdateOrganizationMetadataParams

NameTypeDescription
organizationIdstringThe ID of the organization to update.
publicMetadata?Record<string, unknown>Metadata saved on the organization, that is visible to both your Frontend and Backend APIs.
privateMetadata?Record<string, unknown>Metadata saved on the organization that is only visible to your Backend API.

updateOrganizationMetadata() example

In this example, you can see that the returned Organization object has its publicMetadata property updated with the new metadata provided.

const organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'; const response = await clerkClient.organizations.updateOrganizationMetadata(organizationId, { publicMetadata:{ "example": "metadata" } }); console.log(response); /* _Organization { id: 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh', name: 'test', slug: 'test', imageUrl: 'https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18yVjdKRFdyclJwRmZFZTlqQUM2dWpSMG8xSlQiLCJyaWQiOiJvcmdfMlpVdGJrMnl2bkZHSXRkZXplMWl2Q2gzdXFoIiwiaW5pdGlhbHMiOiJUIn0', hasImage: false, createdBy: 'user_2V7JJKmoA9HqzHhfMqK5cpgLl56', createdAt: 1702488558853, updatedAt: 1706722339338, publicMetadata: { example: 'metadata' }, privateMetadata: {}, maxAllowedMemberships: 3, adminDeleteEnabled: true, members_count: undefined } */

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(opens in a new tab) for more details.

Last updated on September 6, 2023

What did you think of this content?

Clerk © 2024