Return a list of phone numbers for a user.
curl --request GET \
--url https://api.tryhamsa.com/v1/voice-agents/phone-number/list \
--header 'Authorization: <api-key>'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/phone-number/list"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.tryhamsa.com/v1/voice-agents/phone-number/list', 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.tryhamsa.com/v1/voice-agents/phone-number/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents/phone-number/list"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tryhamsa.com/v1/voice-agents/phone-number/list")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/phone-number/list")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Success",
"data": {
"data": [
{
"id": "d949f13f-40d2-4e48-ac86-b66633070603",
"number": "+14155551212",
"label": "My Twilio Number",
"type": "TWILIO",
"sipInboundConfigs": {
"originationUri": "sip:sbc.tryhamsa.com:5060;transport=tcp",
"allowedAddresses": [
"192.76.120.10",
"185.246.41.0/24"
],
"copyHeaders": [
"User-to-User"
]
},
"sipOutboundConfigs": {
"address": "sip.example.com",
"transportType": "TCP",
"customHeaders": {},
"srtp": "off",
"codecs": [
"PCMU",
"PCMA"
],
"viaSbc": true,
"sbcPublicIp": "34.243.238.8"
},
"websocketUrl": "wss://127.0.0.1:10000",
"secretKey": "1234567890",
"userId": "d949f13f-40d2-4e48-ac86-b66633070603",
"voiceAgentId": "d949f13f-40d2-4e48-ac86-b66633070603",
"voiceAgent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Support Agent"
},
"createdAt": "2023-01-01T12:00:00Z",
"updatedAt": "2023-02-01T12:00:00Z"
}
],
"totalPages": 3,
"page": 1
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Phone Numbers Routes
List User Phone Numbers Route
GET
/
v1
/
voice-agents
/
phone-number
/
list
Return a list of phone numbers for a user.
curl --request GET \
--url https://api.tryhamsa.com/v1/voice-agents/phone-number/list \
--header 'Authorization: <api-key>'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/phone-number/list"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.tryhamsa.com/v1/voice-agents/phone-number/list', 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.tryhamsa.com/v1/voice-agents/phone-number/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents/phone-number/list"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tryhamsa.com/v1/voice-agents/phone-number/list")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/phone-number/list")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Success",
"data": {
"data": [
{
"id": "d949f13f-40d2-4e48-ac86-b66633070603",
"number": "+14155551212",
"label": "My Twilio Number",
"type": "TWILIO",
"sipInboundConfigs": {
"originationUri": "sip:sbc.tryhamsa.com:5060;transport=tcp",
"allowedAddresses": [
"192.76.120.10",
"185.246.41.0/24"
],
"copyHeaders": [
"User-to-User"
]
},
"sipOutboundConfigs": {
"address": "sip.example.com",
"transportType": "TCP",
"customHeaders": {},
"srtp": "off",
"codecs": [
"PCMU",
"PCMA"
],
"viaSbc": true,
"sbcPublicIp": "34.243.238.8"
},
"websocketUrl": "wss://127.0.0.1:10000",
"secretKey": "1234567890",
"userId": "d949f13f-40d2-4e48-ac86-b66633070603",
"voiceAgentId": "d949f13f-40d2-4e48-ac86-b66633070603",
"voiceAgent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Support Agent"
},
"createdAt": "2023-01-01T12:00:00Z",
"updatedAt": "2023-02-01T12:00:00Z"
}
],
"totalPages": 3,
"page": 1
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Query Parameters
Was this page helpful?