> ## Documentation Index
> Fetch the complete documentation index at: https://docs.budecosystem.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhook and Retry Patterns

> Design resilient integration patterns for asynchronous and transient-failure scenarios

## Resilience Pattern Overview

Use retries for transient failures and webhooks/events for asynchronous business workflows.

```mermaid theme={null}
flowchart LR
    A[App Request] --> B[Bud API]
    B -->|2xx| C[Success]
    B -->|429/5xx| D[Retry with Backoff]
    D --> B
    C --> E[Emit Business Event]
    E --> F[Webhook Consumer]
```

## Retry Recommendations

* Retry on `429`, `500`, `502`, `503`, `504`.
* Use exponential backoff with jitter.
* Cap max attempts and total retry window.
* Log every attempt with reason and delay.

## Webhook/Event Workflow Guidance

* Treat webhooks as at-least-once delivery.
* Verify signatures where applicable.
* Make consumers idempotent.
* Persist delivery attempts for audits.

## Operational Guardrails

* Separate user-facing timeout from background retry timeout.
* Alert on sustained error-rate increases.
* Track queue depth and callback lag for async workloads.
