Docs

updateOrganization()

Updates an Organization.

function updateOrganization(params: UpdateOrganizationParams): Promise<Organization>
  • Name
    organizationId
    Type
    string
    Description

    The organization ID of the organization being updated.

  • Name
    name?
    Type
    string
    Description

    The updated name of the organization.

  • Name
    slug?
    Type
    string
    Description

    The updated slug of the organization.

  • Name
    publicMetadata?
    Type
    {[string]: any}
    Description

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

  • Name
    privateMetadata?
    Type
    {[string]: any}
    Description

    Metadata that is only visible to your Backend API.

  • Name
    maxAllowedMemberships?
    Type
    number
    Description

    The maximum number of memberships allowed in the organization. Setting this value to 0 removes any limit, allowing an unlimited number of memberships.

Example

In the following example, you can see that the returned Organization object has its name property updated to Test Updated.

const organizationId = 'org_123'

const name = 'Test Updated'

const response = await clerkClient.organizations.updateOrganization(organizationId, { name })

console.log(response)
/*
_Organization {
  id: 'org_123',
  name: 'Test Updated',
  slug: 'test',
  imageUrl: 'https://img.clerk.com/eyJ...',
  hasImage: false,
  createdBy: 'user_123',
  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 for more information.

Feedback

What did you think of this content?

Last updated on