Skip to content
Support

Keep your system in sync with sync mode and cursors

Owner, AdminLast checked 24 November 20262 min readArticle ID: developers-sync-tutorial
On this page

Read everything once, then poll a cursor to pick up only what changed.

Sync mode returns records oldest change first, so you can follow changes without missing any. It's turned on by updated_since or cursor. In the examples, $SKEDULER_API is your Skeduler API address. Contact Skeduler support if you don't have it.

Who can do this: Owners and Admins with the Manage Developer Tools permission.

1. First run

Call with updated_since set to where you want to start. Use an early date to get everything.

curl -s "$SKEDULER_API/api/v1/invoices?updated_since=1970-01-01&per_page=100" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
{ "data": [ … ], "meta": { "per_page": 100, "has_more": true, "next_cursor": "WyIyMDI2LTEx…" } }

2. Page with the cursor

While has_more is true, call again with cursor=<meta.next_cursor>. Don't build or change a cursor: it's opaque, and one the API didn't issue is 422 validation_failed. When has_more is false you're caught up.

3. Poll

Store the last next_cursor. Later, call with cursor=<stored> to get only what changed after it. If nothing changed, data is empty and next_cursor is the same cursor back, so keep storing it.

let cursor = await loadCursor(); // null the first time
for (;;) {
  const qs = cursor ? `cursor=${cursor}` : "updated_since=1970-01-01";
  const res = await api(`/invoices?${qs}&per_page=100`);
  for (const invoice of res.data) await upsert(invoice); // by id
  cursor = res.meta.next_cursor ?? cursor;
  await saveCursor(cursor);
  if (!res.meta.has_more) break;
}

Things to know

  • Upsert by id. A record can come back again if it changes again, and a retry re-reads the same page.
  • A short delay. A record is listed once it's at least 5 seconds old, so a change shows up a few seconds after it's saved.
  • updated_since is an ISO 8601 date or timestamp (2026-11-01, 2026-11-01T09:30:00Z). A bare date means midnight UTC, and a date that doesn't exist (2026-02-30) is 422 validation_failed.
  • Archived records are left out of most lists. See Are archived records included in lists?.
  • One fresh re-sync after two changes. A jobs copy synced before 23 November 2026 needs one (no cursor) to pick up each job's classification fields. A technicians copy synced before 22 November 2026 needs one with include_inactive=true to correct technicians deactivated earlier.
  • Keep under the limits. Use per_page=100. See Rate limits. For instant updates use webhooks.

In this section