# Replay webhook events

> Queues the events since a given time (at most 7 days back, at most 10000 events) for delivery to this endpoint again. Only events the endpoint subscribes to are queued. Requires an Idempotency-Key and sends no messages to contacts.

Last updated: 2026-10-25. Source: https://docs.smartchat.marketing/en/api/reference/webhooks/replay_webhook_events/

Queues the events since a given time (at most 7 days back, at most 10000 events) for delivery to this endpoint again. Only events the endpoint subscribes to are queued. Requires an Idempotency-Key and sends no messages to contacts.

`POST /v1/webhook-endpoints/{endpoint_id}/replay`

| | |
|---|---|
| Permission | `webhooks:write` ([all permissions](https://docs.smartchat.marketing/en/api/permissions/)) |
| Risk | Write (no outside effect) |
| Idempotency-Key | Required ([how it works](https://docs.smartchat.marketing/en/concepts/idempotency/)) |
| Safe to repeat | Safe to repeat with the same Idempotency-Key: the first answer comes back and nothing is done twice. |
| Rate limit class | `write` (120 requests per minute per key) |
| Confirmation | None |
| MCP tool | Not available in MCP |
| Since version | 2026-10-25 |

## What it does

- Changes data in your account. It does not send messages to contacts.
- Acts on a connected outside system.
- Safe to repeat with the same Idempotency-Key.

## Request

**Header**

| Name | Required | Description |
|---|---|---|
| `Authorization` | yes | `Bearer <key>` |
| `Idempotency-Key` | yes | A unique value for this operation, for example a UUID (1 to 255 visible ASCII characters). |

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `endpoint_id` | string | Webhook endpoint ID. |

**Body** (JSON)

| Name | Type | Required | Description |
|---|---|---|---|
| `since` | string | yes | Replay the events created at or after this time (at most 7 days back). up to 40 characters; format date-time |

## Examples

**curl**

```bash
curl -X POST "https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/replay" \
  -H "Authorization: Bearer $SMARTCHAT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "since": "2026-10-24T00:00:00Z"
}'
```

**Python**

```python
import os
import uuid
import requests

response = requests.post(
    "https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/replay",
    headers={
        "Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "since": "2026-10-24T00:00:00Z",
    },
)
response.raise_for_status()
print(response.json())
```

**TypeScript**

```typescript
const response = await fetch("https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/replay", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "since": "2026-10-24T00:00:00Z"
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

Response (202):


```json
{
  "object": "webhook_replay",
  "endpoint_id": "whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
  "since": "2026-10-24T00:00:00Z",
  "queued": 12,
  "truncated": false
}
```

## Response

Status 202. Every response has the headers `Request-Id`, `SmartChat-Version` and `X-RateLimit-*`.

| Name | Type | Description |
|---|---|---|
| `object` | string | Always "webhook_replay". always `webhook_replay` |
| `endpoint_id` | string | Endpoint that receives the events. |
| `since` | string | Start of the replay window as used. up to 40 characters; format date-time |
| `queued` | integer | Number of events queued for delivery. 0 to 10000 |
| `truncated` | boolean | True if more than 10000 events matched; the oldest 10000 were queued. |

## Errors

| Code | Status | When |
|---|---|---|
| [`idempotency_key_invalid`](https://docs.smartchat.marketing/en/errors/#idempotency_key_invalid) | 400 | The 'Idempotency-Key' header must be 1 to 255 visible ASCII characters. |
| [`idempotency_key_required`](https://docs.smartchat.marketing/en/errors/#idempotency_key_required) | 400 | This call needs an 'Idempotency-Key' header. |
| [`api_key_expired`](https://docs.smartchat.marketing/en/errors/#api_key_expired) | 401 | This API key has expired. |
| [`api_key_invalid`](https://docs.smartchat.marketing/en/errors/#api_key_invalid) | 401 | This API key is not valid. |
| [`api_key_revoked`](https://docs.smartchat.marketing/en/errors/#api_key_revoked) | 401 | This API key was revoked. |
| [`authentication_required`](https://docs.smartchat.marketing/en/errors/#authentication_required) | 401 | No API key was sent. Send 'Authorization: Bearer <key>'. |
| [`insufficient_scope`](https://docs.smartchat.marketing/en/errors/#insufficient_scope) | 403 | This key lacks a required permission. |
| [`ip_not_allowed`](https://docs.smartchat.marketing/en/errors/#ip_not_allowed) | 403 | This IP address is not allowed for this key. |
| [`endpoint_not_found`](https://docs.smartchat.marketing/en/errors/#endpoint_not_found) | 404 | No webhook endpoint with this ID exists in this account. |
| [`conflict`](https://docs.smartchat.marketing/en/errors/#conflict) | 409 | The state of the object does not allow this. |
| [`idempotency_in_progress`](https://docs.smartchat.marketing/en/errors/#idempotency_in_progress) | 409 | A request with this idempotency key is still running. |
| [`idempotency_key_reused`](https://docs.smartchat.marketing/en/errors/#idempotency_key_reused) | 422 | This idempotency key was already used with a different request. |
| [`validation_failed`](https://docs.smartchat.marketing/en/errors/#validation_failed) | 422 | A field is not valid. |
| [`rate_limited`](https://docs.smartchat.marketing/en/errors/#rate_limited) | 429 | Too many requests. Wait and try again. |
| [`internal_error`](https://docs.smartchat.marketing/en/errors/#internal_error) | 500 | Something went wrong on our side. |

All errors use [one format](https://docs.smartchat.marketing/en/concepts/errors-overview/).
