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

getOrganization()

Retrieves a single Organization by the organization ID, if the ID is valid.

function getOrganization: (params: GetOrganizationParams) => Promise<Organization>;

GetOrganizationParams

NameTypeDescription
organizationId | slugstringThe ID of the organization to retrieve, or the slug of the organization to retrieve.

getOrganization() examples

getOrganization({ organizationId })

const organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'; const response = await clerkClient.organizations.getOrganization({ organizationId }); 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: 1705536009506, publicMetadata: {}, privateMetadata: {}, maxAllowedMemberships: 3, adminDeleteEnabled: true, members_count: undefined } */

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

Last updated on August 16, 2023

What did you think of this content?

Clerk © 2024