# Webhooks

Valeron calls your server when something happens, so you do not have to poll.

An outgoing webhook is an HTTPS request Valeron sends to a URL you choose when an event happens, such as a call being analyzed.

## Set up an endpoint

You can manage endpoints in [Settings › Developers](https://app.valeron.io/settings/developers) as the Owner, or with the API using a key that has `webhooks:write`. An organization can have up to 10 endpoints.

```bash title="cURL"
curl -X POST "https://api.valeron.io/v1/webhook-endpoints" \
  -H "Authorization: Bearer $VALERON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://crm.example.com/hooks/valeron",
  "events": ["recording.analyzed"],
  "description": "Production CRM"
}'
```

```js title="JavaScript"
const response = await fetch("https://api.valeron.io/v1/webhook-endpoints", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.VALERON_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://crm.example.com/hooks/valeron",
    events: ["recording.analyzed"],
    description: "Production CRM",
  }),
});
const endpoint = await response.json();
console.log(endpoint.secret); // whsec_… shown once
```

```python title="Python"
import os
import requests

response = requests.post(
    "https://api.valeron.io/v1/webhook-endpoints",
    headers={"Authorization": f"Bearer {os.environ['VALERON_API_KEY']}"},
    json={
        "url": "https://crm.example.com/hooks/valeron",
        "events": ["recording.analyzed"],
        "description": "Production CRM",
    },
)
response.raise_for_status()
print(response.json()["secret"])  # whsec_… shown once
```

The URL must be HTTPS. The response includes the signing secret, `whsec_…`, **once**. Store it now, because you need it to [verify signatures](/docs/webhooks/verify-signatures/). To replace a secret, call `POST /v1/webhook-endpoints/{endpoint_id}/rotate-secret`.

An endpoint lists the event types it wants, or `["*"]` for all of them. See [Events](/docs/webhooks/events/).

## Send a test event

`POST /v1/webhook-endpoints/{endpoint_id}/test` sends a `ping` event to the endpoint, so you can check your receiver and your signature code before real events arrive.

## What a delivery looks like

Valeron sends a `POST` with a JSON body:

```json
{
  "id": "evt_01JEX5B6Z9",
  "type": "recording.analyzed",
  "created_at": "2026-12-03T14:31:02Z",
  "organization_id": "org_01JEX1A4C7",
  "data": {
    "id": "rec_01JEX4S9M8",
    "object": "recordings"
  }
}
```

| Field | Meaning |
|---|---|
| `id` | The event ID. A repeat of the same event has the same ID. |
| `type` | The event type. |
| `created_at` | When the event happened. |
| `organization_id` | Your organization. |
| `data` | The object the event is about, in the same shape its `GET` route returns (a contact, a recording with its analysis, and so on), as it is at the moment of delivery. |

The example above shortens `data` to two fields. In a real delivery it is the full object.

## Headers

| Header | Value |
|---|---|
| `Valeron-Event-Id` | The same as `id` in the body. |
| `Valeron-Event-Type` | The same as `type` in the body. |
| `Valeron-Signature` | `t=<unix seconds>,v1=<hex HMAC-SHA256>`. See [Verify signatures](/docs/webhooks/verify-signatures/). |

## Respond quickly

Answer with any `2xx` status within 10 seconds. Do the slow work after you respond: put the event on a queue and acknowledge it. Anything else, or no answer in time, is a failure and Valeron retries it. See [Delivery and retries](/docs/webhooks/delivery/).

## Related API routes

- [List webhook endpoints](/docs/api-reference/webhooks/list-webhook-endpoints/)
- [Create a webhook endpoint](/docs/api-reference/webhooks/create-webhook-endpoint/)
- [Update a webhook endpoint](/docs/api-reference/webhooks/update-webhook-endpoint/)
- [List deliveries](/docs/api-reference/webhooks/list-webhook-deliveries/)
- [Retry a delivery](/docs/api-reference/webhooks/retry-webhook-delivery/)
