Zip Code API
The Zip Code API enables you to look up detailed information for every ZIP Code in the United States. You can input ZIP Codes directly, or search for ZIP Codes using city and state parameters.
If you're looking for Canadian postal codes, use the Postal Code API instead.
From 4,878 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 339ms | 365ms | 405ms | 653ms | 1131ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/zipcode GET
https://api.api-ninjas.com/v1/zipcode
Returns a list of ZIP Code details matching the input parameters.
Parameters
At least one of the following parameters must be set:
zipoptionalThe ZIP Code to look up.
cityoptional premium onlyFull name of the city to search (case-sensitive).
stateoptional premium only2-letter abbreviation of the state (case-insensitive).
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.
zip_codeThe ZIP Code.
validpremium onlyWhether the ZIP Code is valid.
citypremium onlyThe city name associated with the ZIP Code.
stateThe 2-letter state abbreviation (e.g., CA, NY, TX).
countypremium onlyThe county name associated with the ZIP Code.
timezoneThe timezone for the location (e.g., America/Los_Angeles).
area_codespremium onlyAn array of area codes associated with the ZIP Code.
country2-letter ISO 3166-1 alpha-2 country code (e.g., US, CA, etc.).
latThe latitude coordinate of the ZIP Code location (centroid).
lonThe longitude coordinate of the ZIP Code location (centroid).
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/zipcode?zip=90210Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/zipcode?zip=90210" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Zip Code API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Zip Code API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Zip Code API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Zip Code API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.How do I look up a ZIP Code with the Zip Code API?
You must set at least one of thezip,city, orstateparameters; passzip(e.g. 90210) to look up a single code directly, or combinecityandstateto find matching codes. Note thatcityandstatesearches require a premium plan, andcityis case-sensitive whilestatetakes a 2-letter abbreviation.What information does the Zip Code API return for each result?
The endpoint returns a JSON array of objects with fields includingzip_code,city,state,county,timezone,area_codes,country, and the centroidlatandloncoordinates. Several fields such asvalid,city,county, andarea_codesare available on premium plans only.What are some use cases for the Zip Code API?
It is useful for validating customer addresses at checkout, auto-fillingcityandstatefrom a ZIP Code, mapping locations with the returnedlatandloncoordinates, and routing leads bytimezoneorarea_codes. You can pair it with the Sales Tax API or Property Tax API for location-based tax lookups.Does the Zip Code API cover international postal codes?
No, the Zip Code API covers ZIP Codes in the United States only. For Canadian postal codes, use the Postal Code API instead, and see the full API catalog for other location tools like the County API and City API.