Create Trunk
curl --request POST \
--url https://unpod.ai/api/v2/platform/telephony/trunks/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Org-Handle: <org-handle>' \
--data '
{
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"auth_username": "user",
"auth_password": "pass",
"transport": "tcp",
"port": "5060",
"source_ips": [
"1.2.3.4",
"5.6.7.0/24"
]
}
'import requests
url = "https://unpod.ai/api/v2/platform/telephony/trunks/"
payload = {
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"auth_username": "user",
"auth_password": "pass",
"transport": "tcp",
"port": "5060",
"source_ips": ["1.2.3.4", "5.6.7.0/24"]
}
headers = {
"Org-Handle": "<org-handle>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Org-Handle': '<org-handle>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Carrier Trunk',
sip_url: 'sip:carrier.net',
auth_username: 'user',
auth_password: 'pass',
transport: 'tcp',
port: '5060',
source_ips: ['1.2.3.4', '5.6.7.0/24']
})
};
fetch('https://unpod.ai/api/v2/platform/telephony/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://unpod.ai/api/v2/platform/telephony/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' => 'My Carrier Trunk',
'sip_url' => 'sip:carrier.net',
'auth_username' => 'user',
'auth_password' => 'pass',
'transport' => 'tcp',
'port' => '5060',
'source_ips' => [
'1.2.3.4',
'5.6.7.0/24'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"Org-Handle: <org-handle>"
],
]);
$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://unpod.ai/api/v2/platform/telephony/trunks/"
payload := strings.NewReader("{\n \"name\": \"My Carrier Trunk\",\n \"sip_url\": \"sip:carrier.net\",\n \"auth_username\": \"user\",\n \"auth_password\": \"pass\",\n \"transport\": \"tcp\",\n \"port\": \"5060\",\n \"source_ips\": [\n \"1.2.3.4\",\n \"5.6.7.0/24\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Org-Handle", "<org-handle>")
req.Header.Add("Authorization", "<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://unpod.ai/api/v2/platform/telephony/trunks/")
.header("Org-Handle", "<org-handle>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Carrier Trunk\",\n \"sip_url\": \"sip:carrier.net\",\n \"auth_username\": \"user\",\n \"auth_password\": \"pass\",\n \"transport\": \"tcp\",\n \"port\": \"5060\",\n \"source_ips\": [\n \"1.2.3.4\",\n \"5.6.7.0/24\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://unpod.ai/api/v2/platform/telephony/trunks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Org-Handle"] = '<org-handle>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My Carrier Trunk\",\n \"sip_url\": \"sip:carrier.net\",\n \"auth_username\": \"user\",\n \"auth_password\": \"pass\",\n \"transport\": \"tcp\",\n \"port\": \"5060\",\n \"source_ips\": [\n \"1.2.3.4\",\n \"5.6.7.0/24\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status_code": 201,
"message": "Trunk created successfully.",
"data": {
"id": 21,
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"transport": "tcp",
"port": "5060",
"auth_username": "user",
"auth_password": "pass",
"allowed_ips": "1.2.3.4,5.6.7.0/24",
"active": true,
"org_handle": "acme.co"
}
}
{
"status_code": 400,
"message": "Invalid trunk payload",
"error": { "sip_url": ["This field is required."] }
}
Trunks
Create Trunk
Create a SIP trunk (carrier credential) for your organization
POST
/
api
/
v2
/
platform
/
telephony
/
trunks
/
Create Trunk
curl --request POST \
--url https://unpod.ai/api/v2/platform/telephony/trunks/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Org-Handle: <org-handle>' \
--data '
{
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"auth_username": "user",
"auth_password": "pass",
"transport": "tcp",
"port": "5060",
"source_ips": [
"1.2.3.4",
"5.6.7.0/24"
]
}
'import requests
url = "https://unpod.ai/api/v2/platform/telephony/trunks/"
payload = {
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"auth_username": "user",
"auth_password": "pass",
"transport": "tcp",
"port": "5060",
"source_ips": ["1.2.3.4", "5.6.7.0/24"]
}
headers = {
"Org-Handle": "<org-handle>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Org-Handle': '<org-handle>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Carrier Trunk',
sip_url: 'sip:carrier.net',
auth_username: 'user',
auth_password: 'pass',
transport: 'tcp',
port: '5060',
source_ips: ['1.2.3.4', '5.6.7.0/24']
})
};
fetch('https://unpod.ai/api/v2/platform/telephony/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://unpod.ai/api/v2/platform/telephony/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' => 'My Carrier Trunk',
'sip_url' => 'sip:carrier.net',
'auth_username' => 'user',
'auth_password' => 'pass',
'transport' => 'tcp',
'port' => '5060',
'source_ips' => [
'1.2.3.4',
'5.6.7.0/24'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"Org-Handle: <org-handle>"
],
]);
$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://unpod.ai/api/v2/platform/telephony/trunks/"
payload := strings.NewReader("{\n \"name\": \"My Carrier Trunk\",\n \"sip_url\": \"sip:carrier.net\",\n \"auth_username\": \"user\",\n \"auth_password\": \"pass\",\n \"transport\": \"tcp\",\n \"port\": \"5060\",\n \"source_ips\": [\n \"1.2.3.4\",\n \"5.6.7.0/24\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Org-Handle", "<org-handle>")
req.Header.Add("Authorization", "<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://unpod.ai/api/v2/platform/telephony/trunks/")
.header("Org-Handle", "<org-handle>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Carrier Trunk\",\n \"sip_url\": \"sip:carrier.net\",\n \"auth_username\": \"user\",\n \"auth_password\": \"pass\",\n \"transport\": \"tcp\",\n \"port\": \"5060\",\n \"source_ips\": [\n \"1.2.3.4\",\n \"5.6.7.0/24\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://unpod.ai/api/v2/platform/telephony/trunks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Org-Handle"] = '<org-handle>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My Carrier Trunk\",\n \"sip_url\": \"sip:carrier.net\",\n \"auth_username\": \"user\",\n \"auth_password\": \"pass\",\n \"transport\": \"tcp\",\n \"port\": \"5060\",\n \"source_ips\": [\n \"1.2.3.4\",\n \"5.6.7.0/24\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status_code": 201,
"message": "Trunk created successfully.",
"data": {
"id": 21,
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"transport": "tcp",
"port": "5060",
"auth_username": "user",
"auth_password": "pass",
"allowed_ips": "1.2.3.4,5.6.7.0/24",
"active": true,
"org_handle": "acme.co"
}
}
{
"status_code": 400,
"message": "Invalid trunk payload",
"error": { "sip_url": ["This field is required."] }
}
Create a SIP trunk - your carrier credential. Once created, map numbers to it
to receive inbound calls. The response masks
auth_password.
Prerequisites: API Token + Org-Handle. See Authentication.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Token <your-api-key> |
| Org-Handle | string | Yes | Organization domain handle |
| Content-Type | string | Yes | application/json |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Display name for the trunk |
| sip_url | string | Yes | Carrier SIP URL / host |
| auth_username | string | No | SIP auth username |
| auth_password | string | No | SIP auth password (masked in responses) |
| transport | string | No | tcp (default), udp, or tls |
| port | string | No | SIP port (default 5060) |
| source_ips | string[] | No | Carrier source-IP allow-list (CIDR allowed) |
{
"status_code": 201,
"message": "Trunk created successfully.",
"data": {
"id": 21,
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"transport": "tcp",
"port": "5060",
"auth_username": "user",
"auth_password": "pass",
"allowed_ips": "1.2.3.4,5.6.7.0/24",
"active": true,
"org_handle": "acme.co"
}
}
{
"status_code": 400,
"message": "Invalid trunk payload",
"error": { "sip_url": ["This field is required."] }
}
cURL
curl -s -X POST "https://unpod.ai/api/v2/platform/telephony/trunks/" \
-H "Authorization: Token <your-api-key>" \
-H "Org-Handle: <your-org-handle>" \
-H "Content-Type: application/json" \
-d '{
"name": "My Carrier Trunk",
"sip_url": "sip:carrier.net",
"auth_username": "user",
"auth_password": "pass",
"transport": "tcp",
"port": "5060",
"source_ips": ["1.2.3.4", "5.6.7.0/24"]
}'
Copy the returned
id - you’ll need it to attach numbers, fetch, or delete the trunk.Authorizations
Format: Token
Headers
Organization domain handle
Example:
"unpod.tv"
Body
application/json
Example:
"My Carrier Trunk"
Carrier SIP URL / host.
Example:
"sip:carrier.net"
Example:
"user"
Example:
"pass"
Available options:
tcp, udp, tls Example:
"tcp"
Example:
"5060"
Carrier source IP allow-list (CIDR allowed).
Example:
["1.2.3.4", "5.6.7.0/24"]Response
Trunk created (auth_password masked in response)
Was this page helpful?
⌘I