Postal Code Finder
Developer Portal

Postal code API integration and JSON access for lookup workflows

Use PostalCodes.info for postal code API integration patterns: same-origin JSON search, token-protected country exports and canonical HTML lookup pages to validate postal codes, cities, regions and coordinates across 123 countries.

API examples you can test today

Use live search for autocomplete, country exports for batch validation and canonical HTML pages for human review. These examples use the same public data and URL model as the lookup pages.

Autocomplete postal code search
curl "https://postalcodes.info/search?q=4%20%C3%81guas&country=PT"
Country JSON export after same-origin token
curl "https://postalcodes.info/download.php?country=pt&format=json&t={download_token}"
Canonical page for manual QA
curl "https://postalcodes.info/postal-codes/portugal/code/1000001"
Example JSON record
{
  "postal_code": "1000-001",
  "place_name": "4 Águas",
  "country_code": "PT",
  "country": "Portugal",
  "admin_name1": "region",
  "latitude": null,
  "longitude": null
}
Read field documentation Open country downloads OpenAPI specification

API coverage and examples

This page is backed by structured postal records, canonical hierarchy links and representative examples from the current database. The canonical route for this record set is /api.

Country datasets
123
Canonical country roots with lookup, export and browsing pages.
Postal records
1,827,156
Rows available across the current published dataset.
Postal identifiers
1,080,895
Distinct postal code values tracked across all countries.
Mapped localities
888,760
Place names connected to country and administrative hierarchy.
Average geocoding
99.2%
Average coordinate coverage across country profiles.
Download postal data
CSV, JSON and XLSX exports for research, validation and data products.
Use the API
Query postal codes by country, place name, region or code prefix.
Implementation notes
Field definitions, canonical paths and practical lookup guidance.

Useful related pages

Portugal
Country · 206,942 records
United Arab Emirates
Country · 178,171 records
India
Country · 155,570 records
Japan
Country · 146,883 records
Mexico
Country · 144,655 records
Singapore
Country · 121,154 records
Peru
Country · 96,943 records
Indonesia
Country · 81,058 records

Data questions

What should developers use first?

Start with country exports and same-origin JSON patterns, then use the documented fields as stable import keys.

Which fields identify a lookup?

Use country_code with postal_code, place_name and administrative levels for validation and deduplication.

Current JSON access model

PostalCodes.info keeps lookup traffic on the canonical domain. The public site exposes crawlable HTML pages for Google and users, while JSON is available through the site search endpoint and through download buttons that mint a same-origin token before exporting CSV, XLSX or JSON.

This avoids a separate API host, keeps canonical signals consolidated on postalcodes.info, and lets developers inspect the same country, prefix and locality pages that power the exported data. A machine-readable OpenAPI document is available at /openapi.json for API directories and integration tooling.

// Search suggestions used by the public lookup UI
GET https://postalcodes.info/search?q=madrid&country=ES
// Token-protected JSON export from country pages
GET https://postalcodes.info/download.php?country=es&format=json&t={download_token}
// Canonical HTML lookup for one postal code
GET https://postalcodes.info/postal-codes/portugal/code/1000001

Best use cases

  • Address forms: suggest matching localities as a user types country, city or code.
  • Data enrichment: attach region and coordinate fields to stored addresses.
  • Bulk imports: export a country once, then validate locally in your own system.
  • SEO and QA: open the canonical HTML page for any suspicious imported row.

Response fields

Exported JSON records use stable field names for postal code, place name, country code, administrative levels and WGS84 coordinates. Postal codes must be treated as strings because leading zeroes and spaces are valid in many countries.

{ "postal_code": "28001", "place_name": "Madrid", "country_code": "ES", "admin_name1": "Madrid", "latitude": 40.4167, "longitude": -3.7033 }

API-ready country examples

Start with high-coverage countries to test search, export and local validation logic before integrating smaller territories.

Portugal
206,942 records, sample code 1000-001.
United Arab Emirates
178,171 records, sample code 00004 62392.
India
155,570 records, sample code 110001.
Japan
146,883 records, sample code 001-0000.
Mexico
144,655 records, sample code 01000.
Singapore
121,154 records, sample code 018906.
Peru
96,943 records, sample code 01000.
Indonesia
81,058 records, sample code 10110.

Integration rules

Cache country exports in your own infrastructure, keep the original postal code string, and use the canonical HTML URL as a human-readable audit trail. If your application only needs interactive lookup, call the search endpoint with a country filter and send users to the canonical result page.

Read schema documentation Download datasets

Choose the right access path

Postal lookup usually has three different jobs: finding a candidate while a user types, validating a stored address, and explaining a result to a human operator. Use the search endpoint for the first job, country exports for the second, and canonical HTML pages for the third. Keeping those jobs separate avoids excessive live requests and gives search engines crawlable pages for the same data.

Need Recommended path Reason
Autocomplete/search with country filterSmall responses and direct links to canonical pages.
Batch validationCountry JSON or CSV exportOne cached download supports many local checks.
Manual QACountry, prefix or code HTML pageShows hierarchy, related areas and examples.
Search discoveryCanonical HTML URLsGoogle can crawl the same records users inspect.

Operational guidance

Do not call a live endpoint for every address in a large import. Download the country file, normalize your input strings, and compare country code plus postal code plus locality. When a match is ambiguous, show the operator the canonical page so they can compare administrative levels and coordinates.

For front-end forms, keep validation permissive until the country is known. Many formats are country specific: some are fixed numeric strings, some contain spaces, and some mix letters with digits. The country pages expose the detected format and an example code, so strict rules should be loaded after country selection rather than applied globally.

For analytics and logistics, store coordinates as approximate centroids. They are useful for grouping, routing zones and map previews, but they should not be treated as exact delivery-point coordinates.

Developer questions

Is there a separate API subdomain?

No. Current public access is served from postalcodes.info so canonical pages, exports and search results stay on the same host.

Should I validate live or locally?

Validate locally for batches. Use live search for interactive lookup and canonical pages for human review when a record looks ambiguous.

What should be cached?

Cache country exports, prefix pages and code pages. They are public reference data and change much less often than user address input.

How do I debug a failed match?

Compare the original country, postal code string and locality against the country page, then follow the nearest prefix or code URL for examples.