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

# Snapshots

> Use snapshots to compact stream history and accelerate recovery for new or reconnecting clients.

As a stream grows, replaying it from offset `-1` becomes expensive. Snapshots solve this by storing a compacted representation of all data up to a certain offset.

```
PUT /ds/b/s/snapshot/{offset}    publish a snapshot
GET /ds/b/s/snapshot             read the latest snapshot
```

Once a snapshot is published at a given offset, the server may discard all data before that offset. Reads to discarded offsets return `410 Gone`, directing clients to use `/bootstrap` instead.

Who creates snapshots? Typically the application. For instance, a CRDT-based editor periodically computes the merged document state and publishes it as a snapshot. This bounds the amount of data new clients need to process.
