Pagination and polling
Paginated lists
Section titled “Paginated lists”Paginated list endpoints take page and limit query parameters and return the records in
data, with paging details in meta.pagination:
{ "data": [{ "id": "…" }], "meta": { "pagination": { "page": 1, "limit": 50, "total": 132, "totalPages": 3, "hasNext": true, "hasPrev": false } }}pagestarts at 1.limitis the number of records per page. The default and maximum depend on the endpoint (see the table below).- A
limitabove the endpoint’s maximum is refused with400 Bad Requestand the codevalidation_error. It is not lowered to the maximum for you, so check yourlimitif you see this error. - Keep requesting the next
pagewhilehasNextistrue.
| Endpoint | Default limit |
Maximum limit |
Sorting | updatedAfter / updatedBefore |
|---|---|---|---|---|
GET /events |
50 | 1000 | sort, dir |
Yes |
GET /action-items |
20 | 100 | Newest created first, or fieldSort; oldest updated first when polling |
Yes |
GET /metrics |
100 | 1000 | Always by updatedAt, oldest first |
Yes |
GET /events/metrics/bulk |
100 | 1000 | Always by updatedAt, newest first |
Yes |
GET /workflows |
50 | 1000 | — | — |
GET /workflows/{workflowId}/runs |
50 | 1000 | — | — |
GET /assets, GET /locations, GET /users and GET /equipment-types are not
paginated: they return every matching record in data in one response.
Sorting events
Section titled “Sorting events”GET /events takes sort (a field name such as eventDate, createdAt or updatedAt)
and dir (asc or desc). By default events are sorted by eventDate, newest first.
Polling for changes
Section titled “Polling for changes”To keep another system in sync, don’t re-download everything. Ask for records that changed
since your last sync with updatedAfter, and save the newest updatedAt you received as
the starting point for the next sync.
This works on GET /events, GET /action-items, GET /metrics and
GET /events/metrics/bulk, and the two parameters mean the same on all of them:
updatedAfterreturns records updated strictly after the time you send, andupdatedBeforerecords updated strictly before it. A record updated exactly at either time is not included.- Send an ISO 8601 date and time with
Z(2026-09-01T00:00:00Z) or with a timezone offset (2026-09-01T02:00:00+02:00). The API converts it to UTC. In a URL, encode+as%2B. A value that isn’t a date and time returns400withvalidation_error.
- On the first run, choose a starting time, for example the start of today, in ISO 8601
UTC:
2026-09-01T00:00:00Z. - Request
?updatedAfter=<cursor>&page=1. WhenupdatedAfterorupdatedBeforeis set, events and action items come back sorted byupdatedAt, oldest first. OnGET /events, sendsort=updatedAt&dir=ascas well, so the order stays right if you add other options. - Page through with
page=2, 3, …untilhasNextisfalse, and process each record. - Once you have read the last page, save the largest
updatedAtyou saw as the new cursor. - Wait, then repeat from step 2, sending the new cursor minus 5 minutes as
updatedAfter(see Tips for reliable syncing).
curl "https://safe-api.safetyradar.com/v2/events?updatedAfter=2026-09-01T00:00:00Z&sort=updatedAt&dir=asc&limit=100&page=1" \ --header "Authorization: Bearer $SAFETY_RADAR_API_KEY"const BASE = 'https://safe-api.safetyradar.com/v2';const headers = { Authorization: `Bearer ${process.env.SAFETY_RADAR_API_KEY}` };
// Returns the new cursor to save for the next run.async function syncEvents(cursor) { let newest = cursor; for (let page = 1; ; page++) { const params = new URLSearchParams({ updatedAfter: cursor, sort: 'updatedAt', dir: 'asc', limit: '100', page: String(page), }); const res = await fetch(`${BASE}/events?${params}`, { headers }); if (!res.ok) throw new Error(`Safety Radar API returned ${res.status}`); const { data, meta } = await res.json();
for (const event of data) { await upsertEvent(event); // your code: insert or update by event.id if (event.updatedAt > newest) newest = event.updatedAt; } if (!meta.pagination.hasNext) return newest; }}import osimport requests
BASE = "https://safe-api.safetyradar.com/v2"HEADERS = {"Authorization": f"Bearer {os.environ['SAFETY_RADAR_API_KEY']}"}
def sync_events(cursor: str) -> str: """Returns the new cursor to save for the next run.""" newest = cursor page = 1 while True: res = requests.get( f"{BASE}/events", params={ "updatedAfter": cursor, "sort": "updatedAt", "dir": "asc", "limit": 100, "page": page, }, headers=HEADERS, ) res.raise_for_status() body = res.json() for event in body["data"]: upsert_event(event) # your code: insert or update by event["id"] newest = max(newest, event["updatedAt"]) if not body["meta"]["pagination"]["hasNext"]: return newest page += 1Tips for reliable syncing
Section titled “Tips for reliable syncing”- Poll with an overlap. A change can become visible with an
updatedAtslightly older than the newest one you already hold. SendupdatedAfteras your saved cursor minus 5 minutes, so a late change is not missed. - Insert or update by
id. With the overlap, records you already have come back again. Make your processing safe to repeat. - Only move the cursor after the last page. Several records can share the same
updatedAt. BecauseupdatedAfteris exclusive, a cursor taken from the middle of a run can skip the records on later pages that share that time. - Compare timestamps as UTC ISO strings as returned by the API. Strings in this format sort in time order.
- Bulk event metrics are a time window.
GET /events/metrics/bulkreturns one row per event, newest first, so the last record on a page is not a cursor. Page through the whole window, then use the largestupdatedAtyou received as the nextupdatedAfter. - Poll at a sensible interval. Every few minutes is plenty for most integrations and stays well within the rate limit.

