Phone Numbers - List Available Localities
Gets the list of cities or towns with available phone numbers.
GET {endpoint}/availablePhoneNumbers/countries/{countryCode}/localities?api-version=2025-06-01
GET {endpoint}/availablePhoneNumbers/countries/{countryCode}/localities?skip={skip}&maxPageSize={maxPageSize}&administrativeDivision={administrativeDivision}&api-version=2025-06-01&phoneNumberType={phoneNumberType}
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
country
|
path | True |
string |
The ISO 3166-2 country code, e.g. US. |
|
endpoint
|
path | True |
string (url) |
The communication resource, for example https://resourcename.communication.azure.com |
|
api-version
|
query | True |
string |
Version of API to invoke |
|
administrative
|
query |
string |
An optional parameter for the name of the state or province in which to search for the area code. |
|
|
max
|
query |
integer (int32) |
An optional parameter for how many entries to return, for pagination purposes. The default value is 100. |
|
|
phone
|
query |
Filter by numberType, e.g. Geographic, TollFree, Mobile. |
||
|
skip
|
query |
integer (int32) |
An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| accept-language |
string |
The locale to display in the localized fields in the response. e.g. 'en-US' |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Success |
|
| Other Status Codes |
Failure |
Examples
Get PhoneNumber Search Result
Sample request
GET https://resourcename.communication.azure.com//availablePhoneNumbers/countries/CA/localities?api-version=2025-06-01&phoneNumberType=mobile
Sample response
{
"phoneNumberLocalities": [
{
"localizedName": "Vancouver",
"administrativeDivision": {
"localizedName": "British Columbia",
"abbreviatedName": "BC"
}
},
{
"localizedName": "Toronto",
"administrativeDivision": {
"localizedName": "Ontario",
"abbreviatedName": "ON"
}
}
]
}
Definitions
| Name | Description |
|---|---|
|
Communication |
The Communication Services error. |
|
Communication |
The Communication Services error. |
|
Phone |
Represents an administrative division. e.g. state or province. |
|
Phone |
Represents a wrapper around a list of cities or towns. |
|
Phone |
Represents a locality. |
|
Phone |
Represents the number type of the offering. |
CommunicationError
The Communication Services error.
| Name | Type | Description |
|---|---|---|
| code |
string |
The error code. |
| details |
Further details about specific errors that led to this error. |
|
| innererror |
The inner error if any. |
|
| message |
string |
The error message. |
| target |
string |
The error target. |
CommunicationErrorResponse
The Communication Services error.
| Name | Type | Description |
|---|---|---|
| error |
The Communication Services error. |
PhoneNumberAdministrativeDivision
Represents an administrative division. e.g. state or province.
| Name | Type | Description |
|---|---|---|
| abbreviatedName |
string |
Represents the abbreviated name of the administrative division of the locality. e.g. state or province abbreviation such as WA (Washington). |
| localizedName |
string |
Represents the localized name of the administrative division of the locality. e.g. state or province localized name. |
PhoneNumberLocalities
Represents a wrapper around a list of cities or towns.
| Name | Type | Description |
|---|---|---|
| nextLink |
string |
Represents the URL link to the next page. |
| phoneNumberLocalities |
Represents the underlying list of localities, e.g. cities or town. |
PhoneNumberLocality
Represents a locality.
| Name | Type | Description |
|---|---|---|
| administrativeDivision |
Represents an administrative division. e.g. state or province. |
|
| localizedName |
string |
Represents the localized name of the locality. |
PhoneNumberType
Represents the number type of the offering.
| Value | Description |
|---|---|
| geographic | |
| tollFree | |
| mobile |