curl --request POST \
--url https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "Acme SIP",
"sip_address": "sip.acme.example.com",
"sip_transport": "tls",
"auth_username": "acme_user",
"auth_password": "s3cr3t-write-only",
"numbers": [
"+919876543210"
],
"outbound_enabled": true,
"inbound_enabled": false,
"provider": "acme-telecom"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks"
payload = {
"name": "Acme SIP",
"sip_address": "sip.acme.example.com",
"sip_transport": "tls",
"auth_username": "acme_user",
"auth_password": "s3cr3t-write-only",
"numbers": ["+919876543210"],
"outbound_enabled": True,
"inbound_enabled": False,
"provider": "acme-telecom"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Acme SIP',
sip_address: 'sip.acme.example.com',
sip_transport: 'tls',
auth_username: 'acme_user',
auth_password: 's3cr3t-write-only',
numbers: ['+919876543210'],
outbound_enabled: true,
inbound_enabled: false,
provider: 'acme-telecom'
})
};
fetch('https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks', 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.lehar.ai/ca/api/v0/phone-numbers/sip-trunks",
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([
'name' => 'Acme SIP',
'sip_address' => 'sip.acme.example.com',
'sip_transport' => 'tls',
'auth_username' => 'acme_user',
'auth_password' => 's3cr3t-write-only',
'numbers' => [
'+919876543210'
],
'outbound_enabled' => true,
'inbound_enabled' => false,
'provider' => 'acme-telecom'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/phone-numbers/sip-trunks"
payload := strings.NewReader("{\n \"name\": \"Acme SIP\",\n \"sip_address\": \"sip.acme.example.com\",\n \"sip_transport\": \"tls\",\n \"auth_username\": \"acme_user\",\n \"auth_password\": \"s3cr3t-write-only\",\n \"numbers\": [\n \"+919876543210\"\n ],\n \"outbound_enabled\": true,\n \"inbound_enabled\": false,\n \"provider\": \"acme-telecom\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/phone-numbers/sip-trunks")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Acme SIP\",\n \"sip_address\": \"sip.acme.example.com\",\n \"sip_transport\": \"tls\",\n \"auth_username\": \"acme_user\",\n \"auth_password\": \"s3cr3t-write-only\",\n \"numbers\": [\n \"+919876543210\"\n ],\n \"outbound_enabled\": true,\n \"inbound_enabled\": false,\n \"provider\": \"acme-telecom\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Acme SIP\",\n \"sip_address\": \"sip.acme.example.com\",\n \"sip_transport\": \"tls\",\n \"auth_username\": \"acme_user\",\n \"auth_password\": \"s3cr3t-write-only\",\n \"numbers\": [\n \"+919876543210\"\n ],\n \"outbound_enabled\": true,\n \"inbound_enabled\": false,\n \"provider\": \"acme-telecom\"\n}"
response = http.request(request)
puts response.read_body{
"trunk": {
"id": "trunk_x1y2z3",
"name": "Acme SIP",
"kind": "byo",
"provider": "acme-telecom",
"sip_address": "sip.acme.example.com",
"sip_transport": "tls",
"auth_username": "acme_user",
"auth_password_last4": "only",
"livekit_outbound_trunk_id": "ST_abc123",
"status": "active",
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-01T12:00:00Z"
},
"numbers": [
{
"id": "pn_a1b2c3d4",
"number": "+919876543210",
"display_name": null,
"source": "byo_trunk",
"sip_trunk_id": "trunk_x1y2z3",
"sip_trunk_name": "Acme SIP",
"status": "active",
"outbound_enabled": true,
"inbound_enabled": false,
"inbound_agent_id": null,
"provider": "acme-telecom",
"metadata": {},
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-01T12:00:00Z"
}
]
}{
"error": {
"code": "invalid_request",
"message": "auth_username is required when auth_password is set"
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"error": {
"code": "forbidden",
"message": "This role cannot manage phone numbers"
}
}{
"error": {
"code": "not_found",
"message": "Customer not found"
}
}{
"error": {
"code": "conflict",
"message": "One of these numbers is already registered to a workspace. Archive the existing registration, or remove that number from this trunk."
}
}{
"error": {
"code": "internal_error",
"message": "Failed to save the SIP trunk"
}
}{
"error": {
"code": "service_unavailable",
"message": "Could not create the SIP trunk with LiveKit"
}
}Create SIP trunk
Connect a customer’s own outbound SIP trunk and register one or more numbers on it (created active, source byo_trunk). The auth_password is write-only: it is passed through to LiveKit trunk configuration and is never persisted, logged, or returned — only its last four digits are stored as auth_password_last4. Requires the admin-tier phone_numbers:write scope (customer/platform admins, or an API key bearing the scope). Scope phone_numbers:write.
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "Acme SIP",
"sip_address": "sip.acme.example.com",
"sip_transport": "tls",
"auth_username": "acme_user",
"auth_password": "s3cr3t-write-only",
"numbers": [
"+919876543210"
],
"outbound_enabled": true,
"inbound_enabled": false,
"provider": "acme-telecom"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks"
payload = {
"name": "Acme SIP",
"sip_address": "sip.acme.example.com",
"sip_transport": "tls",
"auth_username": "acme_user",
"auth_password": "s3cr3t-write-only",
"numbers": ["+919876543210"],
"outbound_enabled": True,
"inbound_enabled": False,
"provider": "acme-telecom"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Acme SIP',
sip_address: 'sip.acme.example.com',
sip_transport: 'tls',
auth_username: 'acme_user',
auth_password: 's3cr3t-write-only',
numbers: ['+919876543210'],
outbound_enabled: true,
inbound_enabled: false,
provider: 'acme-telecom'
})
};
fetch('https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks', 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.lehar.ai/ca/api/v0/phone-numbers/sip-trunks",
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([
'name' => 'Acme SIP',
'sip_address' => 'sip.acme.example.com',
'sip_transport' => 'tls',
'auth_username' => 'acme_user',
'auth_password' => 's3cr3t-write-only',
'numbers' => [
'+919876543210'
],
'outbound_enabled' => true,
'inbound_enabled' => false,
'provider' => 'acme-telecom'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/phone-numbers/sip-trunks"
payload := strings.NewReader("{\n \"name\": \"Acme SIP\",\n \"sip_address\": \"sip.acme.example.com\",\n \"sip_transport\": \"tls\",\n \"auth_username\": \"acme_user\",\n \"auth_password\": \"s3cr3t-write-only\",\n \"numbers\": [\n \"+919876543210\"\n ],\n \"outbound_enabled\": true,\n \"inbound_enabled\": false,\n \"provider\": \"acme-telecom\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/phone-numbers/sip-trunks")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Acme SIP\",\n \"sip_address\": \"sip.acme.example.com\",\n \"sip_transport\": \"tls\",\n \"auth_username\": \"acme_user\",\n \"auth_password\": \"s3cr3t-write-only\",\n \"numbers\": [\n \"+919876543210\"\n ],\n \"outbound_enabled\": true,\n \"inbound_enabled\": false,\n \"provider\": \"acme-telecom\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Acme SIP\",\n \"sip_address\": \"sip.acme.example.com\",\n \"sip_transport\": \"tls\",\n \"auth_username\": \"acme_user\",\n \"auth_password\": \"s3cr3t-write-only\",\n \"numbers\": [\n \"+919876543210\"\n ],\n \"outbound_enabled\": true,\n \"inbound_enabled\": false,\n \"provider\": \"acme-telecom\"\n}"
response = http.request(request)
puts response.read_body{
"trunk": {
"id": "trunk_x1y2z3",
"name": "Acme SIP",
"kind": "byo",
"provider": "acme-telecom",
"sip_address": "sip.acme.example.com",
"sip_transport": "tls",
"auth_username": "acme_user",
"auth_password_last4": "only",
"livekit_outbound_trunk_id": "ST_abc123",
"status": "active",
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-01T12:00:00Z"
},
"numbers": [
{
"id": "pn_a1b2c3d4",
"number": "+919876543210",
"display_name": null,
"source": "byo_trunk",
"sip_trunk_id": "trunk_x1y2z3",
"sip_trunk_name": "Acme SIP",
"status": "active",
"outbound_enabled": true,
"inbound_enabled": false,
"inbound_agent_id": null,
"provider": "acme-telecom",
"metadata": {},
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-01T12:00:00Z"
}
]
}{
"error": {
"code": "invalid_request",
"message": "auth_username is required when auth_password is set"
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"error": {
"code": "forbidden",
"message": "This role cannot manage phone numbers"
}
}{
"error": {
"code": "not_found",
"message": "Customer not found"
}
}{
"error": {
"code": "conflict",
"message": "One of these numbers is already registered to a workspace. Archive the existing registration, or remove that number from this trunk."
}
}{
"error": {
"code": "internal_error",
"message": "Failed to save the SIP trunk"
}
}{
"error": {
"code": "service_unavailable",
"message": "Could not create the SIP trunk with LiveKit"
}
}Authorizations
Body
Display name for the trunk.
SIP host/address for the trunk.
Non-empty list of E.164 numbers to register on this trunk.
1SIP transport.
auto, udp, tcp, tls SIP auth username. Required when auth_password is set.
SIP auth password. Write-only — handed to LiveKit and never persisted or returned (only last 4 digits are stored). Requires auth_username.
Enable the numbers for outbound caller ID.
Enable inbound answering. When true, inbound is provisioned immediately using the supplied password (which is never stored).
Carrier/provider label.
Response
Trunk created with its registered numbers. Note the response never echoes the password — only auth_password_last4.

