Sync API
One endpoint.
| Method | Path | Purpose |
|---|---|---|
GET |
/v1/sync |
Long-poll: return events since the given stream position. |
Query parameters#
since— stream position (int). Optional; default 0 (everything from the start, capped bylimit).limit— max events returned. Default 100, max 500.timeout— max wait time in ms, default 30000 (30s). If no events arrive within this window, returns an empty list.
Behaviour#
Two modes:
- Catch-up — if there are unread events since
since, returns them immediately (up tolimit). The client then advances its cursor and re-polls. - Long-poll — if there are none, the request blocks. As soon
as a new event arrives in any room the caller can see, it
returns. If the
timeoutelapses with nothing, returns an empty list (signal to re-poll).
Example#
bash
1 2 | |
json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
has_more tells you whether more events are available beyond the
returned page; the client re-polls with the new cursor.
When to use sync vs. WebSocket#
Use the WebSocket stream as your primary subscription. Use
/v1/sync on:
- Initial app open — catch up since the last cursor stored locally.
- Reconnect after WS drop — bridge the gap.
- Mobile or background — when WS isn't practical to keep open.
Stream position#
Stream positions are tenant-wide monotonic integers. They don't correspond to anything user-visible; treat them as opaque cursors.
Permission#
The endpoint only returns events for rooms you can see (membership
state in join or leave). Cross-tenant events are filtered out.