> For the complete documentation index, see [llms.txt](https://docs.tokenbot.com/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tokenbot.com/home/api-docs/webhooks/delivery.md).

# Delivery

## Delivery Behavior

* Requests are sent as HTTP POST with `Content-Type: application/json`
* Your endpoint must respond with `2xx` within 30 seconds
* Non-2xx responses or timeouts trigger retries

## Retry Policy

Failed deliveries are retried with exponential backoff, up to **5 attempts**:

| Attempt | Delay before attempt |
| ------- | -------------------- |
| 1       | Immediate            |
| 2       | 5 seconds            |
| 3       | 30 seconds           |
| 4       | 2 minutes            |
| 5       | 10 minutes           |

After the final failed attempt, the delivery is moved to the dead letter queue (DLQ).

## Dead Letter Queue

Failed deliveries are stored in the DLQ for manual inspection and replay.

### DLQ Endpoints

| Method | Path                                      | Description                           |
| ------ | ----------------------------------------- | ------------------------------------- |
| GET    | `/webhooks/:id/dead-letters`              | List dead letters                     |
| GET    | `/webhooks/:id/dead-letters/:dlqId`       | Get dead letter (includes payload)    |
| POST   | `/webhooks/:id/dead-letters/:dlqId/retry` | Retry a pending dead letter           |
| DELETE | `/webhooks/:id/dead-letters/:dlqId`       | Discard a pending dead letter         |
| GET    | `/webhooks/:id/dead-letters/stats`        | DLQ stats (pending/retried/discarded) |

### Retry a Failed Delivery

```bash
curl -X POST https://api.tokenbot.com/v1/webhooks/wh_123/dead-letters/dlq_456/retry \
  -H "X-API-Key: tb_live_your_key"
```

## Idempotency

Each event includes a unique `event_id`. Use this to deduplicate events in case of retries or replays.

## Disabling Webhooks

If your endpoint fails consistently (10+ consecutive failures), the webhook may be automatically deactivated. You'll receive an email notification.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tokenbot.com/home/api-docs/webhooks/delivery.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
