Light AIDocs Beta Open Light AI

Concepts

Pagination & sync

Cursor pagination, initial and incremental syncs with updated_since, and the gapless events feed.

List endpoints return { "data": [...], "has_more": true, "next_cursor": "…" }. Pass next_cursor back as cursor until has_more is false. limit is 1–100 (default 25).

curl "https://api.light-ai.app/v1/leads?limit=100" \
  -H "Authorization: Bearer $LIGHT_AI_API_KEY"

Initial sync#

Page through leads, clients, projects and quotes with sort=updated_asc. Store the highest updated_at you saw (your high-water mark).

curl "https://api.light-ai.app/v1/clients?sort=updated_asc&limit=100" \
  -H "Authorization: Bearer $LIGHT_AI_API_KEY"

Incremental sync#

Poll with sort=updated_asc&updated_since=<high-water mark minus 5 minutes> and de-duplicate by id + updated_at: a write that commits late can carry an earlier timestamp.

Gapless events feed#

For a change feed that never misses anything, poll GET /v1/events?sort=sync_asc. Store next_cursor and pass it back as cursor: every event appears exactly once, even for slow transactions. Events are kept for 30 days. Filter with type or types (comma-separated).

curl "https://api.light-ai.app/v1/events?sort=sync_asc&types=lead.created,quote.approved&limit=100" \
  -H "Authorization: Bearer $LIGHT_AI_API_KEY"

Webhooks or polling?#

WebhooksEvents feed
LatencySecondsYour poll interval
Needs a public URLYesNo
OrderingNot guaranteedExactly once, in commit order
Good forReal-time CRM updatesBatch jobs, firewalled servers, catch-up after downtime

History before you enabled the API is not replayed as events: read it with the list endpoints.