GET /changes makes it one loop: ask what changed since last time, fetch each record that changed, and remove each one that went.
How it works
GET /changes answers with a list of changes, each one a resource, an id, what happened and when:
- It carries ids, never the records. For a
createdorupdatedchange, fetch the record fromGET /{resource}/{id}, such asGET /members/{memberId}. For adeletedchange, remove your copy. - It needs no scope of its own. Members, events, badge records and tasks are in it, each only for a key that holds that area’s read scope:
members:read,events:read,badges:readortasks:read. A key with onlymembers:readsees member changes and nothing else. - It never skips a change. Keep the
nextCursorof the last page and send it next time. A change made while you were reading comes back on a later page or on your next run. You may see a record twice; fetching it again is harmless.
The loop
- The first time, read each list in full and save every record:
GET /members,GET /events,GET /badgesandGET /tasks, walking every page (see Pagination). Note the time before you start, then callGET /changeswithsinceset to that time. - Each run after that, call
GET /changeswithsinceset to thenextCursoryou saved. Keep calling it with each newnextCursorwhilehasMoreistrue. - For each change:
deleted→ remove your copy.createdorupdated→ fetch the record and save it over your copy with the sameid. A fetch that answers404means the record went after the change was listed: remove your copy. - Save the last
nextCursoronce every change is applied, for the next run. If the run fails halfway, start again from the cursor you saved last time: nothing is lost. - Once a week, do a full read and replace your copy. A few changes leave nothing to report (a parent linked to a member, a section renamed). The pagination guide lists them.
Python and SQLite
This script keepsscouts.db, a SQLite file, in step with your group. It stores each record as JSON beside its id, so it never needs changing when the API adds a field. It needs Python 3.9 or later and requests (pip install requests).
sync_to_sqlite.py
sync_state row and run it again.
A record is stored as the API returns it, so query it with SQLite’s JSON functions:
Postgres
The same loop works with Postgres. Store each record asjsonb and upsert on the id:
sqlite3 for psycopg (pip install "psycopg[binary]") and change three statements:
Switch to your group
SetSCOUTWORKS_API_KEY to your own key and SCOUTWORKS_API_URL to https://api.scoutworks.app/api/v1. Your key needs the read scope of each area you want to copy: members:read, events:read, badges:read and tasks:read. With members.contacts:read too, your copy of each member carries their date of birth and parents’ contact details: keep the file somewhere only the right people can open it.
If something goes wrong
400 invalid_requestonsince: send a timestamp with a time zone, such as2026-11-01T00:00:00Z, or anextCursorexactly as you got it.403 insufficient_scope: the key holds none of the four read scopes.- The copy drifts: run the weekly full read. If it still drifts, tell us which record, and we will look.