Skip to main content

getOrganizationMembershipList()

Gets the list of Organization memberships for the specified Organization. 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 OrganizationMembership objects and a totalCount property containing the total number of Organization memberships for the Organization.

Tip

To get the list of Organization memberships for your instance, use getInstanceOrganizationMembershipList().

function getOrganizationMembershipList(params: GetOrganizationMembershipListParams): Promise<PaginatedResourceResponse<OrganizationMembership[]>>
  • Name
    createdAtAfter?
    Type
    number
    Description

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

  • Name
    createdAtBefore?
    Type
    number
    Description

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

  • Name
    emailAddress?
    Type
    string[]
    Description

    Filters Organization memberships by email address. Accepts up to 100 email addresses.

  • Name
    emailAddressQuery?
    Type
    string
    Description

    Filters Organization memberships by email address. Accepts up to 100 email addresses. Partial matches supported. For example, emailAddressQuery=ello will match a user with the email HELLO@example.com.

  • Name
    lastActiveAtAfter?
    Type
    number
    Description

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

  • Name
    lastActiveAtBefore?
    Type
    number
    Description

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

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

    Filters Organization memberships by name. Accepts up to 100 names. Partial matches supported. For example, nameQuery=John Doe will match a user with the name John Doe.

  • 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<"phone_number" | "email_address" | "created_at" | "first_name" | "last_name" | "username">
    Description

    Filters Organization memberships 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

    The ID of the Organization to get the list of memberships for.

  • Name
    phoneNumber?
    Type
    string[]
    Description

    Filters Organization memberships by phone number. Accepts up to 100 phone numbers.

  • Name
    phoneNumberQuery?
    Type
    string
    Description

    Filters Organization memberships by phone number. Accepts up to 100 phone numbers. Partial matches supported. For example, phoneNumberQuery=555 will match a user with the phone number +1555xxxxxxx.

  • Name
    query?
    Type
    string
    Description

    Filters Organization memberships matching the given query across email addresses, phone numbers, usernames, Web3 wallet addresses, user IDs, first names, and last names. Partial matches supported. For example, query=hello will match a user with the email HELLO@example.com.

  • Name
    role?
    Type
    OrganizationCustomRoleKey[]
    Description

    Filters Organization memberships by Role. Accepts up to 100 Roles.

  • Name
    userId?
    Type
    string[]
    Description

    Filters Organization memberships by user ID. Accepts up to 100 user IDs.

  • Name
    username?
    Type
    string[]
    Description

    Filters Organization memberships by username. Accepts up to 100 usernames.

  • Name
    usernameQuery?
    Type
    string
    Description

    Filters Organization memberships by username. Accepts up to 100 usernames. Partial matches supported. For example, usernameQuery=CoolUser will match a user with the username SomeCoolUser.

  • Name
    web3Wallet?
    Type
    string[]
    Description

    Filters Organization memberships by web3 wallet address. Accepts up to 100 web3 wallet addresses.

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 organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'

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

getOrganizationMembershipList({ organizationId, limit })

Gets a list of Organization memberships, limited to the specified 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 })

Gets a list of Organization memberships, skipping the specified number of results.

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