Docs

getOrganization()

Retrieves a single Organization.

function getOrganization(params: GetOrganizationParams): Promise<Organization>
  • Name
    organizationId | slug
    Type
    string
    Description

    The ID of the organization to retrieve, or the slug of the organization to retrieve.

const organizationId = 'org_123'

const response = await clerkClient.organizations.getOrganization({ organizationId })

console.log(response)
/*
Organization {
  id: 'org_123',
  name: 'Test',
  slug: 'test',
  imageUrl: 'https://img.clerk.com/eyJ...',
  hasImage: false,
  createdBy: 'user_123',
  createdAt: 1702488558853,
  updatedAt: 1705536009506,
  publicMetadata: {},
  privateMetadata: {},
  maxAllowedMemberships: 3,
  adminDeleteEnabled: true,
  members_count: undefined
}
*/

Retrieve by slug

Retrieve an organization by its slug instead of its ID.

const slug = 'my-organization-slug'

const response = await clerkClient.organizations.getOrganization({ slug })

Backend API (BAPI) endpoint

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

Feedback

What did you think of this content?

Last updated on