Catalog/ref-postal-format

Reference

Postal-code format + validate API

Return a country's postal-code regex, human-readable format, and example for ~45 countries, and optionally validate a supplied code against the pattern (case/space-normalized). The MORE: most agents only know the US 5-digit zip; this is a curated multi-country format table plus real regex validation. Answers 'what is the postal code format for the UK', 'validate this Canadian postcode', 'postal regex for Germany', 'is this a valid zip code'.

Price$0.01per request
MethodPOST
Route/v1/ref/postal-format
StatusLive
MIME typeapplication/json
Rate limit60/minute
CacheNo cache
refpostal-codezippostcodevalidationregexaddresscountry
API URLhttps://x402.hexl.dev/v1/ref/postal-format
Integration docs
Example request
{
  "country": "GB",
  "code": "SW1A 1AA"
}
Example response
{
  "country": "GB",
  "regex": "^[A-Z]{1,2}\\d[A-Z\\d]? ?\\d[A-Z]{2}$",
  "format": "AA9A 9AA",
  "example": "SW1A 1AA",
  "code": "SW1A 1AA",
  "valid": true
}
Input schema
{
  "type": "object",
  "required": [
    "country"
  ],
  "properties": {
    "country": {
      "type": "string",
      "examples": [
        "GB"
      ]
    },
    "code": {
      "type": "string",
      "examples": [
        "SW1A 1AA"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}