Prefer webhooks. They push KYC/KYB and AML
events to you in real time, signed and retried — no polling loop to run.
Reach for polling when you can’t host an HTTPS endpoint, or as a periodic
backstop alongside webhooks.
The pattern in one paragraph
Track a “high water mark” timestamp in your own database. Each poll asks for customers updated after that timestamp, walks all pages, and advances the watermark to the latestupdated_at you saw. That’s
it.
Implementation
newWatermark after the loop completes. On the next run,
start from where you left off.
How often should I poll?
A 5-minute poll on a typical org generates ~12 calls/hour — well below
the 60/min burst limit.
Edge cases
- Resume from crash. Persist the watermark after the records are written to your store, not before. Re-runs are safe because every customer write is idempotent against your own primary key.
- Clock skew. Always use the server’s
updated_atvalue, neverDate.now(), as the watermark. Otherwise drift between your clock and ours causes drops or duplicates. - Large catch-up after a long outage. The loop handles it — there’s no hard limit on backfill except rate limits. Pace your daily quota.
Prefer webhooks
Webhooks push the same events to your endpoint with HMAC signatures and automatic retries — thedata.customer payload mirrors
the DTO this loop reads, so switching is drop-in. Use polling as a periodic
backstop if you want belt-and-braces, or as the primary path only when you
can’t host an endpoint.
