Skip to endpoints

05/2 endpoints

Localities API

Search Mexican localities by name and fetch a single locality with the municipio and state it belongs to. These endpoints are live, but the locality catalog behind them is not loaded yet.

No data behind this endpoint yet

Every endpoint on this page is deployed and answers requests, but the catalog behind it is not loaded, so results come back empty. The request and response shapes below are the contract and will not change when the data lands. Nothing else in the API is affected.

Base URL https://api.postalkit.mx
Authentication
GET /v1/localities

Search Localities

Search for localities within a state and municipality. Supports two filter modes: by name (state + municipality) with fuzzy matching, or by INEGI code (state_code + municipality_code) with exact matching. Returns paginated results ordered by name.

Query Parameters

Param Type Description
state string State name (fuzzy match). Required if not using codes.
municipality string Municipality name (fuzzy match). Required if not using codes.
state_code string INEGI state code. Required if not using names.
municipality_code string INEGI municipality code. Required if not using names.
page integer Page number (20 results per page, default 1)

Request

curl
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.postalkit.mx/v1/localities?state=Jalisco&municipality=Guadalajara"

Response

200 Success (paginated)
{
  "data": [
    {
      "id": 1,
      "locality_code": "0001",
      "name": "Guadalajara",
      "ambito": "Urbano",
      "latitude": "20.6737800",
      "longitude": "-103.3442300",
      "altitude": "1566",
      "state": { "id": 14, "name": "Jalisco", "code": "14" },
      "municipality": { "id": 39, "name": "Guadalajara", "code": "039" }
    }
  ],
  "links": { "first": "...", "last": "...", "prev": null, "next": null },
  "meta": { "current_page": 1, "total": 1, "per_page": 20 }
}
422 Validation Error
{ "message": "The given data was invalid.", "errors": { "filter": ["You must provide either (state and municipality) or (state_code and municipality_code)."] } }
GET /v1/localities/{id}

Get Locality

Retrieve a single locality by its ID, including state and municipality details.

URL Parameters

Param Type Description
id integer The locality ID

Request

curl
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.postalkit.mx/v1/localities/1

Response

200 Success
{
  "data": {
    "id": 1,
    "locality_code": "0001",
    "name": "Guadalajara",
    "ambito": "Urbano",
    "latitude": "20.6737800",
    "longitude": "-103.3442300",
    "altitude": "1566",
    "state": { "id": 14, "name": "Jalisco", "code": "14" },
    "municipality": { "id": 39, "name": "Guadalajara", "code": "039" }
  }
}
404 Not Found
{ "message": "Locality with id 99999 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"