Made in 10Docs
GuidesAPI
ReferenceWebhook events

call.ended

Sent when a call has settled.

Header Parameters

webhook-id*string

The event's id. The same on every retry and replay of it, so dedupe on it.

Match^evt_[0-9A-Za-z]{20}$
Example"evt_3Kp8Zr1WqN6xBv4MhS9a"
webhook-timestamp*string

Unix seconds when this attempt was sent, as a decimal string. It is signed in, so refuse one more than 5 minutes away from now.

Match^[0-9]+$
webhook-signature*string

One v1,<base64> per secret still signing, space-separated (two after a rotation, during its grace).

To verify: the signature is the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{raw body}, keyed with the bytes of the secret (the base64 after whsec_, decoded). Check the raw body before parsing it, refuse a timestamp more than 5 minutes off, compare in constant time, and accept if any v1, signature matches. Any Standard Webhooks library does all of this (npm i standardwebhooks, pip install standardwebhooks, Go, Rust, PHP, Ruby: new Webhook(secret).verify(rawBody, headers)). By hand, in Node:

import crypto from "node:crypto";export function verifyWebhook(secret, headers, rawBody) {  const id = headers["webhook-id"], ts = headers["webhook-timestamp"], sigs = headers["webhook-signature"] ?? "";  if (!id || !ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;  const key = Buffer.from(secret.slice("whsec_".length), "base64");  const expected = crypto.createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest();  return sigs.split(" ").some((s) => {    if (!s.startsWith("v1,")) return false;    const given = Buffer.from(s.slice(3), "base64");    return given.length === expected.length && crypto.timingSafeEqual(given, expected);  });}
Match^v1,[A-Za-z0-9+/]+={0,2}( v1,[A-Za-z0-9+/]+={0,2})*$
Example"v1,j3DA+jkjXWui/cEnonEAVLuZfyTYaPasc6ZdLT4x/Vk="
user-agent*string

Always daxov-webhooks/1.

Request Body

application/json
  1. body

Every webhook delivery's body. The JSON is compact, with its keys in alphabetical order.

Example
{  "created_unix": 1793300100,  "data": {    "billed_seconds": 94,    "character_id": "chr_4fT9kQ2mXw7LbN3pZs8V",    "character_name": "Alex",    "charged_usd": 0.94,    "created_unix": 1793300000,    "env": "live",    "id": "call_2Gx7Mb9KpQ4sVn1ZrT6e",    "max_seconds": 300,    "metadata": {      "ticket": 7    },    "mode": "video",    "price_per_min_usd": 0.6,    "reason": "completed",    "settled_unix": 1793300100,    "source": "api",    "status": "ended",    "transcript": [      {        "ai": "Hi, I'm Alex, an AI assistant. What can I help you with?",        "customer": "",        "n": 1      },      {        "ai": "It ships on Monday and arrives on Tuesday.",        "customer": "When does my order arrive?",        "n": 2      }    ]  },  "id": "evt_9Lw3Hc6NfR8yDq2BaU5j",  "type": "call.ended"}
id*EventId
Match^evt_[0-9A-Za-z]{20}$
Example"evt_3Kp8Zr1WqN6xBv4MhS9a"
type*string

The event's type.

created_unix*Unix

Unix seconds, UTC.

Formatint64
Example1793300000
data*

A call as webhooks carry it: the Call shape without error and end_reason (call.ended has reason instead).

Response Body

Delivered. Answer any 2xx within 10 seconds, then do the slow work. The body is ignored.

Example Requests
POST/call.ended
Request Body
application/json
{  "created_unix": 1793300100,  "data": {    "billed_seconds": 94,    "character_id": "chr_4fT9kQ2mXw7LbN3pZs8V",    "character_name": "Alex",    "charged_usd": 0.94,    "created_unix": 1793300000,    "env": "live",    "id": "call_2Gx7Mb9KpQ4sVn1ZrT6e",    "max_seconds": 300,    "metadata": {      "ticket": 7    },    "mode": "video",    "price_per_min_usd": 0.6,    "reason": "completed",    "settled_unix": 1793300100,    "source": "api",    "status": "ended",    "transcript": [      {        "ai": "Hi, I'm Alex, an AI assistant. What can I help you with?",        "customer": "",        "n": 1      },      {        "ai": "It ships on Monday and arrives on Tuesday.",        "customer": "When does my order arrive?",        "n": 2      }    ]  },  "id": "evt_9Lw3Hc6NfR8yDq2BaU5j",  "type": "call.ended"}
Header Parameters
{  "webhook-id": "evt_7Rc2Yj5LmT9pQw3NdF6k",  "webhook-timestamp": "1793300100",  "webhook-signature": "v1,j3DA+jkjXWui/cEnonEAVLuZfyTYaPasc6ZdLT4x/Vk=",  "user-agent": "daxov-webhooks/1"}