Address Validation
Address Field Format
The Shippo API uses v1 field names for address components in most endpoints (including CreateShipment). Always use:
| Field |
Description |
Example |
name |
Full name |
Jane Smith |
street1 |
Street address line 1 |
731 Market St |
street2 |
Street address line 2 (optional) |
Suite 200 |
city |
City |
San Francisco |
state |
State or province |
CA |
zip |
Postal code |
94103 |
country |
ISO 3166-1 alpha-2 country code |
US |
email |
Email (required for international senders) |
jane@example.com |
phone |
Phone (required for international senders) |
+1-555-123-4567 |
Note: CreateAddress and ValidateAddress take the v2 field names (address_line_1, city_locality, state_province, postal_code), but when passing addresses inline to CreateShipment, you must use the v1 names above.
Validate a Structured Address
- Collect at minimum:
street1, city, state, zip, country (ISO 3166-1 alpha-2).
- Call
CreateAddress with the address fields. This creates the address and returns an object ID.
- Call
ValidateAddress with the address fields to get validation results. Note: this endpoint takes address fields as query parameters, not an object ID.
- Check
analysis.validation_result.value in the response. Values: "valid", "invalid", or "partially_valid" (address found with corrections applied). Check analysis.validation_result.reasons for details.
- Report the standardized address back. Highlight any corrected fields (listed in
changed_attributes). Note analysis.address_type ("residential", "commercial", or "unknown") -- residential classification affects carrier surcharges.
- If invalid: relay the reason descriptions. If the API returns a
recommended_address, present it to the user.
- If
partially_valid: show what was corrected and ask the user to confirm the corrections are acceptable.
Parse a Freeform Address
- Call
ParseAddress with the raw string (e.g., "123 Main St, Springfield IL 62704").
- Review the structured output for completeness. The parse response uses v2 field names:
address_line_1, city_locality, state_province, postal_code.
- Note: the parse response does not include
country. You must ask the user for the country or infer it, then add it before proceeding.
- Validate the parsed result by passing the fields to
CreateAddress then ValidateAddress (follow the structured address workflow above from step 2).
International Addresses
- Always require the
country field. Do not guess.
- Pass non-Latin characters as-is; the API handles encoding.
- Validation depth varies by country. US, CA, GB, AU, and major EU countries have deep validation. Others may only confirm structural completeness. Inform the user of this limitation.
Bulk Address Validation
There is no batch validation endpoint. Call CreateAddress per address. Track results (row number, valid/invalid, corrections, errors, residential classification) and report a summary when done. For 50+ addresses, set expectations about processing time and provide progress updates.
Re-validate an Existing Address
Call ValidateAddress with the address fields. This endpoint validates by address fields, not by object ID.
Duplicate Addresses
If CreateAddress returns a "Duplicate address" error, the address already exists in the account. Retrieve it via ListAddresses or proceed directly to validation.
Quick Reference
Validate an address:
CreateAddress (saves address) + ValidateAddress (validates with same fields)
Parse then validate:
ParseAddress -> add country -> CreateAddress + ValidateAddress
1---2name: address-validation3description: Validate, parse, and standardize shipping addresses via the Shippo API4---56# Address Validation78## Address Field Format910The Shippo API uses **v1 field names** for address components in most endpoints (including `CreateShipment`). Always use:1112| Field | Description | Example |13|---|---|---|14| `name` | Full name | `Jane Smith` |15| `street1` | Street address line 1 | `731 Market St` |16| `street2` | Street address line 2 (optional) | `Suite 200` |17| `city` | City | `San Francisco` |18| `state` | State or province | `CA` |19| `zip` | Postal code | `94103` |20| `country` | ISO 3166-1 alpha-2 country code | `US` |21| `email` | Email (required for international senders) | `jane@example.com` |22| `phone` | Phone (required for international senders) | `+1-555-123-4567` |2324Note: `CreateAddress` and `ValidateAddress` take the v2 field names (`address_line_1`, `city_locality`, `state_province`, `postal_code`), but when passing addresses inline to `CreateShipment`, you must use the v1 names above.2526---2728## Validate a Structured Address29301. Collect at minimum: `street1`, `city`, `state`, `zip`, `country` (ISO 3166-1 alpha-2).312. Call `CreateAddress` with the address fields. This creates the address and returns an object ID.323. Call `ValidateAddress` with the address fields to get validation results. Note: this endpoint takes address fields as query parameters, not an object ID.334. Check `analysis.validation_result.value` in the response. Values: `"valid"`, `"invalid"`, or `"partially_valid"` (address found with corrections applied). Check `analysis.validation_result.reasons` for details.345. Report the standardized address back. Highlight any corrected fields (listed in `changed_attributes`). Note `analysis.address_type` (`"residential"`, `"commercial"`, or `"unknown"`) -- residential classification affects carrier surcharges.356. If invalid: relay the reason descriptions. If the API returns a `recommended_address`, present it to the user.367. If `partially_valid`: show what was corrected and ask the user to confirm the corrections are acceptable.3738---3940## Parse a Freeform Address41421. Call `ParseAddress` with the raw string (e.g., "123 Main St, Springfield IL 62704").432. Review the structured output for completeness. The parse response uses v2 field names: `address_line_1`, `city_locality`, `state_province`, `postal_code`.443. Note: the parse response does not include `country`. You must ask the user for the country or infer it, then add it before proceeding.454. Validate the parsed result by passing the fields to `CreateAddress` then `ValidateAddress` (follow the structured address workflow above from step 2).4647---4849## International Addresses5051- Always require the `country` field. Do not guess.52- Pass non-Latin characters as-is; the API handles encoding.53- Validation depth varies by country. US, CA, GB, AU, and major EU countries have deep validation. Others may only confirm structural completeness. Inform the user of this limitation.5455---5657## Bulk Address Validation5859There is no batch validation endpoint. Call `CreateAddress` per address. Track results (row number, valid/invalid, corrections, errors, residential classification) and report a summary when done. For 50+ addresses, set expectations about processing time and provide progress updates.6061---6263## Re-validate an Existing Address6465Call `ValidateAddress` with the address fields. This endpoint validates by address fields, not by object ID.6667---6869## Duplicate Addresses7071If `CreateAddress` returns a "Duplicate address" error, the address already exists in the account. Retrieve it via `ListAddresses` or proceed directly to validation.7273---7475## Quick Reference7677**Validate an address:**78`CreateAddress` (saves address) + `ValidateAddress` (validates with same fields)7980**Parse then validate:**81`ParseAddress` -> add country -> `CreateAddress` + `ValidateAddress`