Skip to content

Push and pull

You can keep up in two ways:

  • Push: Shift notifies your system the moment something happens. This keeps you in step with us in real time.
  • Pull: you request what is new or changed yourself. That always works, also without push.

Pull is always available, push is a choice. If you want push, give us the URL at which your system receives the notifications. We advise using both: push to know immediately that something is there, pull to catch up on everything after an outage.

A push contains no personal data. Only what happened, to which record, and which version that record now has:

{
"event_id": "01JH3Q8Z6T4N2V5K7R9B0C1D2E",
"type": "pledge.created",
"record_id": "PL00012345",
"version": 1,
"occurred_at": "2027-01-04T13:05:00Z"
}

After a push you fetch the record with GET /v1/pledges/{record_id}.

This is a deliberate choice, for security and the protection of your donors’ personal data.

  • A push goes to an address on the internet. If that address is ever set up wrongly, or falls into someone else’s hands, nothing leaks: it only holds a record ID and a version.
  • Personal data and bank account numbers therefore only travel over the API itself, where all the locks are: your secret, a short-lived token, your fixed IP addresses and your rights.
  • Pushes may arrive in a different order than they were sent. Because you fetch the latest version after every push, an old notification can never overwrite a newer state.
type When
pledge.created There is a new pledge, with the status pending.
pledge.updated A detail of the pledge has changed.
pledge.no_show The pledge lapsed before it became final.
pledge.confirmed The pledge is final (day 9).
pledge.cancelled The donor stopped after day 9.

More kinds may be added later. Ignore a type you do not know.

Every push is signed, so that you know it comes from Shift and was not forged or replayed. When you connect, you receive your own signing secret. Every push has two headers:

Header Content
Shift-Timestamp The moment of sending, in seconds since 1970 (Unix time)
Shift-Signature sha256= followed by the HMAC-SHA256 of <timestamp>.<body> with your secret, in hexadecimal

Check on every push:

  1. Compute the signature yourself over the timestamp, a dot and the raw body as you received it.
  2. Compare it with Shift-Signature using a constant-time comparison (for example hash_equals in PHP or hmac.compare_digest in Python).
  3. Refuse the push if the timestamp is more than 5 minutes off your clock.
  4. If you have already processed this event_id, answer 200 and do nothing else.

Answer within a few seconds with a 2xx status. If a push fails, we retry for a while with ever longer pauses (how long: to follow). If it keeps failing, we switch push off for you and contact you. You miss nothing: with pull you catch up on everything.

A push always comes over HTTPS and from Shift’s fixed IP addresses, which you receive when you connect.

GET /v1/pledges?updated_since=<date and time> returns the pledges that are new or changed since that moment, oldest change first, in pages.

How to keep up:

  1. Remember the moment you start fetching.
  2. Fetch with updated_since set to the start of your previous round.
  3. Page through with cursor (the next_cursor from the previous answer) until has_more is false.
  4. Process every record as an update based on record_id and version.

updated_since may lie at most one month back, even though a status record stays fetchable for 13 months. So fetch at least once a month. From 7 days after confirmed, and straight away with no_show, a record holds only the status (see What you can fetch).

pace-api staging · a79cbe01e4c5