# Delivery and retries Deliveries fail. Networks flap, receivers restart, a caller's server sits at 100% CPU for a minute. The platform's job is to keep trying, up to a bound; your job is to make sure a delivery is easy to handle when it arrives. ## Timeouts The platform waits **30 seconds** for a `2xx` response. Beyond 30 seconds, the delivery is treated as failed and enters the retry schedule — regardless of what your receiver eventually returns. The corollary: do not do slow work inline. Enqueue the payload, return `2xx` immediately, and let a background worker do the actual processing. ## Retry schedule Failed deliveries are retried on this exponentially-backing-off schedule: | Attempt | Wait after previous | |---------|---------------------| | 1 (initial) | — | | 2 | 1 minute | | 3 | 5 minutes | | 4 | 30 minutes | | 5 | 2 hours | | 6 (final) | 12 hours | Total: up to **6 attempts** over roughly 14 hours 36 minutes. After the sixth attempt, the delivery is marked permanently failed and does not retry again. In practice a receiver that stays down will see its subscription **paused before the sixth attempt** (see [Subscription auto-pause](#subscription-auto-pause)). Once a subscription is paused, its outstanding retries are dropped. ## What counts as failure - **Any non-2xx status code** — `4xx` and `5xx` both trigger retry. A persistent `4xx` from your receiver means your receiver is misconfigured; the platform will still retry per the schedule, but you're wasting your budget. - **Timeout** (no response within 30 seconds). - **TLS handshake failure** — an expired or untrusted certificate. - **DNS resolution failure**. ## Subscription auto-pause Each subscription keeps a **failure count**: every failed attempt adds one, and a single successful delivery resets it to zero. When the count reaches **5**, the subscription is **paused** and no further deliveries are attempted, including retries already scheduled, until you re-enable it in the portal. Because the count goes up on every attempt, one event failing five times in a row is enough. With the schedule above, a receiver that goes down and stays down is paused about **2 hours 36 minutes** after the first failed attempt. A subscription is also paused immediately, with no retry, if its URL stops resolving to a public address (see [Subscribe to events](subscribe.md#create-a-subscription)). When you fix the receiver, re-enable the subscription; new deliveries resume. Events that occurred while it was paused are **not** re-sent. Re-read the resources you care about from the API to catch up. ## The delivery log The portal's **Delivery log** for a subscription shows every delivery attempt: when it was made, the event, the delivery id, the attempt number, the HTTP status your receiver returned, the response time, and the outcome (delivered, failed and awaiting retry, or expired). It's your first stop when a receiver misses something. The **delivery id** is the `X-Gallantree-Delivery` header value. It is the same on every attempt of one event to one subscription, so it ties together all the rows for that delivery. Quote it when you contact support about a delivery. Deliveries are retained for **30 days** in the log. Longer-term reliability metrics live in your own monitoring — hook into your receiver's success/failure count. ## Duplicate deliveries The retry logic can produce duplicates. In particular: - Your receiver returned `2xx` but the platform never received it (network partition after your response). - Your receiver processed the delivery, crashed, then restarted, and the platform retries before it can recover. **Deduplicate on a SHA-256 hash of the raw request body.** A retry re-sends the original event body byte-for-byte, so the hash (and the signature) is the same on every attempt. The body includes the event's `timestamp` and identifiers, so two different events produce different hashes. Record the hash in your receiver's dedupe store and no-op on the second occurrence. Keep entries for at least **15 hours** so they cover the full retry schedule; 24 hours is a comfortable default. `X-Gallantree-Delivery` is also the same on every attempt, and you can use it as a dedupe key. The body hash is the safer choice, though: headers are not covered by the signature, so someone replaying a captured delivery can change the header but not the body. (Deliveries first sent before November 2026 used a new `X-Gallantree-Delivery` on every attempt.) ## Ordering Deliveries are **not guaranteed to arrive in order**. Two events on the same resource — say two `loan.status_changed` events a minute apart — may reach your receiver out of order because the second one succeeded on the first attempt and the first one had to retry. Compare `data.previousStatus` / `data.newStatus` with what you hold, or simply re-read the loan. If order matters for your integration, fetch the current resource state from the API when you handle the event (using its `id` from the payload). The API is the source of truth; the webhook is a nudge to look. ## Replaying a delivery There is no replay endpoint or button today. To exercise your receiver during triage, use the portal's **Send test** button (test deliveries carry `X-Gallantree-Test: true` and `{ "test": true }` as `data`). To recover from a missed event, re-read the affected resource from the API: it is always the source of truth.