Find the postal code of any district by name or number. Official IGN data for all 7 provinces, 84 cantons and 494 districts.
Type a district or canton name, or a 5-digit postal code.
Choose a province or canton to see the postal codes of all its districts.
1San JoséEscazúDesamparadosPuriscalTarrazúAserríMoraGoicoecheaSanta AnaAlajuelitaVázquez de CoronadoAcostaTibásMoraviaMontes de OcaTurrubaresDotaCurridabatPérez ZeledónLeón Cortés Castro
2AlajuelaSan RamónGreciaSan MateoAtenasNaranjoPalmaresPoásOrotinaSan CarlosZarceroSarchíUpalaLos ChilesGuatusoRío Cuarto
All 494 districts with their postal code and zone, based on the Greater Metropolitan Area defined by the 2013-2030 GAM Plan. Filter by zone or search by name or code.
| Postal code | District | Canton | Province | Zone |
|---|
Costa Rica does not have a single ZIP code: every district has its own 5-digit postal code. It is the district's official code: P (province, 1 digit) + CC (canton, 2 digits) + DD (district, 2 digits). For example, San Antonio in Desamparados is 1 03 05 = 10305.
Each province's codes start with its number: 1 San José, 2 Alajuela, 3 Cartago, 4 Heredia, 5 Guanacaste, 6 Puntarenas and 7 Limón. When a district moves to another canton, its old code is retired and never reused, so numbering can have gaps (for example, Grecia has no district 6).
There isn't just one: each of the 494 districts has its own 5-digit postal code. For example, downtown San José (Carmen district) is 10101, downtown Alajuela is 20101, Cartago (Oriental) is 30101 and downtown Heredia is 40101. Use the search box above to find yours.
Your district's 5-digit postal code. International forms call it "ZIP code" or "postal code"; in Costa Rica it is the same number.
According to the IGN's 2026 Administrative Territorial Division, Costa Rica has 7 provinces, 84 cantons and 494 districts. The newest cantons are Monteverde and Puerto Jiménez, in Puntarenas. The newest districts are Pijije (Bagaces) and Cabagra (Buenos Aires), created by law in May 2025.
Currently 167 districts are inside the Greater Metropolitan Area (GAM) and 327 are outside; see the district list. It follows the official 2013-2030 GAM Plan by MIVAH. When the official boundary splits a district, it counts as GAM if at least half of its buildings are inside. Some shipping companies use their own list; for example, Grecia is not GAM under the official definition.
From the 2026 Administrative Territorial Division (DTA 2026) published by the National Geographic Institute (IGN), the official division into provinces, cantons and districts. The postal code is each district's official code.
All of this data is available as a free JSON API: static files, open CORS and no API key. Names and field names are in Spanish, as published by the IGN.
Source: Administrative Territorial Division (DTA 2026), National Geographic Institute of Costa Rica (IGN).
All endpoints answer GET with JSON. Canton and district numbers have no leading zeros.
| Path | Returns |
|---|---|
/provincias.json | The 7 provinces |
/provincia/{p}/cantones.json | Cantons of a province |
/provincia/{p}/canton/{c}/distritos.json | Districts of a canton |
/codigo-postal/{PCCDD}.json | A district by postal code, with its canton and province |
/distritos.json | Flat list of every district with its postal code |
/gam.json | Postal codes inside and outside the Greater Metropolitan Area (GAM), for shipping rates |
/todo.json | Full tree with official codes and areas in km² |
/meta.json | API version, source, edition and totals |
/openapi.json | OpenAPI 3.1 specification |
/llms.txt | Usage guide for AI agents (in Spanish) |
// Cantons of San José
const cantons = await fetch('/provincia/1/cantones.json').then(r => r.json());
// { "1": "San José", "2": "Escazú", "3": "Desamparados", ... }
// District from a postal code
const d = await fetch('/codigo-postal/10305.json').then(r => r.json());
// { "codigo_postal": "10305", "distrito": "San Antonio", "canton": "Desamparados",
// "provincia": "San José", "codigos": { "provincia": 1, "canton": 3, "distrito": 5 },
// "gam": true, ... }
It is free and needs no API key or sign-up. CORS is open, so you can call it directly from a browser, a mobile app or a server.
Whenever the National Geographic Institute publishes a new edition of the Administrative Territorial Division, every two years, or when a law creates a new canton or district. /meta.json shows the current edition.
Province, canton and district names are proper nouns and are kept exactly as the IGN publishes them. JSON field names are also in Spanish (provincia, canton, distrito, codigo_postal) so the API stays compatible with existing integrations.