Snapshots and the cursor feed

Bootstrap a local mirror and apply each Pigeon operation in order.

On this page

Start from a snapshot

Call POST /v1/snapshots and read GET /v1/snapshots/{id}/records using the response's snapshot ID. If a page returns a non-null next_page, pass it as the URL-encoded page_token on the next request. Once next_page is null, publish the complete mirror and the original snapshot's cursor_after together.

Pull and apply in order

Set PIGEON_FEED_CURSOR to the last committed cursor, starting with cursor_after from your completed snapshot. Use the same bearer credential as in the API quickstart.

bash
curl --fail-with-body --get \
  --header "Authorization: Bearer $PIGEON_ACCESS_TOKEN" \
  --data-urlencode "cursor=$PIGEON_FEED_CURSOR" \
  https://api.sendtopigeon.com/v1/feed

Apply the operations in ops in order. For each change, save the returned record or remove it on unlink or delete. Save next_cursor in the same transaction as the changes, even if ops is empty. Keep pulling immediately while has_more is true.

Treat cursors as opaque and keep one checkpoint per connection. Serialize feed application and write acknowledgements so a late result cannot move a record back to an older revision.

Recover from a feed or snapshot error

Status and codeAction
410 cursor_expired, rebootstrap_required or history_expiredBuild a fresh snapshot and replace the mirror and checkpoint together. A new view can exclude records you previously had access to.
410 cursor_resetCall POST /v1/reconcile with your stored record and revision identities. Keep copies of revisions reported as unknown for review, then take a new snapshot. A reset can follow a hub restore. Review divergent copies before sending any edits.
410 snapshot_invalidatedDiscard the partial snapshot and start a fresh one.
403 connection_pausedKeep the checkpoint. Wait until the user makes the connection active.
403 connection_disconnected or 401 episode_supersededStop using the grant. Bootstrap under a new grant if the user reconnects.

Webhooks tell you when to pull. Poll periodically so a missed notification only delays sync.