Skip to endpoints

04/2 endpoints

Municipio API

Get every postal code and every colonia inside a Mexican municipio, addressed by its identifier.

Base URL https://api.postalkit.mx
Authentication
GET /v1/municipalities/{id}/postal-codes

List Postal Codes by Municipality

Returns all postal codes that belong to the given municipality, ordered by code and paginated with 20 results per page.

URL Parameters

Param Type Description
id integer Numeric municipality ID

Request

curl
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.postalkit.mx/v1/municipalities/6/postal-codes

Response

200 Success (paginated)
{
  "data": [
    {
      "id": 384,
      "code": "06600",
      "state": { "id": 1, "name": "Ciudad de México", "code": "09" },
      "municipality": { "id": 6, "name": "Cuauhtémoc", "code": "015" },
      "city": { "id": 1, "name": "Ciudad de México" }
    }
  ],
  "links": { "first": "...", "last": "...", "prev": null, "next": "..." },
  "meta": { "current_page": 1, "total": 71, "per_page": 20 }
}
404 Not Found
{ "message": "Municipality with id 999 not found." }
GET /v1/municipalities/{id}/settlements

List Settlements by Municipality

Returns all settlements that belong to the given municipality, ordered alphabetically and paginated with 20 results per page.

URL Parameters

Param Type Description
id integer Numeric municipality ID

Request

curl
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.postalkit.mx/v1/municipalities/6/settlements

Response

200 Success (paginated)
{
  "data": [
    {
      "id": 532,
      "name": "Juárez",
      "zone": "Urbano",
      "settlement_type": { "id": 1, "name": "Colonia" },
      "postal_code": { "id": 384, "code": "06600" }
    }
  ],
  "links": { "first": "...", "last": "...", "prev": null, "next": "..." },
  "meta": { "current_page": 1, "total": 230, "per_page": 20 }
}
404 Not Found
{ "message": "Municipality with id 999 not found." }

Ready to build?

Start querying the full postal catalog in minutes.

curl -s https://api.postalkit.mx/v1/postal-codes/06600 -H "Authorization: Bearer YOUR_API_KEY"