Skip to main content
POST
/
sip-trunks
/
trunks
/
{trunk_id}
/
numbers
cURL
curl --request POST \
  --url https://api.bolna.ai/sip-trunks/trunks/{trunk_id}/numbers \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "phone_number": "919876543210",
  "name": "Mumbai Support Line",
  "e164_check_enabled": false
}
'
import requests

url = "https://api.bolna.ai/sip-trunks/trunks/{trunk_id}/numbers"

payload = {
"phone_number": "919876543210",
"name": "Mumbai Support Line",
"e164_check_enabled": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number: '919876543210',
name: 'Mumbai Support Line',
e164_check_enabled: false
})
};

fetch('https://api.bolna.ai/sip-trunks/trunks/{trunk_id}/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://api.bolna.ai/sip-trunks/trunks/{trunk_id}/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([
'phone_number' => '919876543210',
'name' => 'Mumbai Support Line',
'e164_check_enabled' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$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.bolna.ai/sip-trunks/trunks/{trunk_id}/numbers"

payload := strings.NewReader("{\n \"phone_number\": \"919876543210\",\n \"name\": \"Mumbai Support Line\",\n \"e164_check_enabled\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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.bolna.ai/sip-trunks/trunks/{trunk_id}/numbers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"919876543210\",\n \"name\": \"Mumbai Support Line\",\n \"e164_check_enabled\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.bolna.ai/sip-trunks/trunks/{trunk_id}/numbers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"919876543210\",\n \"name\": \"Mumbai Support Line\",\n \"e164_check_enabled\": false\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "phone_number": "<string>",
  "name": "<string>",
  "byot_trunk_id": "<string>",
  "telephony_provider": "sip-trunk",
  "deleted": true,
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}
{
"error": 123,
"message": "<string>"
}
SIP Trunking is currently in Beta.

Please reach out to us at enterprise@bolna.ai or schedule a call at https://www.bolna.ai/meet for more information and access.

Next steps

After adding a phone number, patch your agent’s telephony provider to sip-trunk.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

trunk_id
string
required

The unique trunk ID

Body

application/json

Phone number to add

phone_number
string
required

The DID phone number to register

Example:

"919876543210"

name
string

Optional human-readable label for the number

Example:

"Mumbai Support Line"

e164_check_enabled
boolean
default:false

Whether to enforce E.164 format validation

Response

Phone number added

Phone number (DID) registered on a SIP trunk.

id
string

Unique phone number identifier.

phone_number
string

The DID phone number stored on the trunk.

name
string

Optional label for the phone number.

byot_trunk_id
string

The SIP trunk ID that this phone number belongs to.

telephony_provider
string

Provider type for BYOT numbers.

Example:

"sip-trunk"

deleted
boolean

Whether the phone number is deleted.

created_at
string<date-time>

ISO timestamp when the phone number was created.

updated_at
string<date-time>

ISO timestamp when the phone number was last updated.