Overview
Different countries have different address formats and requirements. The address requirements endpoint lets you look up the minimum address fields needed for a given country before submitting addresses for tax calculations or transactions. Use this endpoint to:- Validate addresses client-side before calling
/calculateor/transactions, reducing failed requests. - Build dynamic address forms that adapt to each country’s requirements.
- Check postal code formats using the provided regex pattern.
- Restrict state/province inputs to valid codes for the country.
Field requirement levels
Each address field returns one of three requirement levels:| Level | Meaning |
|---|---|
REQUIRED | The field must be provided. Omitting it may cause tax calculation errors. |
OPTIONAL | The field is accepted but not mandatory. Providing it improves accuracy. |
IGNORED | The field is not used for this country and can be omitted. |
How address requirements are used
The/calculate and /transactions endpoints automatically validate addresses against these country-specific requirements. If a required field is missing or incorrectly formatted, the API returns a 400 error with details about the validation failure. Querying address requirements ahead of time lets you catch these issues before submitting a request.
Regional differences
Address requirements vary by country and region. Here are some key differences to be aware of:- United States (US):
address_line_1,city,state, andpostal_codeare allREQUIRED. State codes must be valid 2-letter US state abbreviations (e.g.,CA,NY). - EU countries (e.g., DE, FR):
address_line_1andcityareREQUIRED, whilestateandpostal_codeareOPTIONAL. When a postal code is provided, it is still validated against the country’s regex pattern. - United Kingdom (GB):
address_line_1andcityareREQUIRED, whilestateandpostal_codeareOPTIONAL. Provided postal codes must match the UK format (e.g.,SW1A 1AA). - Canada (CA):
address_line_1andcityareREQUIRED.stateandpostal_coderequirements follow Canadian postal standards. When provided, state codes must be valid 2-letter province/territory abbreviations (e.g.,ON,BC).
Even when a field is
OPTIONAL, providing it improves tax calculation accuracy. For example, including a postal code for EU or GB addresses helps resolve the correct tax jurisdiction.Postal code validation
Whenpostal_code_regex is present in the response, you can use it to validate postal codes before submission. For example, the US pattern ^\d{5}(-\d{4})?$ accepts both 5-digit and 9-digit ZIP codes.
If a postal code is OPTIONAL for a country, you can omit it without error. However, if you provide a postal code, it must still match the country’s regex pattern — otherwise the API returns a 400 validation error.
Valid state codes
For countries with defined state or province subdivisions (e.g., US, CA), thevalid_state_codes array lists all accepted codes. Use this to populate dropdowns or validate state input in your address forms.