# Webhooks

Youniton sends signed webhooks to your HTTPS endpoints, and it can receive signed webhooks that start automation flows. Both use the Standard Webhooks signature.

- [Receive Youniton webhooks](https://docs.youniton.com/api/guides/receive-webhooks.md): Verify the signature, deduplicate and answer fast.
- [Send webhooks to Youniton](https://docs.youniton.com/api/guides/automation-inbound-webhooks.md): Sign a call that starts an automation flow.

## Outgoing webhooks

An Admin registers HTTPS endpoints in **Administration › Automation › Webhooks**. Two sources send to them:

- **Automation rules** with the action "send webhook". The payload holds only the fields that the rule lists.
- **Help-desk connections** that subscribe to request events: `request.created`, `request.updated`, `request.message_posted`, `request.decided` and `request.closed`.

Endpoints are closed to project rules by default. Only an Admin's tenant rules can send data out until an Admin opens the endpoint.

### The headers of a delivery

*POST to your endpoint*

```http
POST /youniton/webhooks HTTP/1.1
Host: hooks.example.com
Content-Type: application/json
User-Agent: Youniton-Webhooks/1
webhook-id: 0192f1b4-1d2e-7a3b-9c4d-5e6f7a8b9c0d
webhook-timestamp: 1792502400
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
```

| Header | Meaning |
|---|---|
| `webhook-id` | The id of the delivery. It stays the same over every retry and every redelivery. Deduplicate on it. |
| `webhook-timestamp` | Unix seconds of this attempt. It is new for each attempt. |
| `webhook-signature` | `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{body}`. During a secret rotation it holds two signatures, separated by a space. |

### The secret

Each endpoint has a secret that starts with `whsec_` (32 random bytes, base64). Youniton shows it one time, at creation. A rotation shows the new secret one time and keeps the old one for 24 hours; in that time each delivery carries both signatures.

### The payload of a rule

*Body of an automation delivery*

```json
{
  "id": "0192f1b4-1d2e-7a3b-9c4d-5e6f7a8b9c0d",
  "type": "…",
  "occurredAt": "2026-10-20T13:10:00Z",
  "tenantId": "…",
  "rule": { "id": "…", "version": 3, "name": "…" },
  "trigger": { "type": "…", "eventId": "…" },
  "subject": { "type": "ticket", "id": "…", "key": "ORB-124" },
  "data": { }
}
```

`data` holds only the fields that the rule's action lists, as the rule's owner may see them. A payload is at most 64 KiB. Youniton freezes the bytes when the rule step runs: a retry sends exactly the same bytes.

### Retries

| Your answer | What Youniton does |
|---|---|
| any `2xx` within 10 seconds | the delivery is delivered |
| `410 Gone` | Youniton disables the endpoint |
| another status, a timeout or a network error | retry after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h (about 45 hours). Then the delivery is `failed` and the Admins get a notice |

An endpoint that fails for 3 days in a row pauses. One success makes it active again. An Admin can redeliver a failed delivery under the same `webhook-id` while its payload is stored (7 days), and can send a test delivery of type `kanseo.test`.

> **Where the data goes**
>
> Your endpoint can be in any region. The receiver is your own transfer, outside Youniton's EU processing. A tenant can limit the hosts with an allow-list.

## Incoming webhooks for Automation

Another system can start an automation flow with a signed `POST` to `https://app.youniton.example/webhooks/automation/{endpointId}`. The signature is the same Standard Webhooks scheme.

> **Off by default**
>
> Incoming webhooks are off for a tenant until an Admin turns them on (with a fresh sign-in) and registers an endpoint. An endpoint is closed to project flows until an Admin opens it.

Read [Automation inbound webhooks](https://docs.youniton.com/api/guides/automation-inbound-webhooks.md) for the signing code and the answers.

## Calls back into Youniton

When your receiver calls the public API because of a delivery, send `X-Kanso-Causation: <webhook-id>`. Youniton then counts the events that your call causes in the same automation chain, so a loop stops at the chain's depth limit.
