# API-Referenz: Webhooks

> Endpunkte der Gruppe «Webhooks» der Sendtide API mit Parametern, Request-Body, Antworten und curl-Beispielen. Die Referenz ist auf Englisch.

URL: https://sendtide.ch/docs/api/webhooks/

12 Endpunkte der Gruppe «Webhooks». Die Referenz stammt aus der englischen OpenAPI-Spezifikation und ist nicht übersetzt.
## List webhooks

GET /v1/webhooks
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| limit | query | integer | Page size. The default and the maximum depend on the endpoint (emails 50 up to 500, received mail 50 up to 200, audit up to 200, the others 100 up to 500 or 1000). Default: 100 |
| cursor | query | string | The next_cursor of the previous page. Opaque; pass it unchanged to the same endpoint with the same filters. |
### Beispiel

```
curl "https://api.sendtide.ch/v1/webhooks" \
  -H "Authorization: Bearer sk_test_…"
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 200 | Webhooks |
## Add a webhook

POST /v1/webhooks
The answer contains the signing secret, only this once.
### Request-Body application/json
| Feld | Typ | Beschreibung |
| --- | --- | --- |
| url * | string (uri) | https only |
| events | array | Empty for all events |
### Beispiel

```
curl -X POST "https://api.sendtide.ch/v1/webhooks" \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/webhooks/sendtide","events":["email.delivered","email.bounced"]}'
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 201 | Added Webhook |
## Change a webhook

PATCH /v1/webhooks/{id}
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
### Request-Body application/json
| Feld | Typ | Beschreibung |
| --- | --- | --- |
| url | string | |
| events | array | |
| enabled | boolean | |
### Beispiel

```
curl -X PATCH "https://api.sendtide.ch/v1/webhooks/wh_1" \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{"enabled":false}'
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 200 | Updated Webhook |
## Remove a webhook

DELETE /v1/webhooks/{id}
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
### Beispiel

```
curl -X DELETE "https://api.sendtide.ch/v1/webhooks/wh_1" \
  -H "Authorization: Bearer sk_test_…"
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 204 | Removed |
## Send a test event now

POST /v1/webhooks/{id}/test
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
### Beispiel

```
curl -X POST "https://api.sendtide.ch/v1/webhooks/wh_1/test" \
  -H "Authorization: Bearer sk_test_…"
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 200 | Result |
## Deliveries of a webhook, newest first

GET /v1/webhooks/{id}/deliveries
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
| status | query | enum: pending / delivered / failed | |
| limit | query | integer | Page size. The default and the maximum depend on the endpoint (emails 50 up to 500, received mail 50 up to 200, audit up to 200, the others 100 up to 500 or 1000). Default: 100 |
| cursor | query | string | The next_cursor of the previous page. Opaque; pass it unchanged to the same endpoint with the same filters. |
### Beispiel

```
curl "https://api.sendtide.ch/v1/webhooks/wh_1/deliveries" \
  -H "Authorization: Bearer sk_test_…"
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 200 | Deliveries |
## Send the event of a delivery again

POST /v1/webhooks/{id}/deliveries/{delivery_id}/retry
Creates a new delivery with the same event (same event id in the payload). A delivery that is still pending answers 409 delivery_pending, a disabled webhook 409 webhook_disabled.
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
| delivery_id * | path | integer | |
### Beispiel

```
curl -X POST "https://api.sendtide.ch/v1/webhooks/wh_1/deliveries/42/retry" \
  -H "Authorization: Bearer sk_test_…"
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 202 | Queued |
| 404 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
| 409 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
## Send the events of a time range again

POST /v1/webhooks/{id}/replay
Queues the mail events of the range from to to again (at most 7 days back, at most 50'000 events, else 422 too_many_events), limited to the webhook's own event types and to events if given. Every event gets a new delivery with its old event id. An event that still has a pending delivery is skipped, so repeating a replay sends nothing twice. email.received and email.unsubscribed cannot be replayed.
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
### Request-Body application/json
| Feld | Typ | Beschreibung |
| --- | --- | --- |
| from * | string (date-time) | |
| to * | string (date-time) | |
| events | array | |
### Beispiel

```
curl -X POST "https://api.sendtide.ch/v1/webhooks/wh_1/replay" \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{"from":"2026-11-28T00:00:00Z","to":"2026-11-29T00:00:00Z","events":["email.bounced"]}'
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 202 | Queued |
| 409 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
| 422 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
## Start the CLI listener of the key

POST /v1/webhooks/listen
For sendtide listen: receive the mail events of the account while the CLI runs, without a public webhook endpoint. Every API key has one listener; starting it again keeps its id and secret (the local app keeps verifying) and receives the events recorded from now on. It sees the mail of its own environment only (a test key the mail of test keys). The listener is independent of the webhooks: it creates no deliveries and changes nothing for them. It expires 5 minutes after the last poll. Needs an API key (any scope), not a dashboard session. email.received and email.unsubscribed are not available to listeners.
### Request-Body application/json
| Feld | Typ | Beschreibung |
| --- | --- | --- |
| events | array | Empty or missing: all mail events |
### Beispiel

```
curl -X POST "https://api.sendtide.ch/v1/webhooks/listen" \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{}'
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 200 | The listener WebhookListener |
| 403 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
| 422 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
## Wait for the next events of the CLI listener

GET /v1/webhooks/listen/{id}/events
Long poll: the events after cursor, oldest first, at most 100, in the same body as a webhook delivery (sign them with the listener's secret to forward them). Waits up to wait seconds for the first event and answers with an empty data otherwise. Poll again with next_cursor; every poll keeps the listener alive. At most two open polls per key (429). 410 listener_expired after 5 minutes without a poll or after DELETE.
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
| cursor | query | string | The cursor of the start or the next_cursor of the previous answer; default: the start |
| wait | query | integer | Seconds to wait for the first event Default: 20 |
### Beispiel

```
curl "https://api.sendtide.ch/v1/webhooks/listen/wl_8kq2m4bt/events" \
  -H "Authorization: Bearer sk_test_…"
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 200 | Events |
| 404 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
| 410 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
| 422 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
| 429 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
## Stop the CLI listener

DELETE /v1/webhooks/listen/{id}
Ends the listener at once (the CLI does it on exit). Its secret stays for the next start.
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| id * | path | string | |
### Beispiel

```
curl -X DELETE "https://api.sendtide.ch/v1/webhooks/listen/wh_1" \
  -H "Authorization: Bearer sk_test_…"
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 204 | Stopped |
| 404 | Fehler im üblichen Format, [Fehler und Limits](https://sendtide.ch/docs/fehler-und-limits/) |
## An event of a sent or received mail

POST dein Endpunkt
Signed with Sendtide-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>" with the webhook secret>. Reject signatures older than five minutes. Answer with any 2xx; otherwise Sendtide retries for 24 hours.
### Parameter
| Name | Ort | Typ | Beschreibung |
| --- | --- | --- | --- |
| Sendtide-Signature * | header | string | t=,v1= |
### Request-Body application/json
| Feld | Typ | Beschreibung |
| --- | --- | --- |
| id | string | Example: evt_42 |
| type | enum: email.queued / email.sent / email.delivered / email.delayed / email.opened / email.machine_opened / email.clicked / email.bounced / email.complained / email.rejected / email.failed / email.suppressed / email.canceled / email.held / email.unsubscribed / email.received | |
| created_at | string (date-time) | |
| data | object | |
### Beispiel

```
curl -X POST "https://your-server.example/webhooks/sendtide" \
  -H "Content-Type: application/json" \
  -H "Sendtide-Signature: t=1795000000,v1=…" \
  -d '{"id":"evt_42","type":"email.delivered","created_at":"2026-12-01T08:00:03Z","data":{"email_id":"msg_8kq2m4bt","from":"hello@example.ch","to":["anna@example.com"],"subject":"Willkommen","tags":[],"metadata":{},"stream":"transactional"}}'
```
### Antworten
| Status | Beschreibung |
| --- | --- |
| 2xx | Any 2xx confirms the delivery. |
