Skip to main content

getOrganizationInvitationList()

Gets a list of the given user's Organization invitations. By default, the list is returned in descending order by creation date (newest first).

Returns a PaginatedResourceResponse object with a data property that contains an array of OrganizationInvitation objects, and a totalCount property that indicates the total number of Organization invitations for the user.

function getOrganizationInvitationList(params: GetOrganizationInvitationListParams): Promise<PaginatedResourceResponse<OrganizationInvitation[]>>
  • 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
    status?
    Type
    "pending" | "accepted" | "revoked" | "expired"
    Description

    Filters the invitations by the provided status.

  • Name
    userId
    Type
    string
    Description

    The ID of the user to get the list of Organization invitations for.

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 userId = 'user_123'

const response = await clerkClient.users.getOrganizationInvitationList({ userId })

Filter by invitation status

Gets a list of a user's Organization invitations filtered by invitation status.

const userId = 'user_123'

const { data, totalCount } = await clerkClient.users.getOrganizationInvitationList({
  userId,
  // returns a list of invitations that have not yet been accepted
  status: ['pending'],
})

Limit the number of results

Gets a list of a user's Organization invitations, limited to the specified number of results.

const userId = 'user_123'

const { data, totalCount } = await clerkClient.users.getOrganizationInvitationList({
  userId,
  // returns the first 10 invitations
  limit: 10,
})

Skip results

Gets a list of a user's Organization invitations, skipping the specified number of results.

const userId = 'user_123'

const { data, totalCount } = await clerkClient.users.getOrganizationInvitationList({
  userId,
  // skips the first 10 invitations
  offset: 10,
})

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint GET/users/{user_id}/organization_invitations. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on