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

updateOrganization()

Updates an Organization given a valid organization ID.

function updateOrganization: (params: UpdateOrganizationParams) => Promise<Organization>;

UpdateOrganizationParams

NameTypeDescription
organizationIdstringThe organization ID of the organization being updated.
name?stringThe updated name of the organization.
slug?stringThe updated slug of the organization.
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.

updateOrganization() example

In this example, the name of the organization is updated.

const organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'; const name = 'Test Updated'; const response = await clerkClient.organizations.updateOrganization(organizationId, { name }); console.log(response); /* _Organization { id: 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh', name: 'Test Updated', slug: 'test', imageUrl: 'https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18yVjdKRFdyclJwRmZFZTlqQUM2dWpSMG8xSlQiLCJyaWQiOiJvcmdfMlpVdGJrMnl2bkZHSXRkZXplMWl2Q2gzdXFoIiwiaW5pdGlhbHMiOiJUIn0', hasImage: false, createdBy: 'user_2V7JJKmoA9HqzHhfMqK5cpgLl56', createdAt: 1702488558853, updatedAt: 1705536790529, 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}. See the BAPI reference(opens in a new tab) for more details.

Last updated on August 16, 2023

What did you think of this content?

Clerk © 2024