getOrganizationInvitationList()
Retrieves a list of organization invitations for a given user. 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 in the system for the specified organization.
function getOrganizationInvitationList(
params: GetOrganizationInvitationListParams,
): Promise<PaginatedResourceResponse<OrganizationInvitation[]>>
- Name
userId
- Type
string
- Description
The ID of the user to retrieve the list of organizations invitations for.
- 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 to10
.
- 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 withlimit
. Defaults to0
.
- Name
status?
- Type
string[]
- Description
The status of the invitation. Possible values:
pending
,accepted
,revoked
,expired
. Defaults topending
.
const userId = 'user_123'
const response = await clerkClient.users.getOrganizationInvitationList({ userId })
Filter by invitation status
Retrieves a list of a user's organization invitations that is filtered by the status of the invitation.
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
Retrieves a list of a user's organization invitations that is filtered by the number of results.
const userId = 'user_123'
const { data, totalCount } = await clerkClient.users.getOrganizationInvitationList({
userId,
// returns the first 10 invitations
limit: 10,
})
Skip results
Retrieves a list of a user's organization invitations that is filtered by the number of results to skip.
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
Last updated on