# Bot or server

Request your channel's latest donations from a macOS, Linux or Windows terminal.

## 1. Issue a secret key

In the «Секретные ключи» (Secret keys) block, press «Выпустить секретный ключ» (Issue secret key). Enter a name, tick «Донаты» (Donations, `donations:read`), choose a lifetime and press «Выпустить ключ» (Issue key). Copy the key right away: we show it once.

[Open Developers in your dashboard](https://streamer.donatty.com/developers)

## 2. Save the key in a variable

Replace `dnt_pat_...` with your secret key and run the command in your terminal.


**macOS and Linux:**

```sh
export DONATTY_TOKEN="dnt_pat_..."
```
**Windows (PowerShell):**

```powershell
$env:DONATTY_TOKEN = "dnt_pat_..."
```


The variable lasts while the terminal window is open. In a new window, set it again.

## 3. Request donations

> **Responses include rejected donations.**
> Without `moderation=PASSED,NONE` the API returns every donation with its full text, rejected ones included. Your widget filters do not apply to the API.



**macOS and Linux:**


```sh
curl -s "https://api.donatty.com/v1/donations?limit=5&moderation=PASSED,NONE" \
  -H "Authorization: Bearer $DONATTY_TOKEN"
```

**Windows (PowerShell):**


```powershell
curl.exe -s "https://api.donatty.com/v1/donations?limit=5&moderation=PASSED,NONE" `
  -H "Authorization: Bearer $env:DONATTY_TOKEN"
```



```json
{
  "items": [
    {
      "id": "don_5d2e8f31-6a47-4c19-9b0e-7f3a2d1c8e46",
      "createdAt": "2026-11-09T10:21:47Z",
      "source": "DONATTY",
      "donorName": "Алексей",
      "message": "Спасибо за стрим!",
      "amount": {"value": "500.00", "currency": "RUB"},
      "feeCompensation": {"value": "27.00", "currency": "RUB"},
      "paymentMethod": "CARD",
      "goal": null,
      "moderation": {"status": "PASSED", "deadline": null},
      "media": null
    },
    {
      "id": "don_9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d",
      "createdAt": "2026-11-09T09:58:00Z",
      "source": "DONATION_ALERTS",
      "donorName": "Maria",
      "message": "Hi from Donation Alerts",
      "amount": {"value": "5.00", "currency": "USD"},
      "feeCompensation": null,
      "paymentMethod": null,
      "goal": null,
      "moderation": {"status": "NONE", "deadline": null},
      "media": null
    }
  ],
  "nextCursor": null
}
```

An empty `items` means there are no donations to show on stream yet.

`amount` is the base amount of the donation. If the donor paid extra to cover the fee, that extra is in `feeCompensation`, in the same currency; otherwise it is `null`. How the donor paid is in `paymentMethod`: `SBP` for the Faster Payments System, `CARD` for everything else, `null` for Donation Alerts donations.

## What to show on stream

| Status | What to do |
|---|---|
| `NONE` | show: no moderation |
| `PASSED` | show: moderation let it through |
| `PENDING` | read again after `moderation.deadline` |
| `BLOCKED` | do not show |

## Next

- A complete bot: [Node.js](https://developers.donatty.com/en/examples/bot-node.md) or [Python](https://developers.donatty.com/en/examples/bot-python.md). It rechecks `PENDING` and waits after 429.
- [Donations method parameters](https://developers.donatty.com/en/reference/donations.md)
- [Errors](https://developers.donatty.com/en/errors.md)
