API Request


HTTP
http or https
APIKEY
Unique account identifier received after signup
POSTALCODE
Postal code to lookup.
POSTALCODE2
Second postal code required for distance lookup.
RADIUS
Distance in miles or kilometers, default is miles.
Zip Code to Location

http://postalcode.parseapi.com/api/APIKEY/POSTALCODE
Distance between two Zip Codes

http://postalcode.parseapi.com/api/APIKEY/distance/POSTALCODE/POSTALCODE2
Zip Codes in a radius of a Zip Code

http://postalcode.parseapi.com/api/APIKEY/radius/POSTALCODE/RADIUS

API Response


Example Response JSON

{
    "continent": {
        "code": "NA",
        "name": "North America"
    },
    "country": {
        "area": "9629091",
        "capital": "Washington",
        "iso_alpha2": "US",
        "iso_alpha3": "USA",
        "iso_numeric": 840,
        "name": "United States",
        "tld": ".us"
    },
    "state": {
        "name": "North Carolina",
        "short": "NC"
    },
    "county": {
        "name": "Rutherford"
    },
    "city": {
        "name": "Forest City"
    },
    "code": {
        "latitude": "35.32500000",
        "longitude": "-81.84600000",
        "name": "28043"
    },
    "currency": {
        "code": "USD",
        "name": "Dollar"
    }
}

Sample Code


curl

	curl "http://postalcode.parseapi.com/api/APIKEY/28043";
PHP

<?php
	$request = file_get_contents("http://postalcode.parseapi.com/api/APIKEY/28043");
	$data = json_decode($request, true);
	print_r($data);
?>
PHP using curl

<?php
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, "http://postalcode.parseapi.com/api/APIKEY/28043");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
	$data = curl_exec($ch);
	curl_close($ch);
	
	print_r($data);
?>
Javascript

<script>
	var code = encodeURIComponent('28043');
	var xhr = new XMLHttpRequest();
	xhr.open('GET', 'http://postalcode.parseapi.com/api/APIKEY/'+code, false);
	xhr.send();

	if (xhr.status == 200) {
		var data = JSON.parse(xhr.responseText);
		console.log(data);
	}
</script>
Javascript using jQuery

<script>
	$(document).ready(function() {
		var code = encodeURIComponent('28043');
		$.get('http://postalcode.parseapi.com/api/APIKEY/'+code, function(data) {
			console.log(data);
		});
	});	
</script>
Python

	import requests
	r = requests.get('http://postalcode.parseapi.com/api/APIKEY', params={'code': '28043'})
	data = r.json()
Ruby

	require 'net/http'
	require 'json'
	
	uri = URI('http://postalcode.parseapi.com/api/APIKEY/28043')
	response = Net::HTTP.get(uri)
	JSON.parse(response)
Node.js

	var request = require('request');
	
	var url = 'http://postalcode.parseapi.com/api/APIKEY/28043';
	
	request(url, function (error, response, body) {
		if (!error && response.statusCode == 200) {
			var data = JSON.parse(body);
		}
	});