> ## 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.

# Versions

> What v1 and v2 are, the v2 operation for each v1 one, and what is only on v1

The API has two versions. The version is the first segment of every path.

| Version | Base URL | Use it for |
| - | - | - |
| `v2` | `https://api.donate.gg/api/v2` | Everything new |
| `v1` | `https://api.donate.gg/api/v1` | Integrations already built on it, and the few routes listed below |

Both use the same API key and the same [rate limits](https://docs.donate.gg/api/rate-limits.md), and you can call both from
one integration. `v1` keeps working and does not change. Every guide on this site uses `v2`.

## What v2 is

v2 is not v1 with new paths. It has its own shapes, and every operation in it follows the same
rules, so what you learn from one operation holds for the rest. v1 grew one route at a time and
does not have that property: its lists have six different shapes, its totals three, and some
responses carry placeholder names and logos.

| | v1 | v2 |
| - | - | - |
| Who a config can pay | Charities | Charities and campaigns, each a `{ type, id }` |
| A list | `{ pageKey, response }`, `{ response }`, `{ entries, nextCursor }`, `{ items }`, `{ chainIds }` or a bare array | Always `{ items, nextCursor }` |
| A total | `usdDonatedE6`, `displayedUsdE6` or `totalUsdE6`, depending on the route | Always one `stats` object |
| Another resource inside a response | Embedded in full, or as a name and a logo | A reference `{ type, id }`; one request resolves references |
| A value that does not exist | A missing key, an empty string or a placeholder | `null` |
| A parameter the operation does not know | Ignored on some routes | `400` |
| A bad cursor | The first page again, on most lists | `400 INVALID_CURSOR` |
| A charity that is hidden, disabled or opted out | Returned in full, or masked, depending on the route and the reason | Always the same [stand-in](https://docs.donate.gg/api/pagination-and-formats.md#a-recipient-that-is-withheld), with `available: false` |
| An error | `{ error, code }` | `{ code, message, issues }` |
| The fee on a config | `feeBps`, the value stored with the config | Not on the config. [Quoted](https://docs.donate.gg/api-reference/configs/get-fee.md) for a donation |

[Pagination and formats](https://docs.donate.gg/api/pagination-and-formats.md) and [Errors](https://docs.donate.gg/api/errors.md) state the v2
rules in full.

### Config ids do not change

A config created on v1 is the same config on v2, with the same id. You do not create anything
again or change anything on-chain. v2 reads every config, including one v1 created, and v1 reads
every config that names only charities.

## From v1 to v2

Each v1 operation and the v2 operation that does its job. The reference page of every v1 operation
names its v2 form too.

| On v1 | On v2 |
| - | - |
| `GET /v1/charities` | [`GET /v2/charities`](https://docs.donate.gg/api-reference/charities/list) |
| `GET /v1/charities/search` | [`GET /v2/beneficiaries?term=`](https://docs.donate.gg/api-reference/beneficiaries/list) |
| `GET /v1/charities/{charityId}` | [`GET /v2/charities/{charityId}`](https://docs.donate.gg/api-reference/charities/get) |
| `GET /v1/charities/{charityId}/donations/messages` | [`GET /v2/charities/{charityId}/messages`](https://docs.donate.gg/api-reference/charities/list-messages) |
| `GET /v1/charities/{charityId}/donations` | [`GET /v2/charities/{charityId}/donations`](https://docs.donate.gg/api-reference/charities/list-donations) |
| `GET /v1/campaigns` | [`GET /v2/campaigns`](https://docs.donate.gg/api-reference/campaigns/list) |
| `GET /v1/campaigns/{campaignId}/stats` | [`GET /v2/campaigns/{campaignId}`](https://docs.donate.gg/api-reference/campaigns/get), in `stats` |
| `GET /v1/campaigns/{campaignId}/donations` | [`GET /v2/campaigns/{campaignId}/donations`](https://docs.donate.gg/api-reference/campaigns/list-donations), and [`GET /v2/campaigns/{campaignId}/messages`](https://docs.donate.gg/api-reference/campaigns/list-messages) for messages |
| `GET /v1/campaigns/{campaignId}/donation-echo` | [`POST /v2/campaigns/{campaignId}/deposit-addresses`](https://docs.donate.gg/api-reference/campaigns/create-deposit-address) |
| `GET /v1/campaigns/{campaignId}/donation-echo/chains` | [`GET /v2/campaigns/{campaignId}/deposit-chains`](https://docs.donate.gg/api-reference/campaigns/list-deposit-chains) |
| `GET /v1/campaigns/{campaignId}/donation-echo/status` | [`GET /v2/campaigns/{campaignId}/deposits/{chainId}/{transactionHash}`](https://docs.donate.gg/api-reference/campaigns/get-deposit) |
| `POST /v1/configs` | [`POST /v2/configs`](https://docs.donate.gg/api-reference/configs/create) |
| `GET /v1/configs` | [`GET /v2/configs`](https://docs.donate.gg/api-reference/configs/list) |
| `GET /v1/configs/{configId}` | [`GET /v2/configs/{configId}`](https://docs.donate.gg/api-reference/configs/get) |
| `GET /v1/configs/{configId}/fee` | [`GET /v2/configs/{configId}/fee`](https://docs.donate.gg/api-reference/configs/get-fee) |
| `GET /v1/configs/{configId}/stats` | [`GET /v2/configs/{configId}/stats`](https://docs.donate.gg/api-reference/configs/get-stats) |
| `GET /v1/configs/{configId}/leaderboard` | [`GET /v2/configs/{configId}/donors`](https://docs.donate.gg/api-reference/configs/list-donors) |
| `GET /v1/{chainId}/tokens/{address}` | [`GET /v2/coins/{chainId}/{address}`](https://docs.donate.gg/api-reference/coins/get) |
| `GET /v1/{chainId}/tokens/{address}/stats` | [`GET /v2/coins/{chainId}/{address}/stats`](https://docs.donate.gg/api-reference/coins/get-stats) |
| `GET /v1/{chainId}/tokens/leaderboard`, `GET /v1/charity-coins` | [`GET /v2/coins`](https://docs.donate.gg/api-reference/coins/list) |
| `GET /v1/charity-coins/creators` | [`GET /v2/coin-creators`](https://docs.donate.gg/api-reference/coins/coin-creators/list) |
| `GET /v1/{chainId}/donationSources/{address}/subjects/leaderboard` | [`GET /v2/donation-sources/{chainId}/{address}/coins`](https://docs.donate.gg/api-reference/coins/donation-sources/list-coins) |
| `GET /v1/donation-activity` | [`GET /v2/charities/{charityId}/donations`](https://docs.donate.gg/api-reference/charities/list-donations) for a charity, [`GET /v2/campaigns/{campaignId}/donations`](https://docs.donate.gg/api-reference/campaigns/list-donations) for a campaign |
| `GET /v1/donation-transfers` | [`GET /v2/donation-transfers`](https://docs.donate.gg/api-reference/donations/donation-transfers/list) by transaction, [`GET /v2/donation-transfers/{transferId}`](https://docs.donate.gg/api-reference/donations/donation-transfers/get) by id |
| `GET /v1/charity-requests/registers` | [`GET /v2/registers`](https://docs.donate.gg/api-reference/charity-requests/registers/list) |
| `GET /v1/charity-requests/search` | [`GET /v2/registers/{registerId}/entries`](https://docs.donate.gg/api-reference/charity-requests/registers/list-entries) |
| `POST /v1/charity-requests` | [`POST /v2/charity-requests`](https://docs.donate.gg/api-reference/charity-requests/create) |
| `GET /v1/charity-requests/{register}/{registration}` | [`GET /v2/charity-requests/{registerId}/{registrationNumber}`](https://docs.donate.gg/api-reference/charity-requests/get) |
| `GET /v1/chains` | [`GET /v2/chains`](https://docs.donate.gg/api-reference/reference/chains/list) |
| `GET /v1/categories` | [`GET /v2/categories`](https://docs.donate.gg/api-reference/reference/categories/list) |

None of these is a rename. Read the v2 reference page before moving a call: the parameters and
the response are v2's own.

### What to change when you move a call

* **Lists.** Read `items` and `nextCursor`. Send `nextCursor` as `cursor`.
* **Totals.** Read `stats.totalUsdE6` where you read `usdDonatedE6` or `displayedUsdE6`.
* **Recipients.** Use [config beneficiaries](https://docs.donate.gg/api-reference/configs/list-beneficiaries.md) for every weighted profile, including the charities a campaign supports. Use [lookup](https://docs.donate.gg/api-reference/beneficiaries/list-by-ids.md) for summaries of individual references.
* **A config body.** `charityBeneficiaries: [{ charityId, weight }]` becomes
  `beneficiaries: [{ type: "charity", id, weight }]`.
* **A config id.** `id.hex` becomes `id`, and `id.base58` becomes `idBase58`.
* **Errors.** Read `message` where you read `error`, and check the codes: some are new, and a
  missing or wrong key is `401` on v2.
* **Nulls.** `name` and `imageUrl` can be `null`. Show your own fallback.
* **`available`.** A recipient with `available: false` and a name is a
  [stand-in](https://docs.donate.gg/api/pagination-and-formats.md#a-recipient-that-is-withheld): show it as it is.

### Move the reads with the writes

v1 cannot describe a campaign. Once one of your configs names a campaign, these v1 reads stop
working for it, so move them to v2 at the same time as config creation.

| v1 route | What it does for a campaign |
| - | - |
| `GET /v1/configs/{configId}` | `409 API_VERSION_UNSUPPORTED` when the config names a campaign |
| `GET /v1/{chainId}/tokens/{address}` | `409 API_VERSION_UNSUPPORTED` when its current or any earlier config names one |
| `GET /v1/campaigns/{campaignId}/donations` | `409 API_VERSION_UNSUPPORTED` for an imported campaign |
| `GET /v1/configs` | Leaves out configs that name a campaign |
| `GET /v1/campaigns` | Leaves out imported campaigns |

## What is only on v1

### The feed of new charities

To watch for newly listed charities, v1 has a feed. v2 lists the same charities newest first
with [`GET /v2/charities?sort=newest`](https://docs.donate.gg/api-reference/charities/list), without the time each was
listed.

| Route | What it is for |
| - | - |
| `GET /v1/charities/feed` | The 50 most recently listed charities, each with when it was listed |
| `GET /v1/charities/feed.atom` | The same as an Atom feed |

```bash theme={null}
curl "https://api.donate.gg/api/v1/charities/feed"
```

* Items are in the v1 charity shape. Take the `id` to v2.
* Poll the feed to watch for new charities. It honours `ETag` and `Last-Modified`: an unchanged
  feed answers `304`.

### The rest

| Route | Note |
| - | - |
| `GET /v1/users/{userId}/receiver-stats` | What a person on donate.gg has received |
| `DELETE /v1/configs/{configId}` | Always refuses. Configs are permanent |

The reference lists every v1 operation under
[Earlier version (v1)](https://docs.donate.gg/api-reference/v1/charities/list.md).

## Runnable check

```bash theme={null}
# A charity on v2
curl "https://api.donate.gg/api/v2/charities/9b4dae4e-d8c1-4322-a594-35a4858296b2"

# The same config on both versions, by either spelling of its id
curl "https://api.donate.gg/api/v1/configs/0x99fbb793f984a8c5f06693e13af3a2629479beac1c38169ec8b601faad71bce9"
curl "https://api.donate.gg/api/v2/configs/BN5zs4C4zce2XBL3QjqV7LTjE51822i2jX4TPQ8DjM3v"

# The charity directory on v2, and the feed of new charities, which is on v1
curl "https://api.donate.gg/api/v2/charities?sort=raised&limit=2"
curl "https://api.donate.gg/api/v1/charities/feed"
```


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