Sync Modes
Backfill Pattern
- Start with a minimal field set
Start with the smallest set of fields that proves the pipeline works.
You can prove the pipeline end-to-end before chasing edge cases. - Adopt cursor pagination
Use cursor pagination wherever the endpoint supports it.
The walk is deterministic and can resume after a failure. - Persist the checkpoint alongside the write
Persist both the downstream write result and the last successful cursor checkpoint.
The next run restarts exactly where the last left off. - Expand the field set
Only after the happy path is stable, widen the field set.
You can load new fields without risking the existing load.
TypeScript
let cursor: string | null = null
while (true) {
const url = new URL("https://api.lev.com/api/external/v2/deals")
url.searchParams.set("limit", "100")
if (cursor) url.searchParams.set("cursor", cursor)
const response = await fetch(url, {
headers: {
Authorization: "Bearer YOUR_API_KEY",
"X-Origin-App": "warehouse-sync",
},
})
const payload = await response.json()
await writeBatch(payload.data)
if (!payload.pagination?.has_more) break
cursor = payload.pagination.next_cursor
}2 examples. View source for the rest.
Incremental Pattern
Use an updated_at or similar time-based filter together with a persisted checkpoint:
- Store the timestamp of the last fully successful run.
- Re-read a small overlap window to tolerate clock skew and delayed writes.
- Deduplicate in your destination using resource IDs.
Do not treat offset pagination as a sync primitive
Offset pagination is appropriate for sorted browsing, not for durable bulk syncs. For production data movement, prefer cursor pagination whenever the endpoint supports it.
Operational Checklist
- Monitor
request_idvalues for failed batches. - Alert on repeated
401,403, and429responses. - Keep writes idempotent in your destination so replaying a batch is safe.
- Version your destination schema deliberately as Lev fields expand.
Next steps