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 Canadian postal codes, 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


/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:

  • 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).

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",
        "424"
      ],
      country:"US",
      lat:"34.0901",
      lon:"-118.4065"
    }
]

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 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.