Skip to main content
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

NameTypeRequiredDescription
AuthorizationstringYesToken <your-api-key>
Org-HandlestringYesOrganization domain handle
Product-IdstringNoProduct scope for the auto-resolved bridge (default unpod.dev)
Content-TypestringYesapplication/json

Path parameters

NameTypeRequiredDescription
idintegerYesTrunk id

Request body

FieldTypeRequiredDescription
number_idsinteger[]YesNumbers to map (deduped, order preserved)
bridge_slugstringNoExplicit bridge; auto-resolved when omitted
regionstringNoRegion hint (e.g. IN)

Origin endpoint

FieldTypeDescription
ingressstringSBC ingress URI your carrier dials in to
didsstring[]The numbers successfully mapped
accepted_source_ipsstring[]The trunk’s source-IP allow-list
regionstringResolved 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

Authorization
string
header
required

Format: Token

Headers

Org-Handle
string
required

Organization domain handle

Example:

"unpod.tv"

Product-Id
string

Product scope for the auto-resolved bridge (default unpod.dev)

Example:

"unpod.dev"

Path Parameters

id
integer
required
Example:

21

Body

application/json
number_ids
integer[]
required
Example:
[501]
bridge_slug
string

Optional explicit bridge; auto-resolved when omitted.

region
string
Example:

"IN"

Response

Numbers mapped to trunk; origin endpoint returned