
# Replay events to a webhook endpoint

`POST /v1/webhook-endpoints/{endpoint_id}:replay` · permission `webhook-endpoints:write` · all plans

Queues again the events of `[from, to)` within the last 30 days, for example the events of a period in which the endpoint was disabled. Only the endpoint's event types are sent unless `types` narrows them. Each replayed delivery keeps the event's `webhook-id`, so a receiver that removes duplicates by `webhook-id` processes each event once; `replay_no` on the delivery grows by one.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `endpoint_id` | path | yes | Webhook endpoint ID (`whe_…`). |
| `from` | date-time | yes | Start of the range (inclusive), within the last 30 days. |
| `to` | date-time | yes | End of the range (exclusive), after `from`. |
| `types` | string[] | no | Event types to replay; empty or missing means the endpoint's types. |
| `Idempotency-Key` | header | no | Replays the response for a repeated request with the same key, without queueing again. |

```json
{
  "from": "2026-10-20T00:00:00Z",
  "to": "2026-10-21T00:00:00Z",
  "types": ["user.created"]
}
```

## Response

`200 OK` with the number of queued deliveries.

```json
{
  "enqueued": 42
}
```

## Errors

| HTTP | code | When |
|---|---|---|
| 400 | `unknown_field` | The body has a field that is not listed above. |
| 404 | `not_found` | No such endpoint in this environment. |
| 415 | `unsupported_media_type` | The body is missing or not `application/json`. |
| 422 | `validation_failed` | `/from required`, `/to required`, or a range rule: `to` not after `from`, or older than 30 days. |
| 401 | `unauthenticated` | The credential is missing, invalid or revoked. |
| 403 | `insufficient_permissions` | The credential lacks `webhook-endpoints:write`. |
| 503 | `service_unavailable` | Replay is not available yet in this region, or webhook administration is temporarily unavailable; retry after `Retry-After`. |

## Example

```bash
curl -X POST https://api.eu.keenauth.com/v1/webhook-endpoints/whe_01k8a3m5q7t9v1w3x5y7z9b2c4:replay \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7a1c3e5f-9b2d-4f6a-8c0e-2b4d6f8a0c2e" \
  -d '{"from":"2026-10-20T00:00:00Z","to":"2026-10-21T00:00:00Z"}'
```

CLI (the body comes from standard input or a file (`--data @replay.json`)):

```bash
echo '{"from":"2026-10-20T00:00:00Z","to":"2026-10-21T00:00:00Z"}' | keenauth webhook-endpoints replay whe_01k8a3m5q7t9v1w3x5y7z9b2c4 --data -
```
