# Replay events

Source: https://docs.coderhelm.com/api/reference/webhook-endpoints/replay-webhook-events

`POST /api/webhooks/endpoints/{endpoint_id}/replay`

Sends the kept events made in a time range to this endpoint again, each as a new delivery with retries, oldest first. Only event types the endpoint subscribes to now are sent. Events carry their original `id`, so a receiver that already handled one can skip it. At most 500 per call; events are kept 14 days.

## Authentication

A team API key: `Authorization: Bearer chk_...`. The key needs the `webhooks` scope. See [Authentication](https://docs.coderhelm.com/api/authentication).

## Parameters

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `endpoint_id` | string | yes | The endpoint's id. |

## Request body

`application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `only_failed` | boolean | no | Only events whose deliveries to this endpoint all failed, or that it never got. Defaults to `false` (every event it subscribes to). |
| `since` | string | yes | RFC 3339. At most 14 days ago (events are kept that long). |
| `until` | string or null | no | RFC 3339. Defaults to now. |

## Responses

### 202

Queued.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `capped` | boolean | yes | More matched than one replay sends (500); replay again from the last one. |
| `found` | integer | yes | Kept events in the range (of every type). |
| `queued` | integer | yes | Events queued to send again. |

Headers: `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`.

### 400

The range is not valid, or the endpoint is off.

### 401

The key is missing, malformed, revoked or expired, or the person who made it left the team.

### 403

The key lacks the scope this endpoint needs (`missing_scope`).

### 404

No such endpoint on this team.

### 429

Over the key's rate limit (`rate_limited`), or, for endpoints that start work, over the team's monthly token limit (`token_limit_reached`).

Headers: `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, `Retry-After`.

### 500

Something failed on CoderHelm's side. Safe to retry reads.

## Example request

cURL:

```bash
curl -X POST 'https://api.coderhelm.com/api/webhooks/endpoints/ep_01jbendpt4a7b0c3d6e9f2g5h8/replay' \
  -H "Authorization: Bearer $CODERHELM_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "only_failed": true,
  "since": "2026-10-25T00:00:00Z",
  "until": "2026-10-26T00:00:00Z"
}'
```

TypeScript:

```ts
const res = await fetch("https://api.coderhelm.com/api/webhooks/endpoints/ep_01jbendpt4a7b0c3d6e9f2g5h8/replay", {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CODERHELM_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
      "only_failed": true,
      "since": "2026-10-25T00:00:00Z",
      "until": "2026-10-26T00:00:00Z"
    }),
});
if (!res.ok) {
  const { error, code } = await res.json();
  throw new Error(`${res.status} ${code}: ${error}`);
}
const data = await res.json();
```

Python:

```python
import os
import requests

headers = {
    "Authorization": f"Bearer {os.environ['CODERHELM_API_KEY']}",
}
body = {
    "only_failed": True,
    "since": "2026-10-25T00:00:00Z",
    "until": "2026-10-26T00:00:00Z",
}
res = requests.request("POST", "https://api.coderhelm.com/api/webhooks/endpoints/ep_01jbendpt4a7b0c3d6e9f2g5h8/replay", headers=headers, json=body)
if not res.ok:
    raise RuntimeError(f"{res.status_code}: {res.json().get('error')}")
data = res.json()
```

## Example response

```json
{
  "capped": false,
  "found": 40,
  "queued": 12
}
```
