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
    createdAtAfter?
    Type
    number
    Description

    Filters memberships who have been created after the given date (with millisecond precision). For example, use 1730160000000 to retrieve memberships who have been created after 2024-10-29.

  • Name
    createdAtBefore?
    Type
    number
    Description

    Filters memberships who have been created before the given date (with millisecond precision). For example, use 1730160000000 to retrieve memberships who have been created before 2024-10-29.

  • Name
    emailAddress?
    Type
    string[]
    Description

    Filters memberships for the email addresses specified. Accepts up to 100 email addresses. Any email addresses not found are ignored.

  • Name
    emailAddressQuery?
    Type
    string
    Description

    Filters memberships with emails that match the given query, via case-insensitive partial match. For example, email_address_query=ello will match a membership with the email HELLO@example.com.

  • Name
    lastActiveAtAfter?
    Type
    number
    Description

    Filters memberships whose last session activity was after the given date (with millisecond precision). For example, use 1700690400000 to retrieve memberships whose last session activity was after 2023-11-23.

  • Name
    lastActiveAtBefore?
    Type
    number
    Description

    Filters memberships whose last session activity was before the given date (with millisecond precision). For example, use 1700690400000 to retrieve memberships whose last session activity was before 2023-11-23.

  • 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
    nameQuery?
    Type
    string
    Description

    Filters memberships with names that match the given query, via case-insensitive partial match.

  • 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'.

  • Name
    organizationId
    Type
    string
    Description

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

  • Name
    phoneNumber?
    Type
    string[]
    Description

    Filters memberships for the phone numbers specified. Accepts up to 100 phone numbers. Any phone numbers not found are ignored.

  • Name
    phoneNumberQuery?
    Type
    string
    Description

    Filters memberships with phone numbers that match the given query, via case-insensitive partial match. For example, phone_number_query=555 will match a membership with the phone number +1555xxxxxxx.

  • Name
    query?
    Type
    string
    Description

    Filters memberships that match the given query. For possible matches, we check the email addresses, phone numbers, usernames, Web3 wallet addresses, user IDs, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well.

  • Name
    role?
    Type
    string[]
    Description

    Filters memberships for the roles specified. Accepts up to 100 roles. Any roles not found are ignored.

  • Name
    userId?
    Type
    string[]
    Description

    Filters memberships for the user IDs specified. For each user ID, the + and - can be prepended to the ID, which denote whether the respective user ID should be included or excluded from the result set. Accepts up to 100 user IDs. Any user IDs not found are ignored.

  • Name
    username?
    Type
    string[]
    Description

    Filters memberships for the usernames specified. Accepts up to 100 usernames. Any usernames not found are ignored.

  • Name
    usernameQuery?
    Type
    string
    Description

    Filters memberships with usernames that match the given query, via case-insensitive partial match. For example, username_query=CoolUser will match a membership with the username SomeCoolUser.

  • Name
    web3Wallet?
    Type
    string[]
    Description

    Filters memberships for the Web3 wallet addresses specified. Accepts up to 100 Web3 wallet addresses. Any Web3 wallet addresses not found are ignored.

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