Save over 30% when you subscribe to an annual subscription plan!

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.

Checking API status...

/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

Returns a JSON array of objects, each with the following properties:

  • zip_code

    The ZIP Code.

  • valid

    Whether the ZIP Code is valid.

  • city

    The city name associated with the ZIP Code.

  • state

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

  • county

    The county name associated with the ZIP Code.

  • timezone

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

  • area_codes

    An array of area codes associated with the ZIP Code.

  • country

    The country code (e.g., US).

  • lat

    The latitude coordinate of the ZIP Code location.

  • lon

    The longitude coordinate of the ZIP Code location.

Sample Request Live Demo!

zip
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [ { "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.