> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> API reference for Daffy: every `daffy.api.*` operation with input and output types.

Every `daffy.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).

## Accounts

### cancelDonation

`accounts.cancelDonation`

Cancel a pending donation owned by the API key holder.

**Risk:** `destructive`

```ts theme={null}
await corsair.daffy.api.accounts.cancelDonation({ donationId: 1234 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `donationId` | `number` | Yes | — |

**Output:** *empty object*

***

### createDonation

`accounts.createDonation`

Create a donation to a nonprofit (minimum \$10 USD).

**Risk:** `write`

```ts theme={null}
await corsair.daffy.api.accounts.createDonation({ amount: 25, ein: '941156258', note: 'love what they do!' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `amount` | `number` | Yes | — |
| `ein` | `string` | Yes | — |
| `note` | `string` | No | — |
| `privateMemo` | `string` | No | — |
| `userId` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Donation ID. |
| `amount` | `number` | No | Donation amount in US dollars. |
| `user_id` | `number` | No | Donating user ID. |
| `status` | `string` | Yes | Donation status. |
| `note` | `string` | No | Public donation note. |
| `scheduled_donation_id` | `number` | No | Scheduled donation ID. |
| `visibility` | `string` | No | Donation visibility. |
| `created_at` | `string` | Yes | Donation creation timestamp. |
| `mailed_at` | `string` | No | Donation mailed timestamp. |
| `non_profit` | `object` | Yes | Recipient nonprofit. |
| `fund` | `object` | No | Donor fund. |
| `user` | `object` | No | Donating user. |

> **non\_profit full type**
>
> ```ts theme={null}
> {
>   ein: string,
>   name: string,
>   website?: string | null,
>   city: string,
>   state: string,
>   public_path: string,
>   public_url: string,
>   latitude?: number | null,
>   longitude?: number | null,
>   logo?: string | null,
>   cause_id?: number,
>   cause?: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   },
>   causes?: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   }[]
> }
> ```

> **fund full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string
> }
> ```

> **user full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string,
>   avatar?: string | null,
>   slug: string,
>   city?: string | null
> }
> ```

***

### getBalance

`accounts.getBalance`

Retrieve the authenticated user's fund balance.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getBalance({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `amount` | `number` | Yes | — |
| `pending_deposit_balance` | `number` | Yes | — |
| `portfolio_balance` | `number` | Yes | — |
| `available_balance` | `number` | Yes | — |

***

### getContributions

`accounts.getContributions`

List contributions made to the authenticated fund.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getContributions({ page: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[]` | Yes | Page of returned records. |
| `meta` | `object` | Yes | Pagination metadata. |

> **items full type**
>
> ```ts theme={null}
> {
>   units: number,
>   type: string,
>   status: string,
>   valuation: number,
>   currency: string,
>   frequency: string,
>   created_at: string,
>   received_at?: string | null,
>   completed_at?: string | null,
>   id: number
> }[]
> ```

> **meta full type**
>
> ```ts theme={null}
> {
>   count: number,
>   page: number,
>   last: number
> }
> ```

***

### getDonation

`accounts.getDonation`

Retrieve a single donation by user and donation ID.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getDonation({ userId: 1234, donationId: 5678 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `number` | Yes | — |
| `donationId` | `number` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | Donation ID. |
| `amount` | `number` | No | Donation amount in US dollars. |
| `user_id` | `number` | No | Donating user ID. |
| `status` | `string` | Yes | Donation status. |
| `note` | `string` | No | Public donation note. |
| `scheduled_donation_id` | `number` | No | Scheduled donation ID. |
| `visibility` | `string` | No | Donation visibility. |
| `created_at` | `string` | Yes | Donation creation timestamp. |
| `mailed_at` | `string` | No | Donation mailed timestamp. |
| `non_profit` | `object` | Yes | Recipient nonprofit. |
| `fund` | `object` | No | Donor fund. |
| `user` | `object` | No | Donating user. |

> **non\_profit full type**
>
> ```ts theme={null}
> {
>   ein: string,
>   name: string,
>   website?: string | null,
>   city: string,
>   state: string,
>   public_path: string,
>   public_url: string,
>   latitude?: number | null,
>   longitude?: number | null,
>   logo?: string | null,
>   cause_id?: number,
>   cause?: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   },
>   causes?: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   }[]
> }
> ```

> **fund full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string
> }
> ```

> **user full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string,
>   avatar?: string | null,
>   slug: string,
>   city?: string | null
> }
> ```

***

### getDonations

`accounts.getDonations`

List donations made by the authenticated user.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getDonations({ page: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[]` | Yes | Page of returned records. |
| `meta` | `object` | Yes | Pagination metadata. |

> **items full type**
>
> ```ts theme={null}
> {
>   id: number,
>   amount?: number,
>   user_id?: number,
>   status: string,
>   note?: string | null,
>   scheduled_donation_id?: number | null,
>   visibility?: string,
>   created_at: string,
>   mailed_at?: string | null,
>   non_profit: {
>     ein: string,
>     name: string,
>     website?: string | null,
>     city: string,
>     state: string,
>     public_path: string,
>     public_url: string,
>     latitude?: number | null,
>     longitude?: number | null,
>     logo?: string | null,
>     cause_id?: number,
>     cause?: {
>       id: number,
>       name: string,
>       logo?: string | null,
>       color: string
>     },
>     causes?: {
>       id: number,
>       name: string,
>       logo?: string | null,
>       color: string
>     }[]
>   },
>   fund?: {
>     id: number,
>     name: string
>   },
>   user?: {
>     id: number,
>     name: string,
>     avatar?: string | null,
>     slug: string,
>     city?: string | null
>   }
> }[]
> ```

> **meta full type**
>
> ```ts theme={null}
> {
>   count: number,
>   page: number,
>   last: number
> }
> ```

***

### getUserByUsername

`accounts.getUserByUsername`

Retrieve a public user profile by username.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getUserByUsername({ username: 'api-user' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `username` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | User ID. |
| `name` | `string` | Yes | User name. |
| `avatar` | `string` | No | User avatar URL. |
| `slug` | `string` | Yes | User profile slug. |
| `cover_image` | `string` | No | User cover image URL. |
| `fund_name` | `string` | Yes | User fund name. |
| `current_fund` | `object` | Yes | Current donor-advised fund. |
| `follows_user` | `boolean` | Yes | Whether the viewer follows this user. |
| `follows_viewer` | `boolean` | Yes | Whether this user follows the viewer. |
| `onboarding_status` | `string` | Yes | User onboarding status. |

> **current\_fund full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string,
>   summary: string,
>   causes: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   }[],
>   users: {
>     id: number,
>     name: string,
>     avatar?: string | null,
>     slug: string
>   }[]
> }
> ```

***

### getUserCauses

`accounts.getUserCauses`

Retrieve a user's supported charitable causes.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getUserCauses({ userId: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `number` | Yes | — |

**Output:** `object[]`

> **Output full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string,
>   logo?: string | null,
>   color: string
> }[]
> ```

***

### getUserDonations

`accounts.getUserDonations`

Retrieve a user's public donations.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getUserDonations({ userId: 1, page: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number` | No | — |
| `userId` | `number` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[]` | Yes | Page of returned records. |
| `meta` | `object` | Yes | Pagination metadata. |

> **items full type**
>
> ```ts theme={null}
> {
>   id: number,
>   amount?: number,
>   user_id?: number,
>   status: string,
>   note?: string | null,
>   scheduled_donation_id?: number | null,
>   visibility?: string,
>   created_at: string,
>   mailed_at?: string | null,
>   non_profit: {
>     ein: string,
>     name: string,
>     website?: string | null,
>     city: string,
>     state: string,
>     public_path: string,
>     public_url: string,
>     latitude?: number | null,
>     longitude?: number | null,
>     logo?: string | null,
>     cause_id?: number,
>     cause?: {
>       id: number,
>       name: string,
>       logo?: string | null,
>       color: string
>     },
>     causes?: {
>       id: number,
>       name: string,
>       logo?: string | null,
>       color: string
>     }[]
>   },
>   fund?: {
>     id: number,
>     name: string
>   },
>   user?: {
>     id: number,
>     name: string,
>     avatar?: string | null,
>     slug: string,
>     city?: string | null
>   }
> }[]
> ```

> **meta full type**
>
> ```ts theme={null}
> {
>   count: number,
>   page: number,
>   last: number
> }
> ```

***

### getUserProfile

`accounts.getUserProfile`

Retrieve the authenticated user's profile.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.accounts.getUserProfile({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | User ID. |
| `name` | `string` | Yes | User name. |
| `avatar` | `string` | No | User avatar URL. |
| `slug` | `string` | Yes | User profile slug. |
| `cover_image` | `string` | No | User cover image URL. |
| `fund_name` | `string` | Yes | User fund name. |
| `current_fund` | `object` | Yes | Current donor-advised fund. |
| `follows_user` | `boolean` | Yes | Whether the viewer follows this user. |
| `follows_viewer` | `boolean` | Yes | Whether this user follows the viewer. |
| `onboarding_status` | `string` | Yes | User onboarding status. |

> **current\_fund full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string,
>   summary: string,
>   causes: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   }[],
>   users: {
>     id: number,
>     name: string,
>     avatar?: string | null,
>     slug: string
>   }[]
> }
> ```

***

## Gifts

### create

`gifts.create`

Create a Daffy charitable gift for a beneficiary.

**Risk:** `write`

```ts theme={null}
await corsair.daffy.api.gifts.create({ name: 'Jamie', amount: 18 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `amount` | `number` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Gift beneficiary name. |
| `amount` | `number` | Yes | Gift amount in US dollars. |
| `message` | `string` | No | Gift message. |
| `code` | `string` | Yes | Unique gift code. |
| `ein` | `string` | No | Associated nonprofit EIN. |
| `seen` | `boolean` | Yes | Whether the gift was seen. |
| `status` | `new \| accepted \| denied \| claimed` | Yes | Gift status. |
| `updated_at` | `string` | Yes | Gift status update timestamp. |
| `created_at` | `string` | Yes | Gift creation timestamp. |
| `claimed` | `boolean` | Yes | Whether the gift was claimed. |
| `url` | `string` | Yes | Shareable gift URL. |

***

### getByCode

`gifts.getByCode`

Retrieve a gift by its unique code.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.gifts.getByCode({ code: '6ba7b810-9dad-11d1-80b4-00c04fd430c8' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `code` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Gift beneficiary name. |
| `amount` | `number` | Yes | Gift amount in US dollars. |
| `message` | `string` | No | Gift message. |
| `code` | `string` | Yes | Unique gift code. |
| `ein` | `string` | No | Associated nonprofit EIN. |
| `seen` | `boolean` | Yes | Whether the gift was seen. |
| `status` | `new \| accepted \| denied \| claimed` | Yes | Gift status. |
| `updated_at` | `string` | Yes | Gift status update timestamp. |
| `created_at` | `string` | Yes | Gift creation timestamp. |
| `claimed` | `boolean` | Yes | Whether the gift was claimed. |
| `url` | `string` | Yes | Shareable gift URL. |

***

### list

`gifts.list`

List gifts associated with the authenticated user.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.gifts.list({ page: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[]` | Yes | Page of returned records. |
| `meta` | `object` | Yes | Pagination metadata. |

> **items full type**
>
> ```ts theme={null}
> {
>   name: string,
>   amount: number,
>   message?: string | null,
>   code: string,
>   ein?: string | null,
>   seen: boolean,
>   status: new | accepted | denied | claimed,
>   updated_at: string,
>   created_at: string,
>   claimed: boolean,
>   url: string
> }[]
> ```

> **meta full type**
>
> ```ts theme={null}
> {
>   count: number,
>   page: number,
>   last: number
> }
> ```

***

## Non Profits

### getByEin

`nonProfits.getByEin`

Retrieve a nonprofit organization by EIN.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.nonProfits.getByEin({ ein: '261544963' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `ein` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ein` | `string` | Yes | Employer Identification Number. |
| `name` | `string` | Yes | Organization name. |
| `website` | `string` | No | Organization website URL. |
| `city` | `string` | Yes | Organization city. |
| `state` | `string` | Yes | Organization state. |
| `public_path` | `string` | Yes | Daffy public profile path. |
| `public_url` | `string` | Yes | Daffy public profile URL. |
| `latitude` | `number` | No | Organization latitude. |
| `longitude` | `number` | No | Organization longitude. |
| `logo` | `string` | No | Organization logo URL. |
| `cause` | `object` | Yes | Primary charitable cause. |
| `causes` | `object[]` | Yes | All charitable causes. |

> **cause full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string,
>   logo?: string | null,
>   color: string
> }
> ```

> **causes full type**
>
> ```ts theme={null}
> {
>   id: number,
>   name: string,
>   logo?: string | null,
>   color: string
> }[]
> ```

***

### search

`nonProfits.search`

Search nonprofit organizations by cause or text.

**Risk:** `read`

```ts theme={null}
await corsair.daffy.api.nonProfits.search({ query: 'education', page: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number` | No | — |
| `causeId` | `number` | No | — |
| `query` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[]` | Yes | Page of returned records. |
| `meta` | `object` | Yes | Pagination metadata. |

> **items full type**
>
> ```ts theme={null}
> {
>   ein: string,
>   name: string,
>   website?: string | null,
>   city: string,
>   state: string,
>   public_path: string,
>   public_url: string,
>   latitude?: number | null,
>   longitude?: number | null,
>   logo?: string | null,
>   cause: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   },
>   causes: {
>     id: number,
>     name: string,
>     logo?: string | null,
>     color: string
>   }[]
> }[]
> ```

> **meta full type**
>
> ```ts theme={null}
> {
>   count: number,
>   page: number,
>   last: number
> }
> ```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.