Creates a new SIP trunk. This is the first step for all SIP Trunking use cases.
A SIP Trunk acts as a virtual connection between your communication system (PBX/Contact Center) and Exotel's telephony network.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks
If you’d prefer response in JSON format, just append .json at the end of the HTTP POST request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
The following parameters are sent as JSON in the body of the request:
| Parameter Name | Mandatory/Optional | Value |
|---|---|---|
| trunk_name | Mandatory | String; Unique identifier for the trunk. Must be alphanumeric with underscores only, maximum 16 characters. Example: outbound_trunk, my_pbx_trunk |
| nso_code | Mandatory | String; Network Service Operator code. Use ANY-ANY for standard configuration. |
| domain_name | Mandatory | String; SIP domain for the trunk. Format: <your_sid>.pstn.exotel.com. Example: ameyo5m.pstn.exotel.com |
curl -X POST "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks" \ -H "Content-Type: application/json" \ -d '{ "trunk_name": "outbound_trunk", "nso_code": "ANY-ANY", "domain_name": "<your_sid>.pstn.exotel.com" }'
| Parameter Name | Type & Value |
|---|---|
| request_id | String; Unique identifier for this API request |
| method | String; HTTP method used (POST) |
| http_code | Integer; HTTP status code (200 for success) |
| trunk_sid | String; Important - Unique identifier for the trunk. Save this for subsequent API calls. Example: trmum1f708622631150902801a1n |
| trunk_name | String; Name of the trunk as provided in request |
| domain_name | String; SIP domain for the trunk |
| status | String; Current trunk status: active - Trunk is ready for use, inactive - Trunk is disabled |
| auth_type | String; Authentication type. Currently only IP-WHITELIST is supported |
| registration_enabled | String; SIP registration status: enabled or disabled |
| edge_preference | String; Edge server preference. Default: auto |
| nso_code | String; Network Service Operator code |
| secure_trunking | String; TLS status: enabled or disabled |
| destination_uris | String; API path to manage destination URIs for this trunk |
| whitelisted_ips | String; API path to manage ACLs (whitelisted IPs) for this trunk |
| credentials | String; API path to credentials for this trunk |
| phone_numbers | String; API path to manage phone numbers for this trunk |
| date_created | String; ISO 8601 timestamp when trunk was created |
| date_updated | String; ISO 8601 timestamp when trunk was last updated |
{
"request_id": "10a67da360d446378d5c2b66407b7f18",
"method": "POST",
"http_code": 200,
"response": {
"code": 200,
"error_data": null,
"status": "success",
"data": {
"trunk_name": "outbound_trunk",
"date_created": "2026-01-23T09:24:59Z",
"date_updated": "2026-01-23T09:24:59Z",
"trunk_sid": "trmum1f708622631150902801a1n",
"status": "active",
"domain_name": "ameyo5m.pstn.exotel.com",
"auth_type": "IP-WHITELIST",
"registration_enabled": "disabled",
"edge_preference": "auto",
"nso_code": "ANY-ANY",
"secure_trunking": "disabled",
"destination_uris": "/v2/accounts/ameyo5m/trunks/trmum1f708622631150902801a1n/destination-uris",
"whitelisted_ips": "/v2/accounts/ameyo5m/trunks/trmum1f708622631150902801a1n/whitelisted-ips",
"credentials": "/v2/accounts/ameyo5m/trunks/trmum1f708622631150902801a1n/credentials",
"phone_numbers": "/v2/accounts/ameyo5m/trunks/trmum1f708622631150902801a1n/phone-numbers"
}
}
}
Associates a phone number (DID/ExoPhone) with the trunk. This phone number will be used for making and receiving calls through the trunk.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/phone-numbers
If you’d prefer response in JSON format, just append .json at the end of the HTTP POST request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
| Parameter Name | Mandatory/Optional | Value |
|---|---|---|
| phone_number | Mandatory | String; The phone number to map to the trunk. Must be in E.164 format (with country code). Example: +919876543210, +91224XXXX597 |
| mode | Optional | String; Routing mode for the phone number. Can be: pstn (default) - Routes calls to telephone network, flow - Routes calls to Voice AI bot (StreamKit). If not specified, defaults to null and behaves as pstn. |
curl -X POST "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/phone-numbers" \ -H "Content-Type: application/json" \ -d '{ "phone_number": "+919876543210" }'
curl -X POST "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/phone-numbers" \ -H "Content-Type: application/json" \ -d '{ "phone_number": "+919876543210", "mode": "flow" }'
On success, the HTTP response status code will be 200 OK.
Important: Save the id from the response - this numeric ID is required for the Update Phone Number Mode API.
| Parameter Name | Type & Value |
|---|---|
| id | String; Important - Numeric identifier for this phone number mapping. Save this value - required for Update Phone Number Mode API. Example: 41512 |
| phone_number | String; The mapped phone number in E.164 format |
| trunk_sid | String; The trunk this phone number is associated with |
| mode | String or null; Routing mode: pstn - PSTN routing, flow - StreamKit/Voice AI routing, null - Default (same as pstn) |
| date_created | String; ISO 8601 timestamp when mapping was created |
| date_updated | String; ISO 8601 timestamp when mapping was last updated |
{
"request_id": "13ab9319cf574486ba299c364f82cade",
"method": "POST",
"http_code": 200,
"response": {
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "41512",
"phone_number": "+919876543210",
"trunk_sid": "trmum1f708622631150902801a1n",
"date_created": "2026-01-23T10:26:54Z",
"date_updated": "2026-01-23T10:26:54Z",
"mode": pstn
}
}
}
Registers your server's public IP address for authentication. This is required for Outbound/Termination calls - allowing your system to send calls through the trunk.
ACL (Access Control List) ensures only authorized IP addresses can use your trunk for outbound calling.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/whitelisted-ips
If you’d prefer response in JSON format, just append .json at the end of the HTTP POST request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
| Parameter Name | Mandatory/Optional | Value |
|---|---|---|
| ip | Mandatory | String; Your server's public IP address. Must be a valid IPv4 address. Example: 44.248.146.11, 203.0.113.50 |
| mask | Optional | Integer; Subnet mask in CIDR notation. Default: 32 (single IP). Use 24 for /24 subnet, 16 for /16 subnet. Example: 32, 24 |
curl -X POST "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/whitelisted-ips" \ -H "Content-Type: application/json" \ -d '{ "ip": "44.248.146.11", "mask": 32 }'
On success, the HTTP response status code will be 200 OK.
| Parameter Name | Type & Value |
|---|---|
| id | String; Unique identifier for this ACL entry. Example: 1153 |
| ip | String; The whitelisted IP address |
| mask | Integer; Subnet mask in CIDR notation |
| trunk_sid | String; The trunk this ACL is associated with |
| friendly_name | String or null; Optional friendly name for the IP |
| date_created | String; ISO 8601 timestamp when ACL was created |
| date_updated | String; ISO 8601 timestamp when ACL was last updated |
{
"request_id": "3daaed4cd05d443f854e07e60dd4c008",
"method": "POST",
"http_code": 200,
"response": {
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "1153",
"mask": 32,
"trunk_sid": "trmum1f708622631150902801a1n",
"ip": "44.248.146.11",
"friendly_name": null,
"date_created": "2026-01-23T11:37:36Z",
"date_updated": "2026-01-23T11:37:36Z"
}
}
}
Configures where incoming calls should be routed. This is required for Inbound/Origination calls - routing calls from the telephone network to your system.
The destination can be an IP address or FQDN (Fully Qualified Domain Name) of your PBX/SBC.
sip.yourcompany.com)<ip_or_fqdn>:<port>;transport=<protocol>https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/destination-uris
If you’d prefer response in JSON format, just append .json at the end of the HTTP POST request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
| Parameter Name | Mandatory/Optional | Value |
|---|---|---|
| destinations | Mandatory | Array; List of destination objects. Each object contains a destination field. |
| destinations[].destination | Mandatory | String; SIP URI in format <ip_or_fqdn>:<port>;transport=<protocol>. Port is typically 5061 for TLS or 5060 for TCP. Transport can be tls (recommended) or tcp. Example: 44.248.146.11:5061;transport=tls, sip.company.com:5061;transport=tls |
curl -X POST "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/destination-uris" \ -H "Content-Type: application/json" \ -d '{ "destinations": [ { "destination": "sip.yourcompany.com:5061;transport=tls" } ] }'
curl -X POST "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/destination-uris" \ -H "Content-Type: application/json" \ -d '{ "destinations": [ { "destination": "44.248.146.11:5061;transport=tls" } ] }'
On success, the HTTP response status code will be 200 OK or 207 Multi-Status (for partial success/failure).
The response includes metadata with counts of successful and failed destinations.
| Parameter Name | Type & Value |
|---|---|
| metadata.total | Integer; Total number of destinations in request |
| metadata.success | Integer; Number of successfully added destinations |
| metadata.failed | Integer; Number of failed destinations |
| id | String; Unique identifier for this destination URI. Example: 2543 |
| destination | String; The SIP URI (prefixed with sip:) |
| type | String; Destination type: public |
| priority | Integer; Priority for load balancing. Lower values = higher priority. Default: 0 |
| weight | Integer; Weight for load balancing. Higher values = more traffic. Default: 1 |
| trunk_sid | String; The trunk this destination is associated with |
| date_created | String; ISO 8601 timestamp when destination was created |
| date_updated | String; ISO 8601 timestamp when destination was last updated |
{
"request_id": "63999f0a98a24a0aa58ab5b74aec9f0a",
"method": "POST",
"http_code": 200,
"metadata": {
"total": 1,
"success": 1,
"failed": 0
},
"response": [
{
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "2543",
"destination": "sip:44.248.146.11:5061;transport=tls",
"date_created": "2026-01-23T13:38:32Z",
"date_updated": "2026-01-23T13:38:32Z",
"type": "public",
"priority": 0,
"weight": 1,
"trunk_sid": "trmum1f708622631150902801a1n"
}
}
]
}
Retrieves all phone numbers mapped to a trunk.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/phone-numbers
If you’d prefer response in JSON format, just append .json at the end of the HTTP GET request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
curl -X GET "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/phone-numbers"
On success, the HTTP response status code will be 200 OK
| Parameter Name | Type & Value |
|---|---|
| metadata.page_size | Integer; Number of results per page |
| metadata.first_page_uri | String; URI for the first page |
| metadata.prev_page_uri | String or null; URI for previous page (null if on first page) |
| metadata.next_page_uri | String or null; URI for next page (null if on last page) |
| response[] | Array; List of phone number objects |
{
"request_id": "785471d288054cbf8c677b75e0b5f2f8",
"method": "GET",
"http_code": 200,
"metadata": {
"page_size": 50,
"first_page_uri": "/v2/accounts/ameyo5m/trunks/trmum1f708622631150902801a1n/phone-numbers?offset=0&page_size=50",
"prev_page_uri": null,
"next_page_uri": null
},
"response": [
{
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "41523",
"phone_number": "+918040264208",
"trunk_sid": "trmum1f708622631150902801a1n",
"date_created": "2026-01-23T13:28:11Z",
"date_updated": "2026-01-23T13:41:59Z",
"mode": "flow"
}
}
]
}
Retrieves all whitelisted IP addresses for a trunk.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/whitelisted-ips
If you’d prefer response in JSON format, just append .json at the end of the HTTP GET request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
curl -X GET "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/whitelisted-ips"
On success, the HTTP response status code will be 200 OK
{
"request_id": "91dc982ca79846479c6f9678c788cfc1",
"method": "GET",
"http_code": 200,
"metadata": {
"page_size": 50,
"first_page_uri": "/v2/accounts/ameyo5m/trunks/trmum1f708622631150902801a1n/whitelisted-ips?offset=0&page_size=50",
"prev_page_uri": null,
"next_page_uri": null
},
"response": [
{
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "1154",
"mask": 32,
"trunk_sid": "trmum1f708622631150902801a1n",
"ip": "44.248.146.11",
"friendly_name": null,
"date_created": "2026-01-23T13:30:04Z",
"date_updated": "2026-01-23T13:30:04Z"
}
}
]
}
Retrieves all destination URIs configured for a trunk.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/destination-uris
If you’d prefer response in JSON format, just append .json at the end of the HTTP GET request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
curl -X GET "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/destination-uris"
On success, the HTTP response status code will be 200 OK
{
"request_id": "bfc1544ab0ab4df3ae49173ccc744331",
"method": "GET",
"http_code": 200,
"metadata": {
"page_size": 50,
"first_page_uri": "/v2/accounts/ameyo5m/trunks/trmum1f708622631150902801a1n/destination-uris?offset=0&page_size=50",
"prev_page_uri": null,
"next_page_uri": null
},
"response": [
{
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "2544",
"destination": "sip:sip.company.com:5061;transport=tls",
"date_created": "2026-01-23T13:39:06Z",
"date_updated": "2026-01-23T13:39:06Z",
"type": "public",
"priority": 0,
"weight": 1,
"trunk_sid": "trmum1f708622631150902801a1n"
}
},
{
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "2543",
"destination": "sip:44.248.146.11:5061;transport=tls",
"date_created": "2026-01-23T13:38:32Z",
"date_updated": "2026-01-23T13:38:32Z",
"type": "public",
"priority": 0,
"weight": 1,
"trunk_sid": "trmum1f708622631150902801a1n"
}
}
]
}
Sets the phone number displayed to called parties on outbound calls. This is useful when you want to display a specific caller ID regardless of which phone number is mapped to the trunk.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/settings
If you’d prefer response in JSON format, just append .json at the end of the HTTP POST request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
| Parameter Name | Mandatory/Optional | Value |
|---|---|---|
| settings | Mandatory | Array; List of setting objects |
| settings[].name | Mandatory | String; Setting name. Use trunk_external_alias for caller ID |
| settings[].value | Mandatory | String; The phone number to display as caller ID. Should be in E.164 format. Example: +919876543210 |
curl -X POST "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/settings" \ -H "Content-Type: application/json" \ -d '{ "settings": [ { "name": "trunk_external_alias", "value": "+919876543210" } ] }'
On success, the HTTP response status code will be 200 OK
| Parameter Name | Type & Value |
|---|---|
| metadata.total | Integer; Total number of settings in request |
| metadata.success | Integer; Number of successfully applied settings |
| name | String; Setting name (trunk_external_alias) |
| value | String; The caller ID phone number |
| trunk_sid | String; The associated trunk |
| date_created | String; ISO 8601 timestamp when setting was created |
| date_updated | String; ISO 8601 timestamp when setting was last updated |
{
"request_id": "8ce98845365f43fd97c2f46df38438c6",
"method": "POST",
"http_code": 200,
"metadata": {
"total": 1,
"success": 1
},
"response": [
{
"code": 200,
"error_data": null,
"status": "success",
"data": {
"name": "trunk_external_alias",
"value": "+919876543210",
"trunk_sid": "trmum1f708622631150902801a1n",
"date_created": "2026-01-23T13:34:50Z",
"date_updated": "2026-01-23T13:34:50Z"
}
}
]
}
Permanently deletes a trunk and all its associated configurations (phone numbers, ACLs, destination URIs).
⚠️ Warning: This action cannot be undone. All associated phone number mappings, whitelisted IPs, and destination URIs will be permanently deleted.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks?trunk_sid=<trunk_sid>
If you’d prefer response in JSON format, just append .json at the end of the HTTP DELETE request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
| Header | Value |
|---|---|
| Content-Type | application/json |
curl -X DELETE "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks?trunk_sid=<trunk_sid>"
On success, the HTTP response status code will be 200 OK
{
"request_id": "f708818c79f547b3aee31c4a480367a5",
"method": "DELETE",
"http_code": 200,
"response": {
"code": 200,
"error_data": null,
"status": "success",
"data": {
"trunk_name": "my_trunk1234",
"date_created": "2026-01-23T13:25:39Z",
"date_updated": "2026-01-23T13:25:39Z",
"trunk_sid": "trmum15f77c83605998cdb9d1a1n",
"status": "active",
"domain_name": "ameyo5m.pstn.exotel.com",
"auth_type": "IP-WHITELIST",
"registration_enabled": "disabled",
"edge_preference": "auto",
"nso_code": "ANY-ANY",
"secure_trunking": "disabled",
"destination_uris": "/v2/accounts/ameyo5m/trunks/trmum15f77c83605998cdb9d1a1n/destination-uris",
"whitelisted_ips": "/v2/accounts/ameyo5m/trunks/trmum15f77c83605998cdb9d1a1n/whitelisted-ips",
"credentials": "/v2/accounts/ameyo5m/trunks/trmum15f77c83605998cdb9d1a1n/credentials",
"phone_numbers": "/v2/accounts/ameyo5m/trunks/trmum15f77c83605998cdb9d1a1n/phone-numbers"
}
}
}
Updates the routing mode for a mapped phone number. Use this to switch between PSTN and StreamKit (Voice AI) modes.
https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/whitelisted-ips
If you’d prefer response in JSON format, just append .json at the end of the HTTP GET request.
Replace <your_api_key> and <your_api_token> with the API key and token created by you.
<your_sid> with your “Account sid”<subdomain> with the region of your account<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard
Important: The <phone_number_id> is the numeric ID returned when you mapped the phone number (e.g., 41523), NOT the phone number itself.
| Header | Value |
|---|---|
| Content-Type | application/json |
| Parameter Name | Mandatory/Optional | Value |
|---|---|---|
| phone_number | Mandatory | String; The phone number in E.164 format. Must match the phone number associated with the ID. Example: +919876543210 |
| mode | Mandatory | String; The new routing mode. Can be: pstn - Route calls to telephone network, flow - Route calls to Voice AI bot (StreamKit) |
curl -X PUT "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/phone-numbers/41523" \ -H "Content-Type: application/json" \ -d '{ "phone_number": "+918040264208", "mode": "flow" }'
curl -X PUT "https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<your_sid>/trunks/<trunk_sid>/phone-numbers/41523" \ -H "Content-Type: application/json" \ -d '{ "phone_number": "+918040264208", "mode": "pstn" }'
On success, the HTTP response status code will be 200 OK
| Parameter Name | Type & Value |
|---|---|
| id | String; The phone number mapping ID |
| phone_number | String; The phone number in E.164 format |
| trunk_sid | String; The associated trunk |
| mode | String; The updated routing mode (pstn or flow) |
| date_created | String; ISO 8601 timestamp when mapping was created |
| date_updated | String; ISO 8601 timestamp when mapping was updated (will be updated after this call) |
{
"request_id": "c719cd56eb5943e789e1bdbd4ce1515a",
"method": "PUT",
"http_code": 200,
"response": {
"code": 200,
"error_data": null,
"status": "success",
"data": {
"id": "41523",
"phone_number": "+918040264208",
"trunk_sid": "trmum1f708622631150902801a1n",
"date_created": "2026-01-23T13:28:11Z",
"date_updated": "2026-01-23T13:41:59Z",
"mode": "flow"
}
}
}