Costa Rica postal code data and sources

Official Costa Rica sources only. Every API version is logged; the current one is 2.0.0.

See the sourcesView on GitHub

5
official sources
2026
DTA edition
494
districts

How the postal code is built

Five digits, equal to the district’s official code in the Territorial Administrative Division: province (1), canton (2) and district (2).

1
The province, from 1 (San José) to 7 (Limón).
03
The canton within the province: 103 is Desamparados.
05
The district within the canton: 10305 is San Antonio.
10305
All five together: the district’s postal code.

Treat codes as text: no lost zeros, no accidental arithmetic.

1 03 05  →  San José · Desamparados · San Antonio  →  10305
│ │  └─ distrito 05
│ └──── cantón 03 (Desamparados = 103)
└────── provincia 1 (San José)

The 5 official sources

Each town and beach was placed in its district by crossing its point with the official IGN boundaries: the code is not copied from the source.

División Territorial Administrativa 2026
Instituto Geográfico Nacional (IGN), Registro Nacional de Costa Rica · 2026
Plan GAM 2013-2030
Ministry of Housing and Human Settlements (MIVAH)
Límite distrital 1:5 000 (DTA 2026)
Instituto Geográfico Nacional (IGN), Registro Nacional
Accidentes Costeros 1:25 000 (nombres geográficos)
Instituto Geográfico Nacional (IGN), Registro Nacional
Localidades de referencia (Marco Geoestadístico Nacional)
Instituto Nacional de Estadística y Censos (INEC), nodo SNIT
División Territorial Administrativa 2026
  https://www.snitcr.go.cr/pdfs/ign_repositorio/DTA-TABLA%20POR%20PROVINCIA-CANT%C3%93N-DISTRITO%202026.pdf

Plan GAM 2013-2030
  https://www.mivah.go.cr/Documentos/PlanGAM2013/03-CARTOGRAFIA/1_Dimension_Urbano_Regional/Division_Politico_administrativa_Limites_GAM.pdf

Límite distrital 1:5 000 (DTA 2026)
  https://geos.snitcr.go.cr/be/IGN_5_CO/wfs

Accidentes Costeros 1:25 000 (nombres geográficos)
  https://geos.snitcr.go.cr/be/IGN_NG/wfs

Localidades de referencia (Marco Geoestadístico Nacional)
  https://gestorgeo.inec.go.cr/geoserver/SNIT_INEC_MGN/wfs

2 corrections to the IGN table

Where the official table contradicts itself, the API corrects it and records it in data/correcciones.json.

70605 Duacarí
The IGN counts it in the total but omits it from the detail table (2024, 2025 and 2026). Created by Decree 12091-G (1980).
613 Puerto Jiménez
The canton table spells it without the accent; the same table spells district 61301 with it.
{
  "agregar_distritos": [
    { "codigo": "70605", "nombre": "Duacarí", "motivo": "…" }
  ],
  "renombrar": [
    { "tipo": "canton", "codigo": "613",
      "de": "Puerto Jimenez", "a": "Puerto Jiménez", "motivo": "…" }
  ]
}

Versions: 2.0.0

The API follows semver. v1 routes still answer with a redirect (301) to their v2 equivalent.

/provincia/{p}/cantones.json
/provincias/{p}.json
/provincia/{p}/canton/{c}/distritos.json
/cantones/{PCC}.json
/codigo-postal/{PCCDD}.json
/distritos/{PCCDD}.json

CHANGELOG.md

// 2.0.0: los códigos son siempre texto con todos sus dígitos
"1"      // provincia
"103"    // cantón
"10305"  // distrito

// canton y provincia son objetos
{ "codigo": "103", "nombre": "Desamparados" }

MIT license and open code

The API code is MIT. The data comes from Costa Rican public institutions. Found an error? Open an issue with the official source.

# La API completa, con sus datos y su validación
git clone https://github.com/ryze-cr/postalcr-api
cd postalcr-api
pip install -r scripts/requirements.txt
python3 scripts/validar.py