Change feed
Follow every change in your organization from a saved position, oldest first, each exactly once.
The change feed lets a scheduled job pick up every change since its last run, exactly once. It reads the same entries as the audit log, but oldest first and from a position your job saves between runs. A change made while your job is reading is never skipped and never returned twice.
| Endpoint | Scope | Token owner's role |
|---|---|---|
GET /changes | audit:read | Admin |
A Member's token gets 403 insufficient_scope. The feed carries metadata
only, as the audit log does: who changed what, when, and with which token.
It never contains a secret.
How it works
- Start. Call
GET /changeswithoutafter. The response has no events and anext_positionthat means "now". Save it. (Passafter=0instead to start at the beginning of the log.) - Poll. Call
GET /changes?after=<saved position>. Handle the events indata, oldest first. - Save. After you have handled the page, save
next_position. It is always set, also whendatais empty. - Repeat. If
has_moreistrue, more events are ready: call again at once. If it isfalse, you are up to date: poll again later. Every 30–60 seconds is plenty.
Save the position after you have handled the events. If your job stops
between the two, the next run returns the same events again, so a job that
saves last never loses one. Each event also carries its own position; a
job that stops mid-page can save that and resume right after the last event
it handled.
The position
- It is opaque: store it as a string and send it back unchanged.
- It is stable: asking again with the same position returns the same events, plus any that arrived since.
- It does not expire and is not tied to a token, so it survives a token rotation. Keep one position per job.
Order and timing
Events are ordered by when their change was written to the log. For changes
made at the same moment, created_at can therefore be slightly out of
order; the feed order is the one to rely on. A change appears once it has
been fully saved, usually within a second. While a long-running database
operation is in progress, newer changes can wait for it to finish; they are
delayed, never skipped.
Why not page the audit log by time?
GET /audit?from=… is right for browsing and for exports, but not for
"everything since my last check": two changes can share a timestamp, and a
change can be saved a moment after a later one is already visible. A job
that remembers the last timestamp it saw can then miss a change or see one
twice. The change feed's position is built to avoid both, in the same way
as Google Drive's changes list or Microsoft Graph's delta links.
Read the feed
GET /api/v1/mgmt/changes| Query parameter | Type | Notes |
|---|---|---|
after | string | A next_position (or an event's position) from an earlier call, or 0 for the beginning of the log. Omit it to get the current position. |
limit | integer | Events per page, 1–200 (default 50). |
cursor | string | Same as after, for a client that pages every list with next_cursor/cursor. Send one of the two, not both. |
The response is the usual list envelope
plus next_position. Each event is an
audit entry with its
position.
| Field | Type | Notes |
|---|---|---|
data | array | Audit entries, oldest first, each with position. |
has_more | boolean | true when more events are ready now. |
next_position | string | Always set. Save it and pass it as after next time. |
next_cursor | string | null | Equal to next_position while has_more is true; null otherwise. |
{
"data": [
{
"id": "0b1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
"created_at": "2026-11-19T10:05:31Z",
"actor": { "user_id": "8e7d6c5b-4a39-4281-9f0e-1d2c3b4a5968", "email": "[email protected]" },
"action": "key_create",
"resource_type": "api_key",
"resource_id": "c41d8e2a-7b90-4f3c-a6e5-2d1f0b9c8a74",
"metadata": { "name": "checkout", "credential": "pat", "pat_name": "CI · payments-deploy", "scope": "keys:write" },
"ip_address": "203.0.113.24",
"position": "MXI6NzQ1MTI6MTc2MzU0NjczMTAwMDAwMDowYjFjMmQzZS00ZjVhLTRiNmMtOGQ3ZS05ZjBhMWIyYzNkNGU"
}
],
"has_more": false,
"next_cursor": null,
"next_position": "MWg6NzQ1MTU"
}# First run: get the current position and save it.
curl -fsS https://portal.<domain>/api/v1/mgmt/changes \
-H "Authorization: Bearer $TF_PAT" | jq -r .next_position > position.txt
# Every later run: read from the saved position.
curl -fsS -G https://portal.<domain>/api/v1/mgmt/changes \
-H "Authorization: Bearer $TF_PAT" \
--data-urlencode "after=$(cat position.txt)" \
-d limit=200Tip
Run the job from cron or your scheduler every minute or so. To alert on
sensitive changes, filter the events by action on your side, for example
member_role_update, key_revoke or org_settings_update.
Errors specific to the change feed
| Status | Code | When |
|---|---|---|
| 400 | invalid_request (param = after or cursor) | The position was not returned by this endpoint, or it is ahead of the log (for example a position from another environment). Start again without after, or with after=0. |
| 400 | invalid_request (param = limit) | limit outside 1–200. |
| 403 | insufficient_scope | Token lacks audit:read, or the owner is not currently an Admin. |
| 422 | unsupported_filter | An unknown query parameter, or both after and cursor. |