Map Phone Number to Trunk
7 min
associates a phone number (did/exophone) with the trunk this phone number will be used for making and receiving calls through the trunk http request post https //\<your api key> \<your api token>@\<subdomain>/v2/accounts/\<your sid>/trunks/\<trunk sid>/phone numbers request headers header value content type application/json request parameters 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, +912247790597 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 nulland behaves as pstn example request curl s 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" }' for streamkit (voice ai) mode curl s 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" }' http response on success, the http response status code will be 200 ok important save the idfrom the response this numeric id is required for the update phone number mode api example response { "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" null } } } response parameters 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
