# `invalid_postal_code`: the postcode is not the shape that country uses

A postcode was given and checked against the country's published pattern, and it does not match: the wrong length, the wrong mix of letters and digits, or a code from another country.

- Appears in: `reason`
- Billing: Free. An address that cannot stand as written never costs a credit.

Every country with postcodes publishes the shape they take, and Spaw checks the value against that pattern (`postal_code_valid` reports the same fact on answers that are otherwise valid). A five-digit value in the United Kingdom, a four-digit ZIP, or a Dutch code without its letters all fail here.

This is a check of shape, not of existence: a postcode of the right shape that no directory knows answers `postcode_not_found` instead. Country prefixes some operators print ("NL-1012 JS") are stripped before the check.

**What to do.** Show the user the postcode that was checked — it is echoed in `postal_code` — and the country it was checked against; the two disagreeing is the usual cause. `postal_code_type` names what that country calls it.

```json
{
    "valid": false,
    "reason": "invalid_postal_code",
    "country": "US",
    "postal_code": "9404",
    "postal_code_valid": false,
    "postal_code_type": "zip",
    "risk_score": null
}
```

Reference: https://spaw.co/docs/reasons/invalid_postal_code
