Validate a Nigerian postcode
validate_postcodeChecks a postcode's structure offline and returns its canonical forms and segments, without confirming it is assigned to a building.
Instructions
Check a postcode's structure offline and return its canonical forms and segments.
Free and instant. Does not confirm the code is assigned to a building; use lookup_postcode for that.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| postcode | Yes | Code in any style, e.g. 'ek 01 a03 fk 01'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | Yes | Why the code is malformed. | |
| valid | Yes | Whether the code is well formed. It may still be unassigned. | |
| spaced | Yes | Form shown to people, e.g. EK 01 A03 FK 01. | |
| compact | Yes | Compact form for storage, e.g. EK01A03FK01. | |
| postcode | Yes | Canonical form, e.g. EK-01-A03-FK-01. | |
| segments | Yes | ||
| suggestion | Yes | A well-formed code if look-alike characters (O/0, I/1, S/5, B/8) were the only problem. Confirm it with the user before using it. |