Concepts
The handful of objects APISync works with, and the rules that decide when a delivery is retried, given up on, or paused.
Sources and endpoints#
A source is where events come from: one Stripe account, one GitHub organisation, one in-house system. It has an ingest URL with an unguessable token in it. An endpoint is where events go: a URL on your side, a list of sources it listens to, and an optional event-type filter.
The relation is many-to-many. A common setup is one source feeding a production endpoint and a staging
endpoint with a narrower filter, so staging sees real invoice.* traffic and nothing else.
Events and deliveries#
When ingest accepts a request it stores it as an event (evt_…): the body,
the headers the provider sends that are worth keeping, the time we received it and a type. How the type
is worked out depends on the provider, see Sources.
For every endpoint that matches, we create a delivery (dlv_…). A delivery
has one or more attempts. The delivery’s status is one of:
| Status | Meaning |
|---|---|
pending | Created, first attempt not finished yet. |
retrying | At least one attempt failed and another one is scheduled. |
succeeded | An attempt got a 2xx response. |
failed | All 12 attempts failed, or the endpoint answered 410 Gone. |
cancelled | Cancelled through the API or dashboard, or the endpoint was deleted. |
Event-type filters#
Filters are matched against the event type. * matches any run of characters, dots included, so
order.* matches order.created and also order.line_item.updated. A filter of
just * matches everything, which is also the default. Matching is case-sensitive.
What counts as success#
An attempt succeeds when your endpoint returns any status from 200 to 299 within 15 seconds. We read at most 4 KB of the response body and store it with the attempt; the rest is discarded. Everything else is a failure, with a few special cases:
- Redirects are not followed. A 301 or 302 is a failure, and the dashboard shows the
Locationheader so you can fix the URL. - 429 Too Many Requests with a
Retry-Afterheader moves the next attempt to that time, if it’s later than the normal schedule. We cap it at one hour. Both the seconds and the HTTP-date forms are understood. - 410 Gone stops retries for that delivery straight away. Three 410s in a row from the same endpoint disable it.
- TLS errors (expired certificate, wrong host name) are failures like any other. We don’t offer a way to skip certificate checks on live endpoints.
Retry schedule#
A failed delivery is retried 11 more times, 12 attempts in total. Each delay gets ±15 % random jitter so that a recovering endpoint isn’t hit by every queued delivery in the same second.
| Attempt | Delay after previous | Time since first attempt |
|---|---|---|
| 1 | on receipt | 0 |
| 2 | 30 s | 30 s |
| 3 | 2 min | 2 min |
| 4 | 10 min | 12 min |
| 5 | 30 min | 42 min |
| 6 | 1 h | 1 h 42 min |
| 7 | 2 h | 3 h 42 min |
| 8 | 4 h | 7 h 42 min |
| 9 | 8 h | 15 h 42 min |
| 10 | 12 h | 1 d 3 h 42 min |
| 11 | 12 h | 1 d 15 h 42 min |
| 12 | 12 h | 2 d 3 h 42 min |
The last attempt happens about 2 d 3 h 42 min after the first one. Calling
POST /deliveries/{id}/retry runs an extra attempt immediately
and leaves the remaining schedule as it was. For a delivery that already failed, it makes one
more attempt; if that one fails as well, the delivery stays failed.
Why not longer
We get asked for a week. In practice, an endpoint that has been failing for two days needs a person, not more retries, and that person wants the backlog in one place. Failed deliveries stay in the log for your plan’s retention period and can be replayed in bulk from the dashboard.
Delivery attempts in the dashboard#
Ordering#
There is no ordering guarantee. Deliveries to one endpoint run in parallel, up to the endpoint’s
max_concurrency (10 by default), and any retry overtakes nothing and is overtaken by everything. If order
matters, use a timestamp or version from the payload itself: Stripe objects have created, Shopify
resources have updated_at.
Setting max_concurrency to 1 gives you in-order delivery while everything succeeds, and it’s fine
for low volumes. It does not survive a failure: the failed delivery waits for its retry while later events go out.
Idempotency#
Delivery is at-least-once. Your endpoint will occasionally see the same event twice: when your server processed a request but the response didn’t reach us within 15 seconds, when someone replays an event, or after a worker crash between sending and recording the result. Make handlers safe to run twice.
Deduplicate on APISync-Event-Id, not on APISync-Delivery-Id. A replay creates a new
delivery for the same event, so the delivery id changes and the event id doesn’t. A unique index on the event id
in whatever table the handler writes to is usually all it takes.
Idempotency keys on the API#
In the other direction, every POST on our REST API accepts an Idempotency-Key header.
We store the first response for 24 hours and return it for repeats with the same key. Reusing a key with a different
request body returns 409 idempotency_mismatch.
Headers on every delivery#
| Header | Example | Notes |
|---|---|---|
APISync-Delivery-Id | dlv_9cXr2TfB0wLq6nPe | Same on every attempt of a delivery. |
APISync-Event-Id | evt_5Jm1Rk8vQs2Hx7Ta | Use this for deduplication. |
APISync-Event-Type | orders.create | |
APISync-Source | src_7Hq2Lw9xVb3e | |
APISync-Attempt | 3 | Starts at 1. Added in 2.5.0. |
APISync-Timestamp | 1793715611 | Unix seconds, set per attempt. |
APISync-Signature | v1=34a0… | See Verifying signatures. |
User-Agent | APISync/2.6 (+https://apisynccloud.info/docs/) |
The original Content-Type is passed through, and so are the provider headers listed for each
provider on the Sources page. Static headers you set on the endpoint
(headers, up to 10) are added last and can’t override the APISync-* ones.
Raw and envelope format#
By default ("format": "raw") we send the body exactly as we received it, byte for byte. With
"format": "envelope" we send JSON that wraps it:
{
"id": "evt_5Jm1Rk8vQs2Hx7Ta",
"type": "payment.updated",
"source": "src_3Pn6Cz1Rw8Ka",
"received_at": "2026-11-03T14:20:10.912Z",
"headers": {
"content-type": "application/x-www-form-urlencoded"
},
"body": "id=tr_WDqYK6vllg",
"body_encoding": "utf-8"
}
Envelopes are useful for form-encoded senders like Mollie, or when one handler serves several sources. Bodies that
aren’t valid UTF-8 are base64-encoded and body_encoding says so.
When an endpoint gets disabled#
We disable an endpoint, and email everyone on the account with the Owner or Developer role, when:
- every attempt to it has failed for 5 days in a row, or
- it returned
410 Gonethree times in a row.
While an endpoint is disabled, new events for it are still stored, but its deliveries wait in pending.
When you enable it again (PATCH with "status": "enabled", or the button in the
dashboard), the backlog drains at the endpoint’s concurrency limit, oldest first. Anything older than your
retention period is gone by then.