Skip to content

Wiring Mexican postal codes into your stack

Four pages, one per stack, each one a whole working integration rather than a snippet: the client, where the key lives, what to cache, and which of the failures are yours to handle.

The part that is the same everywhere

There is no SDK to install and nothing to configure. It is HTTPS, a Bearer token in a header, and JSON coming back. If you can read this call you can already read all four pages below.

curl
curl -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Accept: application/json" \
     https://api.postalkit.mx/v1/postal-codes/06600

The Accept header is not decoration. Ask for a route that does not exist without it and you get an HTML error page rather than JSON, and the first thing that breaks is your parser rather than your error handling.

Pick the one you are working in

Read the one for the layer you are writing. The React page is the exception: it assumes you have a backend and tells you to put one request behind it, so it reads better after whichever server-side page is yours.

Why the version numbers are there

Every snippet on these pages was run before it was published

Each sample was executed against this API, with the authenticated path swapped for the keyless demo lookup on the same host, so the client, the error branches and the parsing are code that ran rather than code that looks like it would. The versions beside each tutorial are what it ran on — not a compatibility claim, which is something nobody here has tested.

Last run: 2026-08-17.

You need a key before any of this runs.

100 requests a month, free, no card. Enough to work through a tutorial and still have most of the month left.

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