# Connecting: REST and streaming

There are two ways to get your channel's donations, goals, top donors, donation totals, and Twitch and YouTube events:

- **[REST](https://developers.donatty.com/en/reference.md)**: your program requests data from the API. Use it for websites, reports or bots that can poll every few seconds.
- **[Centrifugo stream](https://developers.donatty.com/en/realtime.md)**: the API sends events over an open WebSocket or HTTP connection. Use it for overlays, stream alerts or bots that need events without polling.

| | REST | Centrifugo stream |
|---|---|---|
| When you need it | a website, a report, a simple bot | an overlay, an alert on stream, a bot |
| How new data arrives | in the response to the next request | as an event in the open connection |
| What happens on a drop | repeat the request; read what you missed [page by page](https://developers.donatty.com/en/data.md#pages) | the channel history or a REST catch-up covers the gap: [conditions](https://developers.donatty.com/en/realtime/recovery.md) |
| Key | secret; public for the profile, goals and stats | secret only |
| Key scopes | the scope required by the method | the scope required by the [channel](https://developers.donatty.com/en/realtime/channels.md) |

Platform delays apply to both REST and the stream. Twitch subscriptions arrive later than other events; YouTube events arrive after polling. See [Twitch conditions](https://developers.donatty.com/en/conditions/sources.md#twitch) and [YouTube conditions](https://developers.donatty.com/en/conditions/sources.md#youtube).

## How recovery after a drop works

For what channel history can recover, when to catch up over REST and which timestamp to start from, see [History and catch-up](https://developers.donatty.com/en/realtime/recovery.md). For the steps and requests, see the [Stream and catch-up](https://developers.donatty.com/en/examples/stream-recovery.md) example.

## What you need besides the key

For the scope required by each source, see [Keys and scopes](https://developers.donatty.com/en/tokens.md#secret-key-scopes). For dashboard setup and when Donation Alerts, Twitch and YouTube events become available, see [Source conditions](https://developers.donatty.com/en/conditions/sources.md).

## Where to start

- REST: [donations over REST](https://developers.donatty.com/en/quickstart/bot.md), [data for a website](https://developers.donatty.com/en/quickstart/website.md)
- Stream: [first streamed donation](https://developers.donatty.com/en/quickstart/live.md), [connect Twitch](https://developers.donatty.com/en/quickstart/twitch.md), [connect YouTube](https://developers.donatty.com/en/quickstart/youtube.md)
- Catch-up after a stream drop: the [Stream and catch-up](https://developers.donatty.com/en/examples/stream-recovery.md) example
- What comes in responses and events: [response and event structures](https://developers.donatty.com/en/structures.md)
