Steps
1
Fetch a page of CDRs
call_id, direction, caller, callee, start_time,
duration_seconds, status, hangup_cause, and more — see Call and lead
states for what status does and doesn’t tell you.2
Page through the rest
Use
offset to page — increment it by your limit and keep requesting until a response
returns fewer records than you asked for.3
Store each record, keyed by call_id
Upsert on
call_id in your own database — this makes a re-run safe if a sync is
interrupted partway through.4
Advance your sync window for next time
Record the latest
start_time you saw. On your next run, set from to that value (or
slightly earlier, to tolerate clock skew) instead of 2026-08-01T00:00:00Z.What you accomplished
A repeatable, incremental sync you can run on a schedule — each run only asks for calls since the last one, and upserting bycall_id makes re-running a window harmless.