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

getOrganizationList()

Retrieves a list of organizations.

function getOrganizationList: (params: GetOrganizationListParams) => Promise<PaginatedResourceResponse<Organization[]>>;

GetOrganizationListParams

NameTypeDescription
limit?numberThe number of results to return. Must be an integer greater than zero and less than 501.
offset?numberThe number of results to skip.
query?stringA search query to filter organizations by.

getOrganizationList() examples

getOrganizationList() with no parameters

In this example, you can see that the returned PaginatedResourceResponse includes data, which is an array of Organization objects, and totalCount, which indicates the total number of organizations in the system.

While the response can return up to 10 data items, for the sake of brevity, only two are shown in this example response.

const response = await clerkClient.organizations. getOrganizationList(); console.log(response); /* { data: [ _Organization { id: 'org_2b6TtF4XlxDsKo6t0E0UyywGB72', name: 'test-org', slug: 'test-org-1705534741', imageUrl: 'https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18yVjdKRFdyclJwRmZFZTlqQUM2dWpSMG8xSlQiLCJyaWQiOiJvcmdfMmI2VHRGNFhseERzS282dDBFMFV5eXdHQjcyIiwiaW5pdGlhbHMiOiJUIn0', hasImage: false, createdBy: 'user_2V7JJKmoA9HqzHhfMqK5cpgLl56', createdAt: 1705534741971, updatedAt: 1705534741971, publicMetadata: {}, privateMetadata: {}, maxAllowedMemberships: 3, adminDeleteEnabled: true, members_count: undefined }, _Organization { id: 'org_2b6DUVo9M3f0WP8jkIQosTalbxK', name: 'Uplevel Digital', slug: 'uplevel-digital', imageUrl: 'https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18yVjdKRFdyclJwRmZFZTlqQUM2dWpSMG8xSlQiLCJyaWQiOiJvcmdfMmI2RFVWbzlNM2YwV1A4amtJUW9zVGFsYnhLIiwiaW5pdGlhbHMiOiJVIn0', hasImage: false, createdBy: 'user_2b6DRqNmAb01uEvSlgSbDXKajtO', createdAt: 1705526650229, updatedAt: 1705526650229, publicMetadata: {}, privateMetadata: {}, maxAllowedMemberships: 3, adminDeleteEnabled: true, members_count: undefined }, ... ], totalCount: 25, } */

getOrganizationList({ limit })

Retrieves organization list that is filtered by the number of results.

const { data, totalCount } = await clerkClient.organizations.getOrganizationList({ // returns the first 10 results limit: 10, });

getOrganizationList({ offset })

Retrieves organization list that is filtered by the number of results to skip.

const { data, totalCount } = await clerkClient.organizations.getOrganizationList({ // skips the first 10 results offset: 10, });

getOrganizationList({ query })

Retrieves list of organizations that match the query.

// returns organizations that have 'test' in their name const { data, totalCount } = await clerkClient.organizations.getOrganizationList({ query: 'test' })

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint GET/organizations. See the BAPI reference(opens in a new tab) for more details.

Last updated on April 1, 2024

What did you think of this content?

Clerk © 2024