Skip to Content
You are viewing a beta version of Clerk Docs
Visit the latest docs
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

getOrganizationInvitationList()

Retrieves a list of organization invitations that have not yet been accepted.

function getOrganizationInvitationList: (params: GetOrganizationInvitationListParams) => Promise<PaginatedResourceResponse<OrganizationInvitation[]>>;

GetOrganizationInvitationListParams

NameTypeDescription
organizationIdstringThe ID of the organization to retrieve the list of pending invitations from.
limit?numberThe number of results to return. Must be an integer greater than zero and less than 501.
offset?numberThe number of results to skip.

getOrganizationInvitationList() examples

getOrganizationInvitationList({ organizationId})

In this example, you can see that the returned PaginatedResourceResponse includes data, which is an array of OrganizationInvitation objects, and totalCount, which indicates the total number of organization invitations in the system for the specified organization.

const organizationId = 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh'; const response = await clerkClient.organizations.getOrganizationInvitationList({ organizationId }); console.log(response); /* { data: [ _OrganizationInvitation { id: 'orginv_2b6b8BKxYmCdSNYtEBdk2aQSlyY', emailAddress: 'testclerk123@gmail.com', role: 'org:member', organizationId: 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh', createdAt: 1705538313485, updatedAt: 1705538313485, status: 'pending', publicMetadata: {}, privateMetadata: {} }, _OrganizationInvitation { id: 'orginv_2b6SO8VwBMDn2IMYn0xqiaSxVpN', emailAddress: 'testclerk123@clerk.dev', role: 'org:member', organizationId: 'org_2ZUtbk2yvnFGItdeze1ivCh3uqh', createdAt: 1705534000014, updatedAt: 1705534817946, status: 'revoked', publicMetadata: {}, privateMetadata: {} } ], totalCount: 2 } */

getOrganizationInvitationList({ organizationId, status })

Retrieves organization invitation list that is filtered by the status of the invitation.

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

getOrganizationInvitationList({ organizationId, limit })

Retrieves organization invitation list that is filtered by the number of results.

const organizationId = 'org_123'; const { data, totalCount } = await clerkClient.organizations.getOrganizationInvitationList({ organizationId, // returns the first 10 results limit: 10, });

getOrganizationInvitationList({ organizationId, offset })

Retrieves organization invitation list that is filtered by the number of results to skip.

const organizationId = 'my-organization-id'; const { data, totalCount } = await clerkClient.organizations.getOrganizationInvitationList({ organizationId, // skips the first 10 results offset: 10, });

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint GET/organizations/{organization_id}/invitations. See the BAPI reference(opens in a new tab) for more details.

What did you think of this content?

Clerk © 2024