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

# API overview

> The base URL and the rules every operation shares

The Donate API is JSON over HTTPS.

```text theme={null}
https://api.donate.gg/api/v2
```

Every operation path starts with its version. Build on `v2`: it has every operation an integration
needs. `v1` is the earlier version and keeps working; [Versions](https://docs.donate.gg/api/versions.md) says what differs.

## What every operation shares

Every operation follows the same rules, so what you learn from one holds for the rest.

| Topic | Rule |
| - | - |
| Where | Call from your server. Browsers on your domain are refused by CORS |
| Key | Send `donate-api-key` when you have one. Most reads work without it. [Authentication](https://docs.donate.gg/api/authentication.md) |
| Limits | Per organization with a key, per IP address without. [Rate limits](https://docs.donate.gg/api/rate-limits.md) |
| Errors | `{ "code", "message" }` with the HTTP status that matches. Branch on `code`. [Errors](https://docs.donate.gg/api/errors.md) |
| Lists | Always `{ "items", "nextCursor" }`. Send `nextCursor` back as `cursor`. [Lists](https://docs.donate.gg/api/pagination-and-formats.md#lists) |
| References | A response holds its own resource and `{ "type", "id" }` for any other. One request turns references into names and images. [References](https://docs.donate.gg/api/pagination-and-formats.md#references) |
| Money | A whole number in a string whose name says the unit: `...UsdE6` or `...Atomic`. [Money](https://docs.donate.gg/api/pagination-and-formats.md#money) |
| Totals | One `stats` object wherever a total appears. [Totals](https://docs.donate.gg/api/pagination-and-formats.md#totals) |
| Nulls | Every field is always present. A value that does not exist is `null` |
| Parameters | A query parameter or a body field the operation does not know answers `400`. Do not add cache-busters |
| Creates | The status says what a `POST` did, and the body is the same resource either way: `201` created and `200` already existed, or `200` ready and `202` being created for a deposit address |
| Methods | `HEAD` works wherever `GET` does. `OPTIONS` lists the methods a path accepts |
| Environment | There is no sandbox. Every call reads or writes production |
| Updates | There are no webhooks. Read again when you need newer data |

## What is in the API

| Resource | What you do with it | Start here |
| - | - | - |
| Beneficiaries | Search charities and campaigns by name, and turn references into names and images | [Beneficiary picker](https://docs.donate.gg/guides/beneficiary-picker.md) |
| Charities | List every charity, read one in full, and read its messages | [Beneficiary picker](https://docs.donate.gg/guides/beneficiary-picker.md#a-directory-of-every-charity) and [Coin page](https://docs.donate.gg/guides/coin-page.md#3-the-details-view) |
| Campaigns | List fundraisers, read one, its messages and its deposit addresses | [Campaigns](https://docs.donate.gg/guides/campaigns.md) |
| Configs | Create a split, read it, quote the fee, read your totals and donors | [Concepts](https://docs.donate.gg/concepts.md#configs-and-weights) |
| Coins | Read who a coin pays and what it has donated, and ranked lists | [Coin page](https://docs.donate.gg/guides/coin-page.md) and [Leaderboards and stats](https://docs.donate.gg/guides/leaderboards-and-stats.md) |
| Donations | The donations of a charity or a campaign, and the state of transfers that cross chains | [Track a donation](https://docs.donate.gg/guides/track-a-donation.md) |
| Charity requests | Ask for a charity that is not listed yet | [Request a charity](https://docs.donate.gg/guides/request-a-charity.md) |
| Reference data | Chains a donation can be made on, and campaign categories | [Donate button](https://docs.donate.gg/guides/donate-button.md) |

The [API reference](https://docs.donate.gg/api-reference/overview.md) lists every operation with its parameters and
responses.

## What to keep, and for how long

Nothing is pushed to you, and most answers can be kept. A response carries `Cache-Control` that
says what the API itself promises:

| Answer | `Cache-Control` | In practice |
| - | - | - |
| `GET /v2/configs/{configId}` | `private, max-age=86400` | A config never changes. Keep it for ever |
| `GET /v2/chains`, `GET /v2/categories`, `GET /v2/registers` | `private, max-age=300` | They change rarely. Keep them for minutes or longer |
| Everything else | `private, no-store` | Nothing in between may store it. Your own backend may keep a search answer, a recipient's summary or a charity for hours: names and images change rarely |

Do not keep an answer of `GET /v2/donation-transfers` or `GET /v2/donation-transfers/{transferId}`:
a decision to reclaim funds is read from it.

## OpenAPI and Postman

| File | URL |
| - | - |
| OpenAPI 3.1 | `https://api.donate.gg/api/openapi` |
| Postman collection | `https://api.donate.gg/api/postman` |

Both cover every version, need no key and are not rate limited.

## Runnable check

```bash theme={null}
# A public read: the chains a donation can be made on
curl "https://api.donate.gg/api/v2/chains"

# The same call with a key counts against your organization's limit instead of your IP address's
curl "https://api.donate.gg/api/v2/chains" -H "donate-api-key: $DONATE_API_KEY"

# The OpenAPI document
curl "https://api.donate.gg/api/openapi"
```


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