How a Mexican address is structured
Six fields, narrowest first, and one of them has no equivalent in a US or European address form. If you are adding Mexico to a checkout, a shipping label or a KYC flow, the fields below are the whole job — and the figures on this page are counted from the national postal catalog rather than described from a specification.
The lines of an address, in order
The postal code leads the final line, before the municipio and the estado, never after them. 06600 below is a real code in the middle of Mexico City, and Juárez is a colonia inside it.
Street and number, interior if there is one Col. Juárez 06600 Cuauhtémoc, Ciudad de México México
| Field | What it holds | Required | Filled by |
|---|---|---|---|
| Calle and número | Street name, exterior number, and the interior number if there is one. | Yes | Typed |
| Colonia | The named asentamiento inside the postal code. Usually written with the prefix “Col.”. | Yes | Chosen from the code’s list |
| Código postal | Five digits, leading the final line rather than trailing it. | Yes | Typed, then verified |
| Municipio or alcaldía | The unit of local government the code sits in. | Yes | Derived from the code |
| Estado | One of the 32, on the same line as the municipio. | Yes | Derived from the code |
| Ciudad | An optional urban-area label. Not a level of government, and frequently absent. | Optional | Derived, when the catalog has one |
Four of the six are answers rather than questions. Once the código postal is known, the municipio, the estado, the ciudad and the list of valid colonias are all lookups — which means the form should be asking for two things and confirming the rest.
The postal code does not identify the neighbourhood
This is the assumption that costs the most, because it is the one a ZIP-shaped form arrives with. In Mexico a código postal is a delivery area, and the colonia is a separate answer inside it.
21,318 postal codes — 67% of the catalog — cover more than one colonia. For those, the code narrows the address down to a list and no further; somebody still has to choose from it.
The extreme case is 85203, in Cajeme, Sonora: one postal code, 290 colonias.
Ask the catalog
curl -s https://api.postalkit.mx/v1/postal-codes/85203 -H "Authorization: Bearer YOUR_API_KEY"
The response carries every one of them, under settlements, with the tipo de asentamiento beside each name.
The practical consequence for a form: ask for the código postal first, fetch the colonias behind it, and present them as a select. A free-text neighbourhood field produces values the courier cannot match, and asking for the colonia before the code gives you nothing to validate it against.
Store the código postal as a string
Five characters, not a number. The failure is silent and it lands on the capital, which is rarely where the test data is.
685 postal codes begin with a zero. An integer column turns every one of them into a four-digit value that matches nothing — 06600 becomes 6600, and the lookup fails for an address that was written correctly.
The same applies to the municipio code, which is three characters and unique only inside its estado, and to the estado code, which is two. All three are identifiers that happen to look like numbers.
Match estados on the code, not the name
Some estados have an official name that nobody uses in conversation, and the postal catalog uses the official one. A dropdown built from the common names will not match what the API returns.
| What people call it | What the catalog returns |
|---|---|
| Coahuila | Coahuila de Zaragoza |
| Estado de México | México |
| Michoacán | Michoacán de Ocampo |
| Veracruz | Veracruz de Ignacio de la Llave |
Every estado also comes back with its two-digit INEGI code, and every municipio with a three-digit one. Match on those and the naming question stops mattering.
Two more things the form has to survive
-
Mexico City does not have municipios.
It has 16 alcaldías, which replaced the older delegaciones in 2016. The postal catalog files them in the same municipios table as everywhere else, so nothing about the request changes — but the label on the form is wrong for the country’s largest city if it says “municipio” and nothing else.
-
A colonia is not always a colonia.
The catalog sorts its asentamientos into 24 kinds — colonias, fraccionamientos, barrios, pueblos, rancherías and the rest — and any of them can be the value on that line. Label the field “colonia”, because that is the word everyone uses, and expect the value to be something else.
Validating an address against the catalog
There is no single “validate this address” call, and any API offering one for Mexico is inferring more than the catalog knows. What the catalog can tell you is whether the pieces are consistent, which is the useful half:
- The código postal exists. A lookup that 404s is a typo, not an edge case.
- The colonia is one the code actually holds — compare against the settlements the lookup returned rather than against free text.
- The municipio and estado are the ones the code implies. If the customer typed different ones, the code is the piece to trust.
The street and the number cannot be checked — no Mexican postal catalog carries them, and this one says so rather than guessing.
Reading on
- Mexico ZIP code API — the request that turns a código postal into everything below it, with the response in full.
- Glossary of Mexican address terms — asentamiento, alcaldía, localidad and the rest, defined against the same catalog.
- A postal code autocomplete in React — the code-first, colonia-select pattern this page argues for, built and running.
- Postal code endpoint reference — parameters, fields and errors for every call named here.