<!-- source: https://secondlayer.tools/docs/api-reference#replay-webhook -->

## Replay a block range

`POST /api/webhooks/{id}/replay` (self-hosted instances only)

Queues historical events in a block range for redelivery, capped at 100,000 blocks. Replays are idempotent: the same range yields the same `replayId` and delivers nothing twice unless `force` is set. They drain through a 10% share of the outbox so live traffic keeps priority, and never move the live cursor. Replays deliver the normal `chain.<type>.apply` envelope. Watch one with `GET /api/webhooks/{id}/replays/{replay_id}`.

### Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `id` | string, required | Webhook id (UUID), as returned by create or list. |

### Body

| Field | Type | Description |
| --- | --- | --- |
| `fromBlock` | integer, required | First block, inclusive. |
| `toBlock` | integer, required | Last block, inclusive. At most 100,000 blocks after `fromBlock`. |
| `force` | string | Any string, up to 64 characters. Makes a new `replayId`, so an already-replayed range delivers again. |

### Returns

One `WebhookReplayResult` object.

### Responses

- `202` Replay queued
- `400` A parameter, filter, cursor or body field was refused; `code` says which. Also: `fromBlock` after `toBlock`, or a range over 100,000 blocks
- `401` This bind requires the instance token, and it was missing or wrong
- `404` No webhook with this id
- `409` A replay of this webhook is still scanning its range
- `415` Missing or non-JSON `Content-Type` (`UNSUPPORTED_MEDIA_TYPE`) — writes must send `Content-Type: application/json`
- `500` The replay could not be queued (`INTERNAL_ERROR`)

### Example

```bash
curl -X POST http://127.0.0.1:3800/api/webhooks/{id}/replay \
  -H "Authorization: Bearer $INSTANCE_TOKEN" \
  --json '{
  "fromBlock": 8650000,
  "toBlock": 8700000
}'
```

```json
{
  "replayId": "a41f09c3d27e8b65",
  "enqueuedCount": 312,
  "scannedCount": 4870
}
```
