> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rasen.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rasen.ai/_mcp/server.

# Webhook events

> Every webhook event type with its payload schema and when Rasen sends it, plus the request headers, the event envelope and the body size rules.

## Summary

This page lists every webhook event type, the headers of each request, the event envelope and the
body size rules. It does not cover endpoints, signature checks, retries or resends; see
[Receive call events with webhooks](/guides/webhooks).

| Event            | Sent when                                                                                                                                                                                                                                                                                            | Payload schema                                                                         |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `call.completed` | A connected call (media was accepted) left active. Once for each call. `Call.end_reason` says why it ended, for example `agent_hangup` when the agent ended the call or `line_dropped` when the line of an answered call failed. The transcript is not in this event; it comes with `call.analyzed`. | `CallCompletedEvent`. `data` is `WebhookCallData` (`call`) or `WebhookReducedCallData` |
| `call.failed`    | A call ended without connecting: it was aborted, or it ended with no media accepted. Once for each call. `Call.dial_outcome` and `Call.dial_sip_code` say why. A call gets exactly one of `call.completed` and `call.failed`.                                                                        | `CallFailedEvent`. `data` is `WebhookCallData` (`call`) or `WebhookReducedCallData`    |
| `call.analyzed`  | Only for a call that got `call.completed`. Once, when the transcript, the recording state and the extraction are final, or 6 hours after the call ended, whichever comes first. A later repair or re-analysis sends no second event.                                                                 | `CallAnalyzedEvent`. `data` is `WebhookCallAnalyzedData` or `WebhookReducedCallData`   |
| `webhook.test`   | `sendWebhookTestEvent` created it, for one endpoint only, whatever the `events` list of that endpoint. An endpoint cannot subscribe to it.                                                                                                                                                           | `WebhookTestEvent`. `data.message` is a string                                         |

## Request headers

Each request is a `POST` with these headers.

| Header              | Value                                                                                                                                                                                         |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `content-type`      | `application/json`                                                                                                                                                                            |
| `user-agent`        | `Rasen-Webhooks/1.0`                                                                                                                                                                          |
| `webhook-id`        | The event id (`WebhookEvent.id`), `wevt_` and 26 characters. The same value on every attempt, retry and resend of that event                                                                  |
| `webhook-timestamp` | Unix time in seconds of this attempt, not of the event. 1 to 12 digits                                                                                                                        |
| `webhook-signature` | One or two space-separated values, each `v1,<base64 HMAC-SHA256>`, at most 256 characters. Two values during a rotation grace period: one for the current secret, one for the previous secret |

| Signature input | Value                                                                              |
| --------------- | ---------------------------------------------------------------------------------- |
| Signed content  | `{webhook-id}.{webhook-timestamp}.{body}`, where `body` is the exact request bytes |
| HMAC key        | The base64-decoded part of the secret after `whsec_` (32 bytes)                    |
| Algorithm       | HMAC-SHA256                                                                        |

## Envelope

Every event body is a JSON object with these fields (`WebhookEventEnvelope`).

| Field          | Type               | Value                                                                               |
| -------------- | ------------------ | ----------------------------------------------------------------------------------- |
| `id`           | string             | The event id, equal to the `webhook-id` header (prefix `wevt_`)                     |
| `type`         | string             | `call.completed`, `call.failed`, `call.analyzed` or `webhook.test`. Open vocabulary |
| `created_at`   | string (date-time) | When the event was created, UTC RFC 3339 with milliseconds                          |
| `workspace_id` | string             | The workspace of the event                                                          |
| `api_version`  | string             | The public API version whose schemas built `data`, fixed at fan-out                 |
| `data`         | object             | The payload of the event type                                                       |

## Payload fields

| Schema                    | Field                  | Value                                                                                                        |
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------ |
| `WebhookCallData`         | `call`                 | The `Call`                                                                                                   |
| `WebhookCallAnalyzedData` | `call`                 | The `Call`                                                                                                   |
| `WebhookCallAnalyzedData` | `transcript.turns`     | The turns of the selected transcript, in order. `Call.transcript_state` tells ready from absent              |
| `WebhookCallAnalyzedData` | `transcript.truncated` | `true` when `turns` was emptied to keep the body under 1 MiB                                                 |
| `WebhookCallAnalyzedData` | `extraction`           | What `getCallExtraction` returns at fan-out, with its state; `null` only when that read finds no result      |
| `WebhookCallAnalyzedData` | `summary`              | What `getCallSummary` returns at fan-out, with its state, or `null`. The event does not wait for the summary |
| `WebhookCallAnalyzedData` | `recording.available`  | `true` when a verified recording exists. The body never carries a recording URL; use `downloadCallRecording` |
| `WebhookReducedCallData`  | `call_id`              | The id of the call                                                                                           |
| `WebhookReducedCallData`  | `truncated`            | Always `true`                                                                                                |
| `WebhookTestEvent` data   | `message`              | A string, for example `This is a test event from Rasen.`                                                     |

## Body size and reduced form

| Rule                            | Value                                                                                           |
| ------------------------------- | ----------------------------------------------------------------------------------------------- |
| Maximum body size               | 1 MiB                                                                                           |
| `call.analyzed` over 1 MiB      | `transcript.turns` is emptied first, and `transcript.truncated` is `true`                       |
| Any call event still over 1 MiB | The reduced form: `data` is `WebhookReducedCallData` (`call_id`, `truncated: true`)             |
| When the body is built          | Once, at fan-out, with the public serializers. It describes the call as it was at that moment   |
| Attempts and resends            | Every attempt and resend of one event sends the same bytes                                      |
| Never in a body                 | Recording URLs, signals, prompts, credentials, full phone numbers and data of another workspace |

## Related

* [Receive call events with webhooks](/guides/webhooks)
* [Errors](/concepts/errors)
* [API reference](/api-reference)