# Rebuild a book from diffs

> HyperCore private-preview documentation.

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

<Callout intent="info">
  This API is in private preview. Endpoint availability and response schemas may change before general availability.
</Callout>


# Rebuild a book from diffs

Subscribe to `l2BookDiff`. The first message for each market is the current book
snapshot with `isSnapshot: true`; install it as local state. Apply later diffs in
height order. The first diff for each market must carry `prev_seq` equal to that
market's snapshot `seq`; continue checking `prev_seq` against your local position on
every diff.

On a continuity break, discard local state for the affected markets and adopt the
pushed message with `isSnapshot: true`; bootstrap and recovery use the same
replacement mechanism.

For a snapshot shared by many consumers, or to let a slow client digest a large book
while buffering live updates, use [the REST snapshot read](/docs/data/hypercore/rest-api/hyper-core-data-api-endpoints/get-l-2-book-diff-snapshot)
instead.

## Cursor rule

Advance a durable cursor only after downstream storage succeeds. Treat a gap, correction, or finality change as a reason to backfill and reconcile.