GetAreas JSON Service

Use HTTPS and your own API credentials. POST examples keep credentials out of URL paths. The older positional GET format remains supported, but credentials in URLs can appear in logs and browser history.

This function will provide a JSON formatted list of areas where numbers are available for purchase

Meta:

GetAreas(Username, Password, CountryCode)

Sample usage:

POST:

curl --fail-with-body --show-error \
  --request POST 'https://api.multitel.net/json/getareas' \
  --data-urlencode "UserName=$MULTITEL_API_USERNAME" \
  --data-urlencode "Password=$MULTITEL_API_PASSWORD" \
  --data-urlencode "CountryCode=US"

GET:

curl --fail-with-body --show-error --request GET \
  "https://api.multitel.net/json/getareas/${MULTITEL_API_USERNAME_URLENCODED}/${MULTITEL_API_PASSWORD_URLENCODED}/US"


Please note that for both POST and GET you can also obtain the XML formatted output by using the following base link:

https://api.multitel.net/xml/getareas/

Or, for PHP-Curl/HTML example, see below:

<?php
$handle = curl_init('https://api.multitel.net/json/getareas');
curl_setopt_array($handle, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query([
        'UserName' => getenv('MULTITEL_API_USERNAME'),
        'Password' => getenv('MULTITEL_API_PASSWORD'),
        'CountryCode' => 'US',
    ]),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($handle);
if ($response === false) {
    throw new RuntimeException(curl_error($handle));
}
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
    throw new RuntimeException('API HTTP status: ' . $status);
}
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);
// Inspect DATA and the documented API return values before using the result.


Result will be:

{
  "DATA": [
    {
      "AREACODE": "1201",
      "DESCRIPTION": "Jersey City",
      "CLATITUDE": "38.889747",
      "CLONGITUDE": "-77.025599",
      "ALATITUDE": "40.7281575",
      "ALONGITUDE": "-74.0776417"
    },
    {
      "AREACODE": "1202",
      "DESCRIPTION": "Washington",
      "CLATITUDE": "38.889747",
      "CLONGITUDE": "-77.025599",
      "ALATITUDE": "38.8951118",
      "ALONGITUDE": "-77.0363658"
    },
    {
      "AREACODE": "1203",
      "DESCRIPTION": "Bridgeport",
      "CLATITUDE": "38.889747",
      "CLONGITUDE": "-77.025599",
      "ALATITUDE": "41.0771914",
      "ALONGITUDE": "-73.4686858"
    },
    {
      "AREACODE": "1205",
      "DESCRIPTION": "Central Alabama",
      "CLATITUDE": "38.889747",
      "CLONGITUDE": "-77.025599",
      "ALATITUDE": "33.5206608",
      "ALONGITUDE": "-86.8024900"
    },
    {
      "AREACODE": "1206",
      "DESCRIPTION": "Seattle",
      "CLATITUDE": "38.889747",
      "CLONGITUDE": "-77.025599",
      "ALATITUDE": "47.6062095",
      "ALONGITUDE": "-122.3320708"
    },
    {
      "AREACODE": "1207",
      "DESCRIPTION": "Maine",
      "CLATITUDE": "38.889747",
      "CLONGITUDE": "-77.025599",
      "ALATITUDE": "43.3617327",
      "ALONGITUDE": "-70.4767274"
    },
    {
      "AREACODE": "1208",
      "DESCRIPTION": "Idaho",
      "CLATITUDE": "38.889747",
      "CLONGITUDE": "-77.025599",
      "ALATITUDE": "43.4916514",
      "ALONGITUDE": "-112.0339645"
    }
  ]
}

Please note that CLATITUDE and CLONGITUDE refer to Country Latitude and Country Longitude.

Search documentation