Share via


Phone Numbers - List Area Codes

Gets the list of available area codes.

GET {endpoint}/availablePhoneNumbers/countries/{countryCode}/areaCodes?phoneNumberType={phoneNumberType}&api-version=2025-02-11
GET {endpoint}/availablePhoneNumbers/countries/{countryCode}/areaCodes?phoneNumberType={phoneNumberType}&skip={skip}&maxPageSize={maxPageSize}&assignmentType={assignmentType}&locality={locality}&administrativeDivision={administrativeDivision}&api-version=2025-02-11

URI Parameters

Name In Required Type Description
countryCode
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

phoneNumberType
query True

PhoneNumberType

Filter by numberType, e.g. Geographic, TollFree.

administrativeDivision
query

string

The name of the state or province in which to search for the area code.

assignmentType
query

PhoneNumberAssignmentType

Filter by assignmentType, e.g. Person, Application.

locality
query

string

The name of locality or town in which to search for the area code. This is required if the number type is Geographic.

maxPageSize
query

integer (int32)

An optional parameter for how many entries to return, for pagination purposes. The default value is 100.

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

PhoneNumberAreaCodes

Success

Other Status Codes

CommunicationErrorResponse

Failure

Examples

Get Area Codes Search Result

Sample request

GET https://resourcename.communication.azure.com//availablePhoneNumbers/countries/CA/areaCodes?phoneNumberType=geographic&locality=Vancouver&administrativeDivision=BC&api-version=2025-02-11

Sample response

{
  "areaCodes": [
    {
      "areaCode": "236"
    },
    {
      "areaCode": "604"
    }
  ]
}

Definitions

Name Description
CommunicationError

The Communication Services error.

CommunicationErrorResponse

The Communication Services error.

PhoneNumberAreaCode

Represents an Area Code.

PhoneNumberAreaCodes

The list of available area codes.

PhoneNumberAssignmentType

Represents the assignment type of the offering.

PhoneNumberType

Represents the number type of the offering.

CommunicationError

The Communication Services error.

Name Type Description
code

string

The error code.

details

CommunicationError[]

Further details about specific errors that led to this error.

innererror

CommunicationError

The inner error if any.

message

string

The error message.

target

string

The error target.

CommunicationErrorResponse

The Communication Services error.

Name Type Description
error

CommunicationError

The Communication Services error.

PhoneNumberAreaCode

Represents an Area Code.

Name Type Description
areaCode

string

An area code.

PhoneNumberAreaCodes

The list of available area codes.

Name Type Description
areaCodes

PhoneNumberAreaCode[]

Represents a list of available toll-free area codes.

nextLink

string

Represents the URL link to the next page.

PhoneNumberAssignmentType

Represents the assignment type of the offering.

Value Description
person
application

PhoneNumberType

Represents the number type of the offering.

Value Description
geographic
tollFree