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 postal codes from 116 countries, 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
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).
populationpremium onlyPopulation of the nearest populated place to the ZIP centroid.
elevation_mpremium onlyElevation in metres of the nearest populated place.
climate_zonepremium onlyKöppen-Geiger climate classification code (e.g.
Csa).urbanisationpremium onlyDegree of urbanisation, from
URBAN_CENTREtoVERY_LOW_DENSITY_RURAL.nearest_airportpremium onlyNearest IATA-coded airport, with its name, codes, coordinates, distance in km and bearing.
zctapremium onlyThe ZIP Code Tabulation Area (ZCTA) this ZIP maps to. Census demographics and boundaries are published for ZCTAs, not ZIP Codes. Around 19% of USPS ZIP Codes — PO-box-only, single-organization and military ZIPs — have no ZCTA; for those this is
nulland the ZCTA-level fields below are unavailable.land_area_sqmipremium onlyLand area of the ZCTA in square miles.
water_area_sqmipremium onlyWater area of the ZCTA in square miles.
state_fipspremium only2-digit state FIPS code.
county_fipspremium only5-digit county FIPS code of the county covering most of the ZIP Code.
tract_fipspremium only11-digit Census tract FIPS code of the tract covering most of the ZIP Code.
countiespremium onlyEvery county the ZIP Code overlaps, each with its
fips,nameandland_share. About 30% of ZIP Codes span more than one county, and some cross state lines.cbsa_codepremium onlyCore Based Statistical Area (metro or micro area) code, per the OMB 2023 delineation.
nulloutside any CBSA.cbsa_titlepremium onlyName of the Core Based Statistical Area.
cbsa_typepremium onlyEither
metroormicro.csa_codepremium onlyCombined Statistical Area code, where one applies.
csa_titlepremium onlyName of the Combined Statistical Area.
timezonespremium onlyArray of IANA timezone identifiers covering the ZIP Code. More than one entry means the ZIP Code sits in a county split across a timezone boundary.
observes_dstpremium onlyWhether the location observes daylight saving time.
nullwhere the answer is not uniform across the county — in Apache, Coconino and Navajo counties, Arizona, the Navajo Nation observes DST while the surrounding state and the Hopi Reservation within it do not.timezone_is_splitpremium onlytruewhen the ZIP Code's county is divided by a timezone or daylight-saving boundary, so a single timezone cannot describe the whole area.utc_offset_stdpremium onlyStandard-time UTC offset, e.g.
-08:00.utc_offset_currentpremium onlyUTC offset in effect right now, resolved per request, e.g.
-07:00during daylight saving.is_dst_nowpremium onlyWhether daylight saving time is currently in effect at this location.
school_districtspremium onlyEvery school district overlapping the ZIP Code, each with its NCES
leaid,name,type(unified, elementary or secondary) andland_share. School district boundaries are not nested inside ZIP Codes — 61% of ZIP Codes touch more than one district.primary_school_districtpremium onlyName of the school district covering the largest share of the ZIP Code.
primary_school_district_leaidpremium onlyNCES local education agency ID of the primary school district.
congressional_districtspremium onlyEvery congressional district overlapping the ZIP Code, each with its
districtcode,nameandland_share. Roughly 15% of ZIP Codes span more than one district.congressional_district_vintagepremium onlyWhich set of congressional boundaries the districts above reflect, e.g.
cd119for the 119th Congress. Ten states redrew their maps for the 2026 election cycle, so the vintage is stated explicitly rather than implied.state_legislative_upperpremium onlyEvery state senate (upper chamber) district overlapping the ZIP Code, with
district,nameandland_share.state_legislative_lowerpremium onlyEvery state house (lower chamber) district overlapping the ZIP Code, with
district,nameandland_share. Nebraska has a unicameral legislature and returns none.demographicspremium onlyAmerican Community Survey 2020–2024 5-year estimates for the ZCTA:
population,median_age,median_household_income,per_capita_income,median_home_value,median_gross_rent,housing_units,owner_occupied_pct,poverty_rate,unemployment_rate,bachelors_or_higher_pctandmean_commute_minutes. Individual estimates arenullwhere the Census Bureau suppresses them for small sample sizes — most often median gross rent, which is unavailable for about 24% of ZCTAs. Where a median falls in an open-ended top or bottom category, the value is the category bound andestimate_flagsnames the affected field.
ZIP Codes are collections of postal delivery routes rather than areas, so the Census Bureau publishes statistics for ZIP Code Tabulation Areas (ZCTAs), which approximate them. Fields derived from a ZCTA are marked above and are unavailable for the ZIP Codes that have no ZCTA. ZCTA boundaries are fixed to the 2020 Census and are next redrawn after the 2030 Census.
Querying by city or state can match thousands of ZIP Codes, so those responses return the single-value fields only. Query a specific ZIP Code to receive counties, school_districts, the district arrays and demographics.
Source data is in the public domain: U.S. Census Bureau (geography, TIGER/Line boundaries and American Community Survey), NOAA/National Weather Service and the U.S. Department of Transportation (timezones), and the National Center for Education Statistics (school districts). This product uses TIGER/Line Shapefiles repackaged from the U.S. Census Bureau; it is neither endorsed nor certified by the Census Bureau.
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 postal codes anywhere else in the world, use the Postal Code API instead, which covers over 100 countries, and see the full API catalog for other location tools like the County API and City API.