curl --request POST \
--url https://api.spenza.com/api/v1.1/voice-quality/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://partner.example.com/hooks/voice-quality",
"events": [
"voice.test.completed"
],
"description": "Voice quality demo"
}
'import requests
url = "https://api.spenza.com/api/v1.1/voice-quality/webhooks"
payload = {
"url": "https://partner.example.com/hooks/voice-quality",
"events": ["voice.test.completed"],
"description": "Voice quality demo"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://partner.example.com/hooks/voice-quality',
events: ['voice.test.completed'],
description: 'Voice quality demo'
})
};
fetch('https://api.spenza.com/api/v1.1/voice-quality/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.spenza.com/api/v1.1/voice-quality/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://partner.example.com/hooks/voice-quality',
'events' => [
'voice.test.completed'
],
'description' => 'Voice quality demo'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.spenza.com/api/v1.1/voice-quality/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://partner.example.com/hooks/voice-quality\",\n \"events\": [\n \"voice.test.completed\"\n ],\n \"description\": \"Voice quality demo\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.spenza.com/api/v1.1/voice-quality/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://partner.example.com/hooks/voice-quality\",\n \"events\": [\n \"voice.test.completed\"\n ],\n \"description\": \"Voice quality demo\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spenza.com/api/v1.1/voice-quality/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://partner.example.com/hooks/voice-quality\",\n \"events\": [\n \"voice.test.completed\"\n ],\n \"description\": \"Voice quality demo\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "vqwh_8Kd2mQ7xLp4Rt9Za",
"url": "https://partner.example.com/hooks/voice-quality",
"description": "Voice quality demo",
"events": [
"voice.test.completed"
],
"status": "active",
"createdAt": "2026-10-07T12:20:11.000Z",
"updatedAt": "2026-10-07T12:20:11.000Z",
"signingSecret": "vqwhsec_3oZ1n0Qv5yJ8c2kTq6WfXbR4mA9sLd7eHgPuVi0NxY"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Webhook URL must use https."
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid token."
}
}{
"success": false,
"error": {
"code": "INSUFFICIENT_SCOPE",
"message": "Your API key doesn't have the required \"voice-quality:write\" scope for this action."
}
}{
"success": false,
"error": {
"code": "WEBHOOK_LIMIT_REACHED",
"message": "Your account can have up to 10 voice quality webhooks."
}
}{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "ThrottlerException: Too Many Requests"
}
}Register a voice quality webhook
Register an HTTPS endpoint to receive voice.test.completed when a line on your account calls a Spenza test number. Needs a read-write key.
- The URL must be
https, on port 443, and publicly reachable — private, loopback and link-local addresses are refused. - Up to 10 webhooks per account. Every active webhook receives every result.
- The response carries
signingSecretonce. Store it to verifyX-Spenza-Signatureon deliveries.
curl --request POST \
--url https://api.spenza.com/api/v1.1/voice-quality/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://partner.example.com/hooks/voice-quality",
"events": [
"voice.test.completed"
],
"description": "Voice quality demo"
}
'import requests
url = "https://api.spenza.com/api/v1.1/voice-quality/webhooks"
payload = {
"url": "https://partner.example.com/hooks/voice-quality",
"events": ["voice.test.completed"],
"description": "Voice quality demo"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://partner.example.com/hooks/voice-quality',
events: ['voice.test.completed'],
description: 'Voice quality demo'
})
};
fetch('https://api.spenza.com/api/v1.1/voice-quality/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.spenza.com/api/v1.1/voice-quality/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://partner.example.com/hooks/voice-quality',
'events' => [
'voice.test.completed'
],
'description' => 'Voice quality demo'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.spenza.com/api/v1.1/voice-quality/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://partner.example.com/hooks/voice-quality\",\n \"events\": [\n \"voice.test.completed\"\n ],\n \"description\": \"Voice quality demo\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.spenza.com/api/v1.1/voice-quality/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://partner.example.com/hooks/voice-quality\",\n \"events\": [\n \"voice.test.completed\"\n ],\n \"description\": \"Voice quality demo\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spenza.com/api/v1.1/voice-quality/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://partner.example.com/hooks/voice-quality\",\n \"events\": [\n \"voice.test.completed\"\n ],\n \"description\": \"Voice quality demo\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "vqwh_8Kd2mQ7xLp4Rt9Za",
"url": "https://partner.example.com/hooks/voice-quality",
"description": "Voice quality demo",
"events": [
"voice.test.completed"
],
"status": "active",
"createdAt": "2026-10-07T12:20:11.000Z",
"updatedAt": "2026-10-07T12:20:11.000Z",
"signingSecret": "vqwhsec_3oZ1n0Qv5yJ8c2kTq6WfXbR4mA9sLd7eHgPuVi0NxY"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Webhook URL must use https."
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid token."
}
}{
"success": false,
"error": {
"code": "INSUFFICIENT_SCOPE",
"message": "Your API key doesn't have the required \"voice-quality:write\" scope for this action."
}
}{
"success": false,
"error": {
"code": "WEBHOOK_LIMIT_REACHED",
"message": "Your account can have up to 10 voice quality webhooks."
}
}{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "ThrottlerException: Too Many Requests"
}
}Authorizations
Bearer token obtained from POST /api/v1.1/auth/token.
Headers
Any string unique to this logical request. On a retry with the same key
and the same request body, the original response is replayed verbatim
(with an Idempotency-Replayed: true response header) instead of the
action repeating. Reusing the key with a different body or on a
different route returns 409 IDEMPOTENCY_KEY_REUSED. A replay attempted
while the original call is still in flight returns 409 CONFLICT.
Optional — omit it and the endpoint behaves exactly as it would otherwise.
"a1b2c3d4-idem-key-001"
Body
HTTPS URL on port 443.
2048"https://partner.example.com/hooks/voice-quality"
Events to receive. Only voice.test.completed exists today, and it is the default.
voice.test.completed 200"Voice quality demo"

