Read the labs blog
SunlightLabs API
places.getStateFromZip
Get the state abbreviation from a 5 digit zip code
Arguments
These are all $_GET parameters.
zip (required)
The 5 digit zipcode
apikey (required)
your individual API key
metadata (optional)
&metadata=true provides detail about source, last update of the information etc. Click here for details
output (optional)
&output=json is set by default. You can also use &output=xml
Example Call
http://api.sunlightlabs.com/places.getStateFromZip.php?zip=20740 &apikey=23kj234kjb3kjbcl87ds
says give me the abbreviation of the state containing the zipcode 20740.
Example Response
For the default JSON:
{ "zip": "20740", "state": "MD" }
For XML:
<results> <zip>20740</zip> <state>MD</state> </results>
Error Codes
If there is an error: a plain text string will be returned:
100: invalid API key
The API key was invalid
101: API key not valid for this method
Not permitted to call this particular method with this particular API key
205: invalid zip5
The zip5 was not valid

