PUT /users/me/webhook
https://api.voygr.tech/users/me/webhook
Overview
Register the HTTPS endpoint we POST to when the agent needs an answer from you during a call (a hostess asking for a callback number, or an IVR wanting a choice). If you subscribe with events, it also receives call_completed when a call finishes. Without one, those questions arrive on GET /calls/{call_id}/events and in pending_questions on GET /calls/{call_id}. While the subscription includes ask_user (the default), the same question goes to both channels carrying the same request_id; answer either, and deduplicate on that id. Reply 200 with an answer field to answer inline, or 202 and then POST /calls/{call_id}/answer when you have it. One 60-second budget covers the POST and the wait after it, and the callee is on hold for all of it.
Authentication
- API key in header
X-API-Key: Your customer API key (pk_live_...), sent on every request. Self-serve at https://api.voygr.tech/checkout.
Request body
required
application/json
Schema: SetWebhookRequest
Register and issue a secret
{
"url": "https://hooks.example.com/callwright"
}Point at a new URL, keep the secret
{
"url": "https://hooks.example.com/v2",
"regenerate_secret": false
}Also receive callcompleted
{
"url": "https://hooks.example.com/callwright",
"events": [
"ask_user",
"call_completed"
]
}Responses
200
Registered. The secret is present only when this request issued one, and is shown once.
application/json
Schema: SetWebhookResponse
issued
{
"url": "https://hooks.example.com/callwright",
"secret": "q3Jv8kX0bF5yW2mN7tL1cR9eHs4dZa6pU0iOgVnYxEw",
"events": [
"ask_user"
]
}400
The URL is not a permitted destination: it is not HTTPS, carries credentials, or resolves to a private or reserved address. Nothing was stored.
application/json
nothttps
{
"detail": "Webhook URL must use HTTPS"
}privateaddress
{
"detail": "Webhook URL must not point at a private or reserved address"
}401
Missing or invalid X-API-Key.
application/json
X-API-Key header absent
{
"detail": {
"error": "API key required"
}
}X-API-Key doesn't resolve to an active key
{
"detail": {
"error": "invalid API key"
}
}422
Body failed validation (e.g. url is absent or not a URL), or events names an unknown event (unknown_webhook_event).
application/json
missingurl
{
"detail": [
{
"type": "missing",
"loc": [
"body",
"url"
],
"msg": "Field required"
}
]
}unknownwebhookevent
{
"detail": {
"error": "unknown_webhook_event",
"message": "Unknown event type(s): call_started. Valid values are: ask_user, call_completed.",
"unknown_events": [
"call_started"
]
}
}Schemas
SetWebhookRequest
Type: object
Body for PUT /users/me/webhook. Registers the HTTPS endpoint we POST webhooks to (mid-call ask_user questions and, when subscribed, call_completed), and optionally rotates the HMAC secret those POSTs are signed with.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
events | array of string (one of ask_user, call_completed) | null | optional | Which webhooks this endpoint receives. Omit to leave the current subscription unchanged; [] receives nothing. 'ask_user' is the mid-call question: without it the webhook gets no questions, which then arrive on GET /calls/{call_id}/events and in pending_questions on GET /calls/{call_id}. 'call_completed' is one event when a call reaches its outcome, signed like ask_user. Its JSON body includes event ('call_completed'), call_id, outcome_type, result, ended_by, line_kind, result_reason, billable, charge_cents, charge_reason, summary, target_phone, started_at, ended_at and at; it carries no transcript or recording (read GET /calls/{call_id}). A failed delivery is retried with the same Webhook-Id, so deduplicate on it. A key that has never set this receives 'ask_user' only: call_completed is opt-in. An unknown value is refused with 422 unknown_webhook_event. Example: ["ask_user", "call_completed"] |
regenerate_secret | boolean | optional | Issue a new HMAC secret, invalidating the previous one. Defaults to true: keeping an old secret alive across a rotation would let anyone who captured it keep signing. Pass false to change only the URL. A key with no secret yet is issued one either way, otherwise the webhook would be unusable. default True Example: true |
url | string (uri) | required | HTTPS endpoint. Plaintext HTTP is refused, because the payload carries the booking context and the HMAC header. The destination must be publicly routable: no credentials in the URL, no localhost, and nothing the host resolves to may be a private, link-local or otherwise reserved address. Delivery re-checks this and connects to the validated IP, so a host that passes here and later rebinds inward is refused at send time. length 1 to 2000 Example: "https://hooks.example.com/callwright" |
SetWebhookResponse
Type: object
PUT /users/me/webhook success body. The secret is returned once, on the response that issues it, and no endpoint returns it again. Store it when you see it.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
events | array of string (one of ask_user, call_completed) | optional | The subscription now in force, echoed back so you can check it. Example: ["ask_user", "call_completed"] |
secret | string | null | optional | The HMAC signing key, present only when this request issued a new one. null means the existing secret was kept, not that there is none. To verify a delivery: the POST carries Webhook-Id, Webhook-Timestamp and Webhook-Signature (Standard Webhooks v1). Recompute HMAC-SHA256 over the Webhook-Id, a dot, the Webhook-Timestamp, a dot, then the raw body bytes. Base64 the digest and compare it against the part after the 'v1,' prefix. The HMAC key is this secret string exactly as returned, UTF-8 encoded, with no whsec_ prefix. Do not base64-decode it first. That differs from the Standard Webhooks whsec_ convention, so a stock Standard Webhooks verifier needs the raw key passed to it, not this string. Sign the bytes you received, never a re-serialization of them: whitespace and key order change an encoding without changing what it means. Example: "q3Jv8kX0bF5yW2mN7tL1cR9eHs4dZa6pU0iOgVnYxEw" |
url | string | required | The canonicalized URL now registered. May differ from what you sent: the host is lowercased. Example: "https://hooks.example.com/callwright" |
On this page
