Archive SIP trunk
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive"
headers = {"X-API-KEY": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive', 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/{trunk_id}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
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/{trunk_id}/archive")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
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": "7788",
"livekit_outbound_trunk_id": "ST_abc123",
"status": "archived",
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-02T09:30:00Z"
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"error": {
"code": "forbidden",
"message": "This role cannot manage phone numbers"
}
}{
"error": {
"code": "not_found",
"message": "SIP trunk not found"
}
}{
"error": {
"code": "conflict",
"message": "Archive or move this trunk's phone numbers before archiving it"
}
}Phone Numbers
Archive SIP trunk
Archive a SIP trunk and best-effort delete its LiveKit outbound trunk. Refused while any live (non-archived) numbers remain on the trunk. Requires the admin-tier phone_numbers:write scope (customer/platform admins, or an API key bearing the scope). Scope phone_numbers:write.
POST
/
phone-numbers
/
sip-trunks
/
{trunk_id}
/
archive
Archive SIP trunk
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive"
headers = {"X-API-KEY": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive', 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/{trunk_id}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
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/{trunk_id}/archive")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/phone-numbers/sip-trunks/{trunk_id}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
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": "7788",
"livekit_outbound_trunk_id": "ST_abc123",
"status": "archived",
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-02T09:30:00Z"
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"error": {
"code": "forbidden",
"message": "This role cannot manage phone numbers"
}
}{
"error": {
"code": "not_found",
"message": "SIP trunk not found"
}
}{
"error": {
"code": "conflict",
"message": "Archive or move this trunk's phone numbers before archiving it"
}
}
