getInvitationList()
Retrieves a list of all non-revoked invitations for your application, sorted by descending creation date.
function getInvitationList: (params: GetInvitationListParams) => Promise<PaginatedResourceResponse<Invitation[]>>;
GetInvitationListParams
Name | Type | Description |
---|---|---|
status? | accepted | pending | revoked | Filter by invitation status. |
limit? | number | The number of results to return. Must be an integer greater than zero and less than 501. |
offset? | number | The number of results to skip. |
getInvitationList()
examples
getInvitationList()
with no parameters
const response = await clerkClient.invitations.getInvitationList(); console.log(response); /* In this example, you can see that data is an array of Invitation objects, and is populated with only one Invitation. [ data: [ _Invitation { id: 'inv_2b6NfrkHKSU6mSYx2FwX4AtzeFi', emailAddress: 'invite@example.com', publicMetadata: [Object], createdAt: 1705531674576, updatedAt: 1705531674576, status: 'pending', revoked: undefined } ], totalCount: 1 ] */
getInvitationList({ status })
Retrieves list of invitations that have been revoked.
// get all revoked invitations const response = await clerkClient.invitations.getInvitationList({ status: 'revoked' }); console.log(response); /* In this example, you can see that data is an array of Invitation objects, and is populated with only one Invitation. { data: [ _Invitation { id: 'inv_2b6NfrkHKSU6mSYx2FwX4AtzeFi', emailAddress: 'invite@example.com', publicMetadata: [Object], createdAt: 1705531674576, updatedAt: 1705531674576, status: 'pending', revoked: undefined } ], totalCount: 1 } */
getInvitationList({ status, limit })
Retrieves list of invitations that have been revoked that is filtered by the number of results.
const { data, totalCount } = await clerkClient.invitations.getInvitationList({ status: 'revoked', // returns the first 10 results limit: 10 });
getInvitationList({ status, offset })
Retrieves list of invitations that have been revoked that is filtered by the number of results to skip.
const { data, totalCount } = await clerkClient.invitations.getInvitationList({ status: 'revoked', // skips the first 10 results offset: 10 });
Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint GET/invitations
. See the BAPI reference(opens in a new tab) for more details.
Last updated on March 25, 2024