# Replay events

Source: https://help.ruuster.com/api/webhooks-replay

```http
POST https://api.ruuster.com/v1/webhooks/{webhookId}/replay
```

Re-send a subscription's events from a time window, with their original ids.

- Authentication: `x-api-key` and `x-email` headers of an owner or admin
- Rate limit: 120 requests per minute per key
- Changes only your webhook subscriptions, never your Ruuster data

## Path parameters

| Name | Type | Description |
|---|---|---|
| `webhookId` | string | The subscription id, `whk_…` |

## Body

JSON, `Content-Type: application/json`, at most 64 KB.

| Name | Type | Required | Description |
|---|---|---|---|
| `from` | timestamp | yes | Start of the window, ISO 8601 |
| `to` | timestamp | yes | End of the window. At most 7 days after `from`, within the last 30 days |
| `onlyFailed` | boolean | no | `true` re-sends only events whose delivery failed |

Replayed events keep their original `id`, so de-duplication on your side still works. See [Replay and the event feed](https://help.ruuster.com/api/webhook-replay).

## Response

`queued` is the number of events re-queued.

## Example request

cURL:

```bash
curl -s -X POST "https://api.ruuster.com/v1/webhooks/whk_2c7f9a4e1b/replay" \
  -H "x-api-key: $RUUSTER_API_KEY" \
  -H "x-email: $RUUSTER_EMAIL" \
  -H "Content-Type: application/json" \
  -d '{"from":"2026-09-30T00:00:00Z","to":"2026-10-01T00:00:00Z","onlyFailed":false}'
```

Node.js:

```javascript
const res = await fetch("https://api.ruuster.com/v1/webhooks/whk_2c7f9a4e1b/replay", {
  method: "POST",
  headers: {
    "x-api-key": process.env.RUUSTER_API_KEY,
    "x-email": process.env.RUUSTER_EMAIL,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "from": "2026-09-30T00:00:00Z",
    "to": "2026-10-01T00:00:00Z",
    "onlyFailed": false
  }),
});
const body = await res.json();
if (!body.ok) throw new Error(`${body.error.code}: ${body.error.message} (${body.requestId})`);
console.log(body.data);
```

Python:

```python
import os
import requests

res = requests.post(
    "https://api.ruuster.com/v1/webhooks/whk_2c7f9a4e1b/replay",
    headers={"x-api-key": os.environ["RUUSTER_API_KEY"], "x-email": os.environ["RUUSTER_EMAIL"]},
    json={
        "from": "2026-09-30T00:00:00Z",
        "to": "2026-10-01T00:00:00Z",
        "onlyFailed": False,
    },
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(f'{body["error"]["code"]}: {body["error"]["message"]} ({body.get("requestId")})')
print(body["data"])
```

## Example response

```json
{ "ok": true, "data": { "queued": 23, "from": "2026-09-30T00:00:00Z", "to": "2026-10-01T00:00:00Z", "eventsKeepOriginalIds": true } }
```
