ZIP Code Radius Search API — All Postal Codes within a Radius as Paginated JSON
Store locators, delivery zones, and territory maps all hit the same wall: answering "which ZIP codes are near this point" means maintaining a postal code database and writing distance math that has nothing to do with your product. The ZIP Code Radius Search API answers it in one GET request, pass a ZIP code or lat/long as the center, set a radius in any of six distance units, and receive every matching postal code with its exact straight-line distance, sorted nearest-first and paginated.
Coverage spans major global postal systems, USPS ZIP codes, Royal Mail postcodes, Canada Post, Australia Post, India Post PIN codes, and more, so one integration works in every market your application serves. It's built for developers who need a ZIP code radius API behind store locators, delivery-zone validation, and service-area checks. Start with 10,000 free credits, no credit card required. To look up details for a single ZIP code instead, see the ZIP Code Lookup API.
Features
Single endpoint, complete results
One GET request to /v1.0/zipcode/search/radius returns every ZIP code within your radius, sorted by distance, with exact distances included. No chaining multiple endpoints, no post-processing geometry, no assembling results from multiple calls.
ZIP code or coordinates as center
Use a ZIP code + ISO 3166-1 alpha-2 country code, or a raw lat / long pair, as your center point. Coordinate input removes the need for a separate geocoding call when your application already has a lat/long from an address lookup or GPS signal.
Six distance units
km, mi, yd, m, ft, in - default is km. Set the unit your application logic already works in, so no unit conversion is needed on your end. Maximum radius: 100 km or 100 miles.
Global postal coverage, one integration
Covers all major postal systems: USPS (US), Royal Mail PAF (UK), Australia Post, India Post, Canada Post, and more. Build once, deploy globally - no swapping APIs when your application expands to a new market.
Paginated results up to 500 per page
Dense urban areas return thousands of ZIP codes. Each response includes total_results and total_pages. Iterate with the page parameter. No silent result truncation - you always know exactly how many codes exist within the radius.
JSON and XML
JSON by default. Pass format=xml for XML. Both formats include the same response fields: code, city, region, region_code, district, and distance from center.
What developers build with this API
Store locator backend
When a user submits their ZIP code, call this API to retrieve all ZIP codes within your service radius. Filter your locations database against the returned list to show the nearest results - no spatial queries against your own database required.
Delivery zone validation
Before confirming an order, check whether a customer's ZIP code falls within your delivery radius. Make one API call per fulfilment centre, cache the result, and run all order validation against the cached list. To calculate the exact distance between two specific ZIP codes, use the ZIP Code Distance API.Multi-location coverage mapping
For platforms with multiple depots, stores, or service agents, call the API once per location and union the results to build a complete coverage map. Deduplicate ZIP codes that fall within range of more than one location.
Service area eligibility check
For subscription services, field service scheduling, or any feature that requires confirming a user is within a service area - use the API to generate the allowed ZIP code set once per service location, then check eligibility on each user request. To retrieve all ZIP codes for a specific city instead, use ZIP Codes by City API.Address form enrichment
When a user enters a ZIP code during registration or checkout, call the API to return the code's city, region, and country. You can also check neighbouring codes to pre-validate shipping availability before the order is placed.
API Endpoint
$ pip install requestsimport requests
url = "https://api.apifreaks.com/v1.0/zipcode/search/radius?code=H2V%201Z7&country=CA&radius=5&unit=km"
payload = {}
headers = {
'X-apiKey': 'API-KEY'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Radius Limits per Measurement Unit
| Distance Measuring Unit | Maximum Radius Size |
|---|---|
| km | 100 |
| mi | 100 |
| yd | 109361 |
| m | 100000 |
| ft | 328084 |
| in | 3937007.75 |
How-To-Guides
Run a radius search from a center ZIP code
To retrieve all ZIP codes within a radius, pass code (the center ZIP), country (ISO 3166-1 alpha-2 format), radius, and unit. The response is sorted by distance ascending - the nearest ZIP code is always first in the results array.
# Response { "total_results": 13655, "total_pages": 28, "current_page": 1, "current_page_size": 500, "results": [ { "code": "H1X 2E9", "region": "Quebec", "region_code": "QC", "city": "Urban agglomeration of Montreal", "district": "Mile-End", "distance": 1.002 }, { "code": "H1X 2G2", "region": "Quebec", "region_code": "QC", "city": "Urban agglomeration of Montreal", "district": "Mile-End", "distance": 1.171 }, ... 497 more results ... { "code": "H1X 1E6", "region": "Quebec", "region_code": "QC", "city": "Urban agglomeration of Montreal", "district": "Rosemont", "distance": 5.0 } ] }curl --location 'https://api.apifreaks.com/v1.0/zipcode/search/radius?code=H2V%201Z7&country=CA&radius=5&unit=km' --header 'X-apiKey: API-KEY'
If total_pages >1, iterate using the page parameter:
curl --location 'https://api.apifreaks.com/v1.0/zipcode/search/radius?code=H2V%201Z7&country=CA&radius=5&unit=km&page=2' --header 'X-apiKey: API-KEY'
Run a radius search from GPS coordinates
Use lat and long instead of code and country when your application has a coordinate rather than a postal code - for example, after a geocoding call, a map click, or a GPS reading.
# Response { "total_results": 308, "total_pages": 1, "current_page": 1, "current_page_size": 500, "results": [ { "code": "10036", "region": "New York", "region_code": "NY", "city": "New York County", "district": "Manhattan", "distance": 0.219 }, { "code": "10112", "region": "New York", "region_code": "NY", "city": "New York County", "district": "Manhattan", "distance": 0.292 }, ... 304 more results ... { "code": "07175", "region": "New Jersey", "region_code": "NJ", "city": "Essex", "district": "Newark", "distance": 9.982 } ] }curl --location 'https://api.apifreaks.com/v1.0/zipcode/search/radius?lat=40.7580&long=-73.9855&radius=10&unit=mi' --header 'X-apiKey: API-KEY'
Build a delivery zone for multiple locations
Loop over your depot or store ZIP codes, union the results, and deduplicate. ZIP codes within range of multiple locations appear in multiple API responses - deduplicate before caching.
import requests API_KEY = "YOUR_API_KEY" BASE_URL = "https://api.apifreaks.com/v1.0/zipcode/search/radius" def get_zone(zip_code, country, radius, unit="mi"): all_zips = set() page = 1 while True: r = requests.get(BASE_URL, headers={"X-apiKey": API_KEY}, params={ "code": zip_code, "country": country, "radius": radius, "unit": unit, "page": page }) data = r.json() all_zips.update(result["code"] for result in data["results"]) if page >= data["total_pages"]: break page += 1 return all_zips depots = [("10001", "US"), ("60601", "US"), ("90210", "US")] coverage = set() for zip_code, country in depots: coverage |= get_zone(zip_code, country, radius=25)
Using this API instead of Google Maps for ZIP radius search
The Google Maps API has no endpoint that returns a list of ZIP codes within a radius. The standard Google Maps approach requires:
- Call the Geocoding API to get coordinates for the center address.
- Write a custom Haversine formula or use a geometry library to calculate distances.
- Maintain or query your own ZIP code database to match results
- Handle pagination yourself
With the APIFreaks ZIP Code Radius Search API, the same result is a single authenticated GET request:
# Response { "total_results": 305, "total_pages": 1, "current_page": 1, "current_page_size": 500, "results": [ { "code": "10121", "region": "New York", "region_code": "NY", "city": "New York County", "district": "Manhattan", "distance": 0.167 }, { "code": "10119", "region": "New York", "region_code": "NY", "city": "New York County", "district": "Manhattan", "distance": 0.21 }, ... 301 more results ... { "code": "11357", "region": "New York", "region_code": "NY", "city": "Queens County", "district": "Queens", "distance": 9.932 } ] }curl --location 'https://api.apifreaks.com/v1.0/zipcode/search/radius?code=10001&country=US&radius=10&unit=mi' --header 'X-apiKey: API-KEY'
The response includes the full sorted ZIP code list, distances, city and region data, and pagination metadata - with no additional code required.
FAQs
Make a GET request to https://api.apifreaks.com/v1.0/zipcode/search/radius with a center ZIP code (or lat/long), a radius value, and a unit. The response returns every matching ZIP code sorted by distance, with exact distances included. If total_pages is greater than 1, paginate using the page parameter.
Each response returns up to 500 ZIP codes. The response body includes total_results and total_pages. Request additional pages by passing the page parameter. There is no silent truncation - total_results always reflects the full count of ZIP codes within the radius.
Yes. Use lat and long parameters instead of code and country. This is useful when your application already has a coordinate from a geocoder, a map interaction, or a device GPS - it removes the need for a separate reverse-geocoding step.
Pricing
To use the ZIP Code Radius Search API, 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.
For each successful request, 5 credits 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.