# Invites

## List Invites

`client.invites.listMine(InviteListMineParamsquery?, RequestOptionsoptions?): PaginatedCursor<Invite>`

**get** `/api/v2/invites`

List the current user's pending invitations, cursor-paginated.

### Parameters

- `query: InviteListMineParams`

  - `page_size?: number | null`

  - `page_token?: string | null`

### Returns

- `Invite`

  A pending invitation visible to the invitee.

  - `id: string`

    The invite's unique identifier.

  - `organization_id: string`

    The organization the user is invited to.

  - `organization_name: string`

    The organization's display name.

  - `role: string`

    The role being granted (e.g. admin, viewer).

  - `created_at?: string | null`

    Creation datetime

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const invite of client.invites.listMine()) {
  console.log(invite.id);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "organization_id": "organization_id",
      "organization_name": "organization_name",
      "role": "role",
      "created_at": "2019-12-27T18:11:19.117Z",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Decline Invite

`client.invites.decline(stringinviteID, RequestOptionsoptions?): void`

**delete** `/api/v2/invites/{invite_id}`

Decline a pending invitation.

### Parameters

- `inviteID: string`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

await client.invites.decline('invite_id');
```

## Accept Invite

`client.invites.accept(stringinviteID, RequestOptionsoptions?): InviteAcceptResponse`

**post** `/api/v2/invites/{invite_id}/accept`

Accept a pending invitation. Returns the joined organization id.

### Parameters

- `inviteID: string`

### Returns

- `InviteAcceptResponse`

  Response for accepting an invitation.

  - `organization_id: string`

    The organization the user just joined.

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.invites.accept('invite_id');

console.log(response.organization_id);
```

#### Response

```json
{
  "organization_id": "organization_id"
}
```

## Domain Types

### Invite

- `Invite`

  A pending invitation visible to the invitee.

  - `id: string`

    The invite's unique identifier.

  - `organization_id: string`

    The organization the user is invited to.

  - `organization_name: string`

    The organization's display name.

  - `role: string`

    The role being granted (e.g. admin, viewer).

  - `created_at?: string | null`

    Creation datetime

  - `updated_at?: string | null`

    Update datetime

### Invite Accept Response

- `InviteAcceptResponse`

  Response for accepting an invitation.

  - `organization_id: string`

    The organization the user just joined.
