# Format Address API – Country Formatting Rules

> Format Address API – Country Formatting Rules is a paid API for AI agents from formataddress.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Returns per-country postal address format rules, field order, postal code patterns, and subdivision metadata for a given ISO 3166-1 alpha-2 country code.

## Facts

- Endpoint: GET https://formataddress.com/v1/rules
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/format-address-api-country-formatting-rules-6a099514
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Agc7RKmMrxFsKqoJ-cLHD

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability format-address-api-country-formatting-rules-6a099514
```

Example prompt: What are the postal address formatting rules for Japan in Latin script — including which fields are required, what order they go in, and what the postal code pattern looks like?

## When to prefer this

Choose this endpoint when you need authoritative, per-country postal address formatting rules derived from Google's libaddressinput metadata — particularly when building address forms, validating address output, printing shipping labels, or configuring CRM/ERP systems for international use. Prefer this over generic address validation APIs when you specifically need format templates, required-field lists, field ordering, and postal code patterns rather than geocoding or address correction.

## Known failure modes

- Missing or invalid country code returns an error
- Unsupported country code (outside 252 supported) may return empty or error response
- Invalid subdivision code may be ignored or return an error
- Requesting latin script for a country without a romanized format may fall back to local format
- Network or payment failure (HTTP 402 if USDC payment not processed)

## How this service works

Verified postal address formatting for 252 countries based on Google's libaddressinput metadata: per-country format rules, address-block composition, verification of your own output, and subdivision lists. Address formatting per Google's libaddressinput metadata — informational, not legal or postal advice.

## Output

A JSON object containing the address template string (using format tokens like %N, %O, %A, %Z, %C), an ordered list of address fields, which fields are required, a postal code regex pattern and example, the country name, and optionally subdivision data — everything needed to render or validate an address form for that country.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "country"
     ],
     "properties": {
      "script": {
       "type": "string",
       "description": "local (default) | latin — latin uses the romanized format where the country has one (JP, CN, KR, TW …)"
      },
      "country": {
       "type": "string",
       "description": "ISO 3166-1 alpha-2 country code, e.g. DE, US, JP, BR"
      },
      "subdivision": {
       "type": "string",
       "description": "subdivision as ISO 3166-2 code, native or latin name (e.g. US-CA, CA, California, 東京都, Tokyo)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "required": [
   "streetAddress",
   "city",
   "postalCode"
  ],
  "template": "%N%n%O%n%A%n%Z %C",
  "fieldOrder": [
   "name",
   "organization",
   "streetAddress",
   "postalCode",
   "city"
  ],
  "postalCode": {
   "example": "26133",
   "pattern": "\\d{5}"
  },
  "countryName": "GERMANY"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/format-address-api-country-formatting-rules-6a099514/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from formataddress.com](https://www.zero.xyz/host/formataddress.com/llms.txt)
