Area Code API Documentation

Overview

The area code API is designed for developers with experience programming. If you are looking for a copy and paste solution, try our area code widgets. The API provides output in either JSON or XML format. An API key is not required, but we require that you provide certain parameters that will allow us to track API usage. API rate limits are currently unpublished. The following data is provided by the API.

  • Area code timezone
  • Current time in the timezone
  • Area code state

API URL

JSON: http://www.allareacodes.com/api/1.0/api.json
- or -
XML: http://www.allareacodes.com/api/1.0/api.xml

GET Parameters

NameTypeDescription
npaint3 digit area code to be looked up
tracking_emailstringA valid email address that can be used to contact the administrator in case of any issues.
tracking_urlstringThe URL in which the API results are displayed to users. If the API is being used for non-public presentation, specify your company's website address instead. It must be a full URL including the protocol (for instance, "http://")

Terms of Use

The API is provided as-is. AllAreaCodes.com takes no liability for the use of this data. You may not cache, store, or sub-license the data, and AllAreaCodes.com reserves the right to discontinue the API at any time.

We require that every web page that displays the data from the API display the following link back to AllAreaCodes.com. The tracking_url parameter should be set to the page in which the API results are being displayed and the link below is displayed.

<a href="http://www.allareacodes.com/">Area code</a> data by <a href="http://www.allareacodes.com/"><img border="0" src="http://www.allareacodes.com/images/new_logo_small.gif" alt="All Area Codes" align=absmiddle></a>

Sample JSON Response

{
	status: "success",
	error_message: "",
	area_codes: [
		{
			area_code: "601",
			state: "MS",
			timezone: "Central",
			current_time: "11:38am"
		}
	]
}

PHP Example

<?php
function getAreaCodeInfo($npa) {
	$q = http_build_query(array(
		"npa" => $npa, 
		"tracking_email" => $_SERVER[SERVER_ADMIN], 
		"tracking_url" => "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"
		));
	$contents = file_get_contents("http://www.allareacodes.com/api/1.0/api.json?$q");
	$json = json_decode($contents, true);
	return $json;
}

$data = getAreaCodeInfo(601);
print "Area code 601 is located in " . $data[area_codes][0]["state"] . ".\n\n";
print "Timezone: " . $data[area_codes][0]["timezone"] . "\n\n";
print "Current time: " . $data[area_codes][0]["current_time"];
?>

Example Output

Area code 601 is located in MS.

Timezone: Central

Current time: 6:26pm

More Information

For API suggestions or partnership inquiries, please contact us. However, technical support for the API is not provided.

Search by City:

Area Codes by Number

200s
300s
400s
500s
600s
700s
800s
900s

U.S. Area Code List
by State with Cities

Canadian
Area Code Listings

Other US Area Codes

Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
Washington, DC
West Virginia
Wisconsin
Wyoming
Canadian Area Codes

Alberta
British Columbia
Manitoba
New Brunswick
Newfoundland
Northwest Territories
Nova Scotia
Nunavut
Ontario
Prince Edward Island
Quebec
Saskatchewan
Yukon
American Samoa
Guam
Puerto Rico
Virgin Islands
Washington, DC

Other

Articles & Infographics
Reverse Phone Directory
International Dialing Codes
Area Codes by State