curl --request POST \
--url https://api.daily.co/v1/sip-trunk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"trunk_name": "support",
"room_template": {},
"notification": {
"webhook_url": "<string>",
"hmac": "<string>"
},
"description": "<string>",
"trunk_config": {
"allowed_ips": [
"<string>"
],
"credential": {
"username": "<string>",
"password": "<string>"
},
"is_open": false,
"exp_offset": 3600
},
"enabled": true
}
'import requests
url = "https://api.daily.co/v1/sip-trunk"
payload = {
"trunk_name": "support",
"room_template": {},
"notification": {
"webhook_url": "<string>",
"hmac": "<string>"
},
"description": "<string>",
"trunk_config": {
"allowed_ips": ["<string>"],
"credential": {
"username": "<string>",
"password": "<string>"
},
"is_open": False,
"exp_offset": 3600
},
"enabled": True
}
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({
trunk_name: 'support',
room_template: {},
notification: {webhook_url: '<string>', hmac: '<string>'},
description: '<string>',
trunk_config: {
allowed_ips: ['<string>'],
credential: {username: '<string>', password: '<string>'},
is_open: false,
exp_offset: 3600
},
enabled: true
})
};
fetch('https://api.daily.co/v1/sip-trunk', 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.daily.co/v1/sip-trunk",
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([
'trunk_name' => 'support',
'room_template' => [
],
'notification' => [
'webhook_url' => '<string>',
'hmac' => '<string>'
],
'description' => '<string>',
'trunk_config' => [
'allowed_ips' => [
'<string>'
],
'credential' => [
'username' => '<string>',
'password' => '<string>'
],
'is_open' => false,
'exp_offset' => 3600
],
'enabled' => true
]),
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.daily.co/v1/sip-trunk"
payload := strings.NewReader("{\n \"trunk_name\": \"support\",\n \"room_template\": {},\n \"notification\": {\n \"webhook_url\": \"<string>\",\n \"hmac\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"trunk_config\": {\n \"allowed_ips\": [\n \"<string>\"\n ],\n \"credential\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"is_open\": false,\n \"exp_offset\": 3600\n },\n \"enabled\": true\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.daily.co/v1/sip-trunk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"trunk_name\": \"support\",\n \"room_template\": {},\n \"notification\": {\n \"webhook_url\": \"<string>\",\n \"hmac\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"trunk_config\": {\n \"allowed_ips\": [\n \"<string>\"\n ],\n \"credential\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"is_open\": false,\n \"exp_offset\": 3600\n },\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.daily.co/v1/sip-trunk")
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 \"trunk_name\": \"support\",\n \"room_template\": {},\n \"notification\": {\n \"webhook_url\": \"<string>\",\n \"hmac\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"trunk_config\": {\n \"allowed_ips\": [\n \"<string>\"\n ],\n \"credential\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"is_open\": false,\n \"exp_offset\": 3600\n },\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"description": "<string>",
"trunk_name": "<string>",
"sip_uri": "sip:examplecorp-support.siptrunk.sip-us.daily.co",
"enabled": true,
"config": {}
}{
"error": "invalid-request-error",
"info": "missing required field"
}Create a SIP trunk
Create a SIP trunk for your domain. Returns the sip_uri to point your carrier at, plus the generated hmac. notification.webhook_url is required and must be LIVE: create sends a signed one-shot sip_trunk.test POST that must return 2xx, or the create fails with 400. A trunk must be gated by allowed_ips/credential or explicitly is_open: true.
curl --request POST \
--url https://api.daily.co/v1/sip-trunk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"trunk_name": "support",
"room_template": {},
"notification": {
"webhook_url": "<string>",
"hmac": "<string>"
},
"description": "<string>",
"trunk_config": {
"allowed_ips": [
"<string>"
],
"credential": {
"username": "<string>",
"password": "<string>"
},
"is_open": false,
"exp_offset": 3600
},
"enabled": true
}
'import requests
url = "https://api.daily.co/v1/sip-trunk"
payload = {
"trunk_name": "support",
"room_template": {},
"notification": {
"webhook_url": "<string>",
"hmac": "<string>"
},
"description": "<string>",
"trunk_config": {
"allowed_ips": ["<string>"],
"credential": {
"username": "<string>",
"password": "<string>"
},
"is_open": False,
"exp_offset": 3600
},
"enabled": True
}
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({
trunk_name: 'support',
room_template: {},
notification: {webhook_url: '<string>', hmac: '<string>'},
description: '<string>',
trunk_config: {
allowed_ips: ['<string>'],
credential: {username: '<string>', password: '<string>'},
is_open: false,
exp_offset: 3600
},
enabled: true
})
};
fetch('https://api.daily.co/v1/sip-trunk', 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.daily.co/v1/sip-trunk",
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([
'trunk_name' => 'support',
'room_template' => [
],
'notification' => [
'webhook_url' => '<string>',
'hmac' => '<string>'
],
'description' => '<string>',
'trunk_config' => [
'allowed_ips' => [
'<string>'
],
'credential' => [
'username' => '<string>',
'password' => '<string>'
],
'is_open' => false,
'exp_offset' => 3600
],
'enabled' => true
]),
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.daily.co/v1/sip-trunk"
payload := strings.NewReader("{\n \"trunk_name\": \"support\",\n \"room_template\": {},\n \"notification\": {\n \"webhook_url\": \"<string>\",\n \"hmac\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"trunk_config\": {\n \"allowed_ips\": [\n \"<string>\"\n ],\n \"credential\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"is_open\": false,\n \"exp_offset\": 3600\n },\n \"enabled\": true\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.daily.co/v1/sip-trunk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"trunk_name\": \"support\",\n \"room_template\": {},\n \"notification\": {\n \"webhook_url\": \"<string>\",\n \"hmac\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"trunk_config\": {\n \"allowed_ips\": [\n \"<string>\"\n ],\n \"credential\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"is_open\": false,\n \"exp_offset\": 3600\n },\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.daily.co/v1/sip-trunk")
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 \"trunk_name\": \"support\",\n \"room_template\": {},\n \"notification\": {\n \"webhook_url\": \"<string>\",\n \"hmac\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"trunk_config\": {\n \"allowed_ips\": [\n \"<string>\"\n ],\n \"credential\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"is_open\": false,\n \"exp_offset\": 3600\n },\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"description": "<string>",
"trunk_name": "<string>",
"sip_uri": "sip:examplecorp-support.siptrunk.sip-us.daily.co",
"enabled": true,
"config": {}
}{
"error": "invalid-request-error",
"info": "missing required field"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Lowercase alphanumeric, 3-63 chars, no hyphens; the combined <domain>-<trunk_name> label must be <= 63 chars. Immutable after create.
"support"
Room-creation properties, passed to room create. An optional sip block (applied at dial-in start) may set display name, codecs, dialin_config, etc. Absolute exp/nbf are rejected - use trunk_config.exp_offset.
Show child attributes
Show child attributes
Free text (max 2048). Echoed to your webhook as trunk.description.
Show child attributes
Show child attributes