Telephony
Purchasing Phone Numbers
A guide to purchasing a phone number to dial in to or dial out from a Daily Bot
We offer several search filters, such as, region
, city
, areacode
, etc that can help narrow down the search space for a phone number.
curl --request GET \
--url 'https://api.daily.co/v1/list-available-numbers?region=CA' \
--header 'Authorization: Bearer $TOKEN'
The response contains numbers that meet the chosen criteria. For simplicty, in the below examples, we will use +19499870006
as an example phone_number
.
{
"total_count": 1,
"data": [{
"number": "+19499800001",
"region": "CA"
}]
}
To purchase the chosen number, make a POST request to the buy-phone-number and pass the chosen phone number in the data field. See below:
curl --request POST \
--url 'https://api.daily.co/v1/buy-phone-number' \
--header 'Authorization: Bearer $TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"number": "+19499800001"
}'
The response returns the phone number and a unique id. The unique id is needed when releasing the chosen phone number, for example.
{
"id": "5ccc01ca-f448-4f17-b7b4-cf354b7b8256",
"number": "+19499800001"
}
You can also list all your purchased phone numbers using the following API
curl --request GET \
--url 'https://api.daily.co/v1/purchased-phone-numbers' \
--header 'Authorization: Bearer $TOKEN'
{
"total_count": 1,
"data": [{
"name": null,
"id": "5ccc01ca-f448-4f17-b7b4-cf354b7b8256",
"created_date": "Mon, 19 Aug 2024 18:50:34 +0000",
"type": "purchased_phone_number",
"number": "+19499800001",
"status": "verified",
"verified": true
}]
}