Trunks
Attach Numbers to Trunk
Map one or more numbers to a SIP trunk and get the origin endpoint
POST
/
api
/
v2
/
platform
/
telephony
/
trunks
/
{id}
/
attach-numbers
/
Attach Numbers to Trunk
curl --request POST \
--url https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Org-Handle: <org-handle>' \
--data '
{
"number_ids": [
501
]
}
'import requests
url = "https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/"
payload = { "number_ids": [501] }
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({number_ids: [501]})
};
fetch('https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/', 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/{id}/attach-numbers/",
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([
'number_ids' => [
501
]
]),
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/{id}/attach-numbers/"
payload := strings.NewReader("{\n \"number_ids\": [\n 501\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/{id}/attach-numbers/")
.header("Org-Handle", "<org-handle>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"number_ids\": [\n 501\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/")
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 \"number_ids\": [\n 501\n ]\n}"
response = http.request(request)
puts response.read_body{
"status_code": 201,
"message": "Numbers mapped to trunk.",
"data": {
"trunk_id": 21,
"origin_endpoint": {
"ingress": "sip:sip.unpod.tel",
"dids": ["+15551234567"],
"accepted_source_ips": ["1.2.3.4", "5.6.7.0/24"],
"region": "us-east"
},
"numbers": [
{ "number_id": 501, "number": "+15551234567", "connection_state": "NOT_LINKED", "ok": true }
]
}
}
{
"status_code": 400,
"message": "No numbers could be mapped.",
"data": {
"trunk_id": 21,
"origin_endpoint": { "ingress": "sip:sip.unpod.tel", "dids": [], "accepted_source_ips": ["1.2.3.4"], "region": null },
"numbers": [
{ "number_id": 501, "ok": false, "error": "Number not found or not available to this organization." }
]
}
}
Map one or more numbers to this trunk - the Leg-A (BYO carrier) path. The bridge is
auto-resolved and hidden. The response returns the trunk-level origin endpoint: the
shared SBC ingress your carrier sends inbound calls to, the mapped DIDs, and the accepted
source IPs.
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 |
| Product-Id | string | No | Product scope for the auto-resolved bridge (default unpod.dev) |
| Content-Type | string | Yes | application/json |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | Trunk id |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| number_ids | integer[] | Yes | Numbers to map (deduped, order preserved) |
| bridge_slug | string | No | Explicit bridge; auto-resolved when omitted |
| region | string | No | Region hint (e.g. IN) |
Origin endpoint
| Field | Type | Description |
|---|---|---|
| ingress | string | SBC ingress URI your carrier dials in to |
| dids | string[] | The numbers successfully mapped |
| accepted_source_ips | string[] | The trunk’s source-IP allow-list |
| region | string | Resolved bridge region |
Partial success
201 if at least one number maps, else 400. Each data.numbers entry reports
ok/error independently.
{
"status_code": 201,
"message": "Numbers mapped to trunk.",
"data": {
"trunk_id": 21,
"origin_endpoint": {
"ingress": "sip:sip.unpod.tel",
"dids": ["+15551234567"],
"accepted_source_ips": ["1.2.3.4", "5.6.7.0/24"],
"region": "us-east"
},
"numbers": [
{ "number_id": 501, "number": "+15551234567", "connection_state": "NOT_LINKED", "ok": true }
]
}
}
{
"status_code": 400,
"message": "No numbers could be mapped.",
"data": {
"trunk_id": 21,
"origin_endpoint": { "ingress": "sip:sip.unpod.tel", "dids": [], "accepted_source_ips": ["1.2.3.4"], "region": null },
"numbers": [
{ "number_id": 501, "ok": false, "error": "Number not found or not available to this organization." }
]
}
}
cURL
curl -s -X POST "https://unpod.ai/api/v2/platform/telephony/trunks/21/attach-numbers/" \
-H "Authorization: Token <your-api-key>" \
-H "Org-Handle: <your-org-handle>" \
-H "Product-Id: unpod.dev" \
-H "Content-Type: application/json" \
-d '{"number_ids": [501]}'
Authorizations
Format: Token
Headers
Organization domain handle
Example:
"unpod.tv"
Product scope for the auto-resolved bridge (default unpod.dev)
Example:
"unpod.dev"
Path Parameters
Example:
21
Body
application/json
Response
Numbers mapped to trunk; origin endpoint returned
Was this page helpful?
⌘I
Attach Numbers to Trunk
curl --request POST \
--url https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Org-Handle: <org-handle>' \
--data '
{
"number_ids": [
501
]
}
'import requests
url = "https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/"
payload = { "number_ids": [501] }
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({number_ids: [501]})
};
fetch('https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/', 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/{id}/attach-numbers/",
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([
'number_ids' => [
501
]
]),
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/{id}/attach-numbers/"
payload := strings.NewReader("{\n \"number_ids\": [\n 501\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/{id}/attach-numbers/")
.header("Org-Handle", "<org-handle>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"number_ids\": [\n 501\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://unpod.ai/api/v2/platform/telephony/trunks/{id}/attach-numbers/")
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 \"number_ids\": [\n 501\n ]\n}"
response = http.request(request)
puts response.read_body{
"status_code": 201,
"message": "Numbers mapped to trunk.",
"data": {
"trunk_id": 21,
"origin_endpoint": {
"ingress": "sip:sip.unpod.tel",
"dids": ["+15551234567"],
"accepted_source_ips": ["1.2.3.4", "5.6.7.0/24"],
"region": "us-east"
},
"numbers": [
{ "number_id": 501, "number": "+15551234567", "connection_state": "NOT_LINKED", "ok": true }
]
}
}
{
"status_code": 400,
"message": "No numbers could be mapped.",
"data": {
"trunk_id": 21,
"origin_endpoint": { "ingress": "sip:sip.unpod.tel", "dids": [], "accepted_source_ips": ["1.2.3.4"], "region": null },
"numbers": [
{ "number_id": 501, "ok": false, "error": "Number not found or not available to this organization." }
]
}
}