Get list of available numbers for specified country
Overview
The phone numbers are picked out from the whole pool of available numbers for the country in a random manner. If the filtering parameters are specified, the numbers are selected after filtration is applied.
The maximum quantity of suggested numbers is 10.
To get the list of available numbers for specified country, make the GET request to /accounts/{accountSID}/availableNumbers/{countryCode}.
Request example
The following example demonstrates getting a list of available numbers for the country.
curl –X GET https://api.apifonica.com/v2/accounts/{accountSID}/availableNumbers/fi \
-u {accountSID}:{authToken}
Response example
{
"country_code": "FI",
"country_name": "Finland",
"available_numbers": [
{
"number": "3584573976170",
"type": "mobile"
"voice": false,
"messaging": true
}, ...
]
}
Response parameters
Parameter | Description |
---|---|
Parameter | Description |
country_code | Either country code according to ISO 3166-1 alpha-2 or “international”. |
country_name | Full name of the country. |
available_numbers | List of numbers available for rent in the specified country for specified account. |
available_numbers/number | Phone number in E.164 format. |
available_numbers/type | Number type. One of the following: local, mobile, toll-free or sip. |
available_numbers/voice | Availability of voice communications for this number. >Either true or false. |
available_numbers/messaging | Availability of messaging for this number. Either true or false. |
Response filtering
To narrow the response results, specify filtering parameters in the GET request to /accounts/{accountSID}/availableNumbers/{countryCode}.
Request example (with filtering)
The following cURL request demonstrates getting a list of available mobile numbers with the enabled messaging feature.
curl –X GET https://api.apifonica.com/v2/accounts/{accountSID}/availableNumbers/ru?type=mobile&messaging=true \
-u {accountSID}:{authToken}
Filtering parameters
Parameter | Description |
---|---|
number | Phone number in E.164 format. |
type | Number type. One of the following: local, mobile, toll-free or sip. |
voice | Availability of voice communications for this number. Either true or false. |
messaging | Availability of messaging for this number. Either true or false. |