Skip to main content

getOrganizationList()

Gets the list of Organizations for the instance. By default, the list is returned in descending order by creation date (newest first).

Returns a PaginatedResourceResponse object with a data property containing an array of Organization objects and a totalCount property containing the total number of Organizations for the instance.

function getOrganizationList(params?: GetOrganizationListParams): Promise<PaginatedResourceResponse<Organization[]>>
  • Name
    includeMembersCount?
    Type
    boolean
    Description

    Whether to include the number of members in the Organization.

  • Name
    limit?
    Type
    number
    Description

    Maximum number of items returned per request. Must be an integer greater than zero and less than 501. Can be used for paginating the results together with offset. Defaults to 10.

  • Name
    offset?
    Type
    number
    Description

    Skip the first offset items when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with limit. Defaults to 0.

  • Name
    orderBy?
    Type
    WithSign<"name" | "created_at" | "members_count">
    Description

    Filters Organizations in a particular order. Prefix a value with + to sort in ascending order, or - to sort in descending order. Defaults to -created_at.

  • Name
    organizationId?
    Type
    string[]
    Description

    Filters Organizations by ID. Accepts up to 100 Organization IDs.

  • Name
    query?
    Type
    string
    Description

    Filters Organizations by ID, name, or slug. Uses exact match for ID and partial match for name and slug.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

const response = await clerkClient.organizations.getOrganizationList()

Limit the number of results

Gets a list of Organizations, limited to the specified number of results.

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

Skip results

Gets a list of Organizations, skipping the specified number of results.

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

Filter by query

Gets a 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 for more information.

Feedback

What did you think of this content?

Last updated on