ZIP Code API - Global ZIP & Postal Code Lookup and Validation
A single mistyped postal code can ship an order to the wrong state, bounce a delivery, or wave a fraudulent signup straight through - and your form can't tell a real code from a plausible one. The ZIP Code API resolves and validates any ZIP or postal code worldwide in one GET request, with bulk lookups of up to 100 codes in a single call. Every match returns the code's city, region, neighborhood-level locality, and map coordinates, in JSON or XML. It's built for developers shipping checkout and signup forms, logistics teams routing deliveries, and analytics engineers segmenting customers by geography. Start with 10,000 free credits - no credit card required.
What You Get in Every Response
Global coverage through one endpoint
Query any ZIP or postal code worldwide with a single code parameter - the same GET /v1.0/zipcode/lookup endpoint covers US ZIP codes, UK postcodes, and every other supported postal system. When a code exists in more than one country, the results array returns every match; add the optional country parameter (ISO 3166-1 alpha-2) to pin the lookup to one market.
For UK-facing products the same endpoint works as a postcode api; for everything else, use it as an international postal code API without maintaining per-country integrations.
City-level location data in every match
Each object in the results array carries the resolved location: city, region and region_code (the state or province and its abbreviation), a locality field with neighborhood-level detail such as Manhattan or Beverly Hills, and centroid latitude/longitude as floats. The country_code comes back in ISO 3166-1 alpha-2 format.
Use it to autofill city and state at checkout, or to plot customer postal codes on a map.
Validation by response, not regex
A code that exists returns 200 OK with at least one resultsobject; a code that doesn't returns 404 with the error type Postal/Zip Code Not Found, and an invalid country value fails fast with a 400. Existence checks become a one-call operation - no separate endpoint, and no pattern matching that accepts codes that were never issued.
Use it as a zip code validation API in signup and checkout flows.
Bulk lookups, up to 100 codes per request
Switch the same /v1.0/zipcode/lookup endpoint to POST and send a codes array of up to 100 ZIP or postal codes, with an optional shared country. Matched codes come back in one consolidated results array; a request where nothing matches returns a single 404 instead of a hundred individual failures.
Use it as a bulk zip code lookup for cleaning CRM exports and enriching subscriber lists without one call per row.
JSON and XML response formats
Responses default to JSON; append format=xml and the same lookup returns the identical field set as XML. Both formats carry the same structure, so consumers can migrate from XML to JSON without remapping fields.
Use it when the postal code api feeds an order-management or ERP pipeline that still parses XML.
Built for These Use Cases
Checkout and signup validation
Validate the postal code a customer types before the order is accepted: confirm the code exists, autofill the city and state, and reject codes that were never issued. One zip code lookup api call replaces a client-side pattern check that can't tell a real code from a plausible one.
Fraud and risk screening
Compare the postal code a customer enters at billing with the location of their connecting IP address from the IP Geolocation API. A billing code in one region and a connection on another continent is a signal worth flagging before fulfillment.
List cleaning and enrichment
Run exported CRM or subscriber postal codes through bulk lookups of up to 100 codes per request, attaching city, region, and coordinates to every record. Invalid entries surface immediately instead of silently corrupting territory reports downstream.
Geographic analytics
Resolve customer postal codes to regions and coordinates as a zip code to city api for territory dashboards, service-area planning, and market weighting. When a project moves from locating codes to finding every code around a point, pair it with the ZIP Codes Radius Search API.
Single ZIP Code Lookup
API Endpoint
$ pip install requestsimport requests
url = "https://api.apifreaks.com/v1.0/zipcode/lookup?code=35005"
payload = {}
headers = {
'X-apiKey': 'API-KEY'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Bulk ZIP Codes Lookup
API Endpoint
$ pip install requestsimport requests
import json
url = "https://api.apifreaks.com/v1.0/zipcode/lookup"
payload = json.dumps({
"codes": [
"60601",
"35005"
],
"country": "US"
})
headers = {
'Content-Type': 'application/json',
'X-apiKey': 'API-KEY'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
For bulk ZIP code requests, include a codesarray in JSON format (e.g., ‘10003‘, ‘12001‘, ‘35005‘) with up to 100 ZIP codes per request. Optionally, you can add a countryparameter with the ISO 3166-1 alpha-2 code (e.g., ‘US‘, ‘PK‘) to filter results by country.
How to Guides
Look up a single ZIP code
Before an order ships, confirm the destination code is real and see exactly where it points. One GET with the code parameter returns every matching location, so a postal code lookup api call doubles as the validation step:
# Response { "results": [ { "code": "10001", "country_code": "US", "region": "New York", "region_code": "NY", "city": "New York County", "locality": "Manhattan", "latitude": 40.748436, "longitude": -73.99402 } ] }curl --location 'https://api.apifreaks.com/v1.0/zipcode/lookup?code=10001' \ --header 'X-apiKey: API-KEY'
Pin a lookup to one country
Many codes exist in more than one postal system, so an unscoped lookup can return several matches. When your form already knows the customer's country, pass countryas an ISO 3166-1 alpha-2 code and the zipcode api returns only that market's result:
# Response { "results": [ { "code": "35005", "country_code": "US", "region": "Alabama", "region_code": "AL", "city": "Jefferson County", "locality": "Adamsville", "latitude": 33.59224, "longitude": -86.947845 } ] }curl --location 'https://api.apifreaks.com/v1.0/zipcode/lookup?code=35005&country=US' \ --header 'X-apiKey: API-KEY'
Validate codes in bulk
Cleaning a subscriber export means checking hundreds of codes, not one. POST a codes array - up to 100 per request - to the same endpoint and process one consolidated response; if nothing in the batch exists, the API returns a single 404 with the error type Postal/Zip Codes Not Found:
# Response { "results": [ { "code": "10001", "country_code": "US", "region": "New York", "region_code": "NY", "city": "New York County", "locality": "Manhattan", "latitude": 40.748436, "longitude": -73.99402 }, { "code": "90210", "country_code": "US", "region": "California", "region_code": "CA", "city": "Los Angeles", "locality": "Beverly Hills (Beverly Hills)", "latitude": 34.10313, "longitude": -118.41625 } ] }curl --location 'https://api.apifreaks.com/v1.0/zipcode/lookup' \ --header 'X-apiKey: API-KEY' \ --header 'Content-Type: application/json' \ --data '{ "codes": ["10001", "90210"], "country": "US" }'
Get the response as XML
Order-management and ERP systems that predate JSON still need validated destinations. Append format=xml and the same lookup returns the identical fields as XML - one integration serves both stacks:
# Response <CodeSearch> <results> <code_search> <code>73045</code> <country_code>US</country_code> <region>Oklahoma</region> <region_code>OK</region_code> <city>Harrah</city> <locality>Harrah</locality> <latitude>35.49345</latitude> <longitude>-97.14173</longitude> </code_search> </results> </CodeSearch>curl --location 'https://api.apifreaks.com/v1.0/zipcode/lookup?format=xml&code=73045&country=US' \ --header 'X-apiKey: API-KEY'
Frequently Asked Questions
results array in which each object represents a matched postal code location: code, country_code (ISO 3166-1 alpha-2), region and region_code, city, locality where available, and centroid latitude/longitude. A code that exists in several countries returns one object per match unless the request is scoped with country.200 OK with a populated results array means the code exists; 404 with Postal/Zip Code Not Foundmeans it doesn't; an unsupported country value returns 400. That makes it work as a postal code validation api for any supported country, and checkout and signup flows can treat the lookup and the validation as one call.code can exist in multiple countries - scope with country when you know the market./v1.0/zipcode/lookup endpoint with a codes array; exceeding the limit returns 400 with Maximum Postal/Zip Code Limit Exceeded, and a batch with no matches returns 404.Pricing
To use the ZIP Code APIs, API credits are required. Charges apply only for successful queries, defined by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits already charged will be refunded. If an error occurs while processing the postal/zip code, credits will be refunded for that postal/zip code, and you will only be charged for successful lookups of postal/zip codes.
- Single ZIP Code Lookup: For each successful lookup, 5 credit will be charged.
- Bulk ZIP Code Lookup: For each successful lookup, 5 credit will be charged.
Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.