List area codes available for purchasing numbers

Method

GET

Path

public/area_codes

Returns a list of area codes available for purchasing Phaxio numbers. Authentication for this resource is optional. If credentials are supplied, then the list of area codes returned will be specific to the countries in which the authenticated user may provision numbers.

Request Parameters

Name Type Description
toll_free boolean If set to `true`, only toll free area codes will be returned. If specified and set to `false`, only non-toll free area codes will be returned.
country_code integer A country code (E.164) you'd like to filter by.
country string A two character country abbreviation (ISO 3166; e.g. `US` or `CA`) you'd like to filter by.
state string A two character state or province abbreviation (ISO 3166; e.g. `IL` or `YT`) you'd like to filter by. When using this parameter, `country_code` or `country` must also be provided.

This operation also accepts paging parameters.

Response

A JSON object with success, message, and data, and paging attributes. Results are paginated and the paging attribute holds information about the length of the data for your query. The data attribute contains an array of available area codes matching filter criteria.

Sample Call

curl -G https://api.phaxio.com/v2.1/public/area_codes -d 'per_page=3'

Sample Response

{
    "success":true,
    "message":"Data contains found available area codes",
    "data":[
        {
            "country_code":1,
            "area_code":201,
            "city":"Bayonne, Jersey City, Union City",
            "state":"New Jersey",
            "country":"United States",
            "toll_free":false
        },
        {
            "country_code":1,
            "area_code":202,
            "city":"Washington",
            "state":"District of Columbia",
            "country":"United States",
            "toll_free":false
        },
        {
            "country_code":1,
            "area_code":203,
            "city":"Bridgeport, Danbury, Meriden",
            "state":"Connecticut",
            "country":"United States",
            "toll_free":false
        }
    ],
    "paging":{
        "total":270,
        "per_page":3,
        "page":1
    }
}