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:

StatusMeaning
pendingCreated, first attempt not finished yet.
retryingAt least one attempt failed and another one is scheduled.
succeededAn attempt got a 2xx response.
failedAll 12 attempts failed, or the endpoint answered 410 Gone.
cancelledCancelled 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 Location header so you can fix the URL.
  • 429 Too Many Requests with a Retry-After header 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.

AttemptDelay after previousTime since first attempt
1on receipt0
230 s30 s
32 min2 min
410 min12 min
530 min42 min
61 h1 h 42 min
72 h3 h 42 min
84 h7 h 42 min
98 h15 h 42 min
1012 h1 d 3 h 42 min
1112 h1 d 15 h 42 min
1212 h2 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#

Screenshot of a
delivery in the dashboard: three attempts, a timeout, a 503 and a 200
A delivery that needed three attempts. The first timed out at 15 s, the second got a 503 from the load balancer in front of the app during a deploy.

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#

HeaderExampleNotes
APISync-Delivery-Iddlv_9cXr2TfB0wLq6nPeSame on every attempt of a delivery.
APISync-Event-Idevt_5Jm1Rk8vQs2Hx7TaUse this for deduplication.
APISync-Event-Typeorders.create
APISync-Sourcesrc_7Hq2Lw9xVb3e
APISync-Attempt3Starts at 1. Added in 2.5.0.
APISync-Timestamp1793715611Unix seconds, set per attempt.
APISync-Signaturev1=34a0…See Verifying signatures.
User-AgentAPISync/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 Gone three 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.

Last updated 4 Nov 2026