NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

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.

(4.3)

From 4,878 users

900+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
339ms365ms405ms653ms1131ms

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:

  • zip  optional

    The ZIP Code to look up.

  • city  optional premium only

    Full name of the city to search (case-sensitive).

  • state  optional premium only

    2-letter abbreviation of the state (case-insensitive).

Headers

  • X-Api-Key  required

    API 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_code

    The ZIP Code.

  • valid   premium only

    Whether the ZIP Code is valid.

  • city   premium only

    The city name associated with the ZIP Code.

  • state

    The 2-letter state abbreviation (e.g., CA, NY, TX).

  • county   premium only

    The county name associated with the ZIP Code.

  • timezone

    The timezone for the location (e.g., America/Los_Angeles).

  • area_codes   premium only

    An array of area codes associated with the ZIP Code.

  • country

    2-letter ISO 3166-1 alpha-2 country code (e.g., US, CA, etc.).

  • lat

    The latitude coordinate of the ZIP Code location (centroid).

  • lon

    The longitude coordinate of the ZIP Code location (centroid).

  • population  premium only

    Population of the nearest populated place to the ZIP centroid.

  • elevation_m  premium only

    Elevation in metres of the nearest populated place.

  • climate_zone  premium only

    Köppen-Geiger climate classification code (e.g. Csa).

  • urbanisation  premium only

    Degree of urbanisation, from URBAN_CENTRE to VERY_LOW_DENSITY_RURAL.

  • nearest_airport  premium only

    Nearest IATA-coded airport, with its name, codes, coordinates, distance in km and bearing.

  • zcta  premium only

    The 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 null and the ZCTA-level fields below are unavailable.

  • land_area_sqmi  premium only

    Land area of the ZCTA in square miles.

  • water_area_sqmi  premium only

    Water area of the ZCTA in square miles.

  • state_fips  premium only

    2-digit state FIPS code.

  • county_fips  premium only

    5-digit county FIPS code of the county covering most of the ZIP Code.

  • tract_fips  premium only

    11-digit Census tract FIPS code of the tract covering most of the ZIP Code.

  • counties  premium only

    Every county the ZIP Code overlaps, each with its fips, name and land_share. About 30% of ZIP Codes span more than one county, and some cross state lines.

  • cbsa_code  premium only

    Core Based Statistical Area (metro or micro area) code, per the OMB 2023 delineation. null outside any CBSA.

  • cbsa_title  premium only

    Name of the Core Based Statistical Area.

  • cbsa_type  premium only

    Either metro or micro.

  • csa_code  premium only

    Combined Statistical Area code, where one applies.

  • csa_title  premium only

    Name of the Combined Statistical Area.

  • timezones  premium only

    Array 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_dst  premium only

    Whether the location observes daylight saving time. null where 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_split  premium only

    true when 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_std  premium only

    Standard-time UTC offset, e.g. -08:00.

  • utc_offset_current  premium only

    UTC offset in effect right now, resolved per request, e.g. -07:00 during daylight saving.

  • is_dst_now  premium only

    Whether daylight saving time is currently in effect at this location.

  • school_districts  premium only

    Every school district overlapping the ZIP Code, each with its NCES leaid, name, type (unified, elementary or secondary) and land_share. School district boundaries are not nested inside ZIP Codes — 61% of ZIP Codes touch more than one district.

  • primary_school_district  premium only

    Name of the school district covering the largest share of the ZIP Code.

  • primary_school_district_leaid  premium only

    NCES local education agency ID of the primary school district.

  • congressional_districts  premium only

    Every congressional district overlapping the ZIP Code, each with its district code, name and land_share. Roughly 15% of ZIP Codes span more than one district.

  • congressional_district_vintage  premium only

    Which set of congressional boundaries the districts above reflect, e.g. cd119 for the 119th Congress. Ten states redrew their maps for the 2026 election cycle, so the vintage is stated explicitly rather than implied.

  • state_legislative_upper  premium only

    Every state senate (upper chamber) district overlapping the ZIP Code, with district, name and land_share.

  • state_legislative_lower  premium only

    Every state house (lower chamber) district overlapping the ZIP Code, with district, name and land_share. Nebraska has a unicameral legislature and returns none.

  • demographics  premium only

    American 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_pct and mean_commute_minutes. Individual estimates are null where 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 and estimate_flags names 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!

zip
city premium
state premium

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=90210

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
[
    {
      zip_code:"90210",
      valid:true,
      city:"Beverly Hills",
      state:"CA",
      county:"Los Angeles County",
      timezone:"America/Los_Angeles",
      area_codes:[
        "310",
        "323",
        "424"
      ],
      country:"US",
      lat:"34.1031",
      lon:"-118.4163",
      population:32701,
      elevation_m:79,
      climate_zone:"Csa",
      urbanisation:"URBAN_CENTRE",
      nearest_airport:{
        name:"Los Angeles International Airport",
        iata:"LAX",
        icao:"KLAX",
        latitude:33.94254,
        longitude:-118.408049,
        distance_km:16.5,
        bearing:182
      },
      zcta:"90210",
      land_area_sqmi:10.748,
      water_area_sqmi:0.054,
      state_fips:"06",
      county_fips:"06037",
      tract_fips:"06037261102",
      counties:[
        {
          fips:"06037",
          name:"Los Angeles County",
          land_share:1
        }
      ],
      cbsa_code:"31080",
      cbsa_title:"Los Angeles-Long Beach-Anaheim, CA",
      cbsa_type:"metro",
      csa_code:"348",
      csa_title:"Los Angeles-Long Beach, CA",
      timezones:[
        "America/Los_Angeles"
      ],
      observes_dst:true,
      timezone_is_split:false,
      utc_offset_std:"-08:00",
      utc_offset_current:"-07:00",
      is_dst_now:true,
      school_districts:[
        {
          leaid:"0622710",
          name:"Los Angeles Unified School District",
          type:"unified",
          land_share:0.5933
        },
        {
          leaid:"0604830",
          name:"Beverly Hills Unified School District",
          type:"unified",
          land_share:0.4067
        }
      ],
      primary_school_district:"Los Angeles Unified School District",
      primary_school_district_leaid:"0622710",
      congressional_districts:[
        {
          district:"0632",
          name:"Congressional District 32",
          land_share:0.6231
        },
        {
          district:"0636",
          name:"Congressional District 36",
          land_share:0.3762
        }
      ],
      congressional_district_vintage:"cd119",
      state_legislative_upper:[
        {
          district:"06024",
          name:"State Senate District 24",
          land_share:0.9432
        },
        {
          district:"06027",
          name:"State Senate District 27",
          land_share:0.0568
        }
      ],
      state_legislative_lower:[
        {
          district:"06051",
          name:"Assembly District 51",
          land_share:0.6445
        },
        {
          district:"06042",
          name:"Assembly District 42",
          land_share:0.2984
        },
        {
          district:"06044",
          name:"Assembly District 44",
          land_share:0.0568
        }
      ],
      demographics:{
        population:19004,
        median_age:51.9,
        median_household_income:187801,
        per_capita_income:147098,
        median_home_value:2000001,
        median_gross_rent:3251,
        housing_units:9531,
        owner_occupied_pct:70.7,
        poverty_rate:9.2,
        unemployment_rate:5.2,
        bachelors_or_higher_pct:68.1,
        mean_commute_minutes:28.4,
        estimate_flags:[
          "median_home_value_top_coded"
        ]
      }
    }
]

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

  • 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.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • You must set at least one of the zip, city, or state parameters; pass zip (e.g. 90210) to look up a single code directly, or combine city and state to find matching codes. Note that city and state searches require a premium plan, and city is case-sensitive while state takes a 2-letter abbreviation.
  • The endpoint returns a JSON array of objects with fields including zip_code, city, state, county, timezone, area_codes, country, and the centroid lat and lon coordinates. Several fields such as valid, city, county, and area_codes are available on premium plans only.
  • It is useful for validating customer addresses at checkout, auto-filling city and state from a ZIP Code, mapping locations with the returned lat and lon coordinates, and routing leads by timezone or area_codes. You can pair it with the Sales Tax API or Property Tax API for location-based tax lookups.
  • 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.