Skip to main content
Docs

getOrganizationMembershipList()

Retrieves a list of memberships for an organization. Returns a PaginatedResourceResponse object with a data property that contains an array of OrganizationMembership objects, and a totalCount property that indicates the total number of organization memberships in the system for the specified organization.

function getOrganizationMembershipList(
  params: GetOrganizationMembershipListParams,
): Promise<PaginatedResourceResponse<OrganizationMembership[]>>
  • Name
    organizationId
    Type
    string
    Description

    The ID of the organization to retrieve the list of memberships from.

  • Name
    limit?
    Type
    number
    Description

    The number of results to return. 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 results 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
    'phone_number' | 'email_address' | 'created_at' | 'first_name' | 'last_name' | 'username'
    Description

    Return memberships in a particular order. Prefix with a - to reverse the order. Prefix with a + to list in ascending order. Defaults to '-created_at'.

Note

Importing clerkClient varies based on your framework. Refer to the Backend SDK overview for usage details, including guidance on how to access the userId and other properties.

const organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'

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

getOrganizationMembershipList({ organizationId, limit })

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

const organizationId = 'org_123'

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

getOrganizationMembershipList({ organizationId, offset })

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

const organizationId = 'org_123'

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

Backend API (BAPI) endpoint

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

Feedback

What did you think of this content?

Last updated on