Validate an Address¶
HTTP Request¶
POST /v1/addresses/verify
Summary¶
Address validation verifies and cleanses postal addresses within the United States to help ensure packages are rated accurately and shipments arrive at their final destinations on time. The Validate Address operation sends an address to be verified. The response indicates whether the address is valid and whether the validation check made changes to the address.
Considerations¶
Only U.S. domestic addresses are validated using this POST operation at this time.
Pitney Bowes verifies addresses for accuracy against current USPS® data and makes corrections to delivery lines and last lines when possible. You can optionally limit the extent of corrections by enabling minimal address validation through the
minimalAddressValidation
query parameter. For a comparison of complete and minimal address validation, please see What is minimal address validation?If validation fails, you can use the Suggest Addresses API call to provide suggestions that could result in the address passing verification in a subsequent Address Validation API call.
Request URLs¶
Sandbox: https://shipping-api-sandbox.pitneybowes.com/shippingservices/v1/addresses/verify
Production: https://shipping-api.pitneybowes.com/shippingservices/v1/addresses/verify
Query Parameter¶
The query parameter is optional.
Important: The parameter is case-sensitive.
Name |
Description |
---|---|
minimalAddressValidation |
When set to Important: If any part of the address, including the delivery line, is marked “Undeliverable” according to USPS data, address validation returns an error. Valid values:
|
Request Headers¶
Name |
Description |
---|---|
Authorization |
Required. OAuth token generated using the Generate an OAuth Token API. |
Content-Type |
Required. The media type of the request entity. Set this to |
Accept-Language |
Language and country code. Default: |
X-PB-UnifiedErrorStructure |
Recommended. Set this to |
Request / Response Elements¶
Name |
Data Type |
Description |
---|---|---|
addressLines |
Array[String] |
Required. Street address or P.O. Box. Include apartment number, if applicable. You can specify up to 3 address lines. Enter the street address as the last of the 3 address lines. |
cityTown |
String |
The city or town. |
stateProvince |
String |
The 2-letter state code. |
postalCode |
String |
Required. The 5-digit or 9-digit ZIP code in one of the following formats:
If you use a different format, such as |
countryCode |
String |
Required. The two-character country code: |
company |
String |
The name of the company. |
name |
String |
The first and last name. |
phone |
String |
The phone number, with or without spaces or hyphens. |
String |
The email address. |
|
residential |
Boolean |
Indicates whether this is a residential address. Pitney Bowes recommends including this parameter to improve address verification. |
deliveryPoint |
String |
The 2-digit USPS domestic delivery point, when available. |
carrierRoute |
String |
The last four characters of the USPS domestic carrier route code. The carrier route is the area served by a particular USPS mail carrier. The full carrier route code is a nine-character string comprising the five-digit postal code appended by these four characters. |
status |
String |
RESPONSE ONLY. Indicates whether the submitted address is valid and whether the API made changes to the address. Possible values:
|
Sample Request¶
curl -X POST ".../v1/addresses/verify?minimalAddressValidation=false" \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-H "X-PB-UnifiedErrorStructure: true" \
-d '
{
"addressLines": [
"27 Waterview Drive",
"",
""
],
"cityTown": "Shelton",
"stateProvince": "CT",
"postalCode": "06484",
"countryCode": "US",
"company": "Pitney Bowes Inc.",
"name": "John Smith",
"phone": "203-000-0000",
"email": "john@example.com",
"residential": false
}'
Sample Response¶
{
"addressLines": [
"27 Waterview Dr"
],
"cityTown": "Shelton",
"stateProvince": "CT",
"postalCode": "06484-4361",
"countryCode": "US",
"company": "Pitney Bowes Inc.",
"name": "John Smith",
"phone": "203-000-0000",
"email": "john@example.com",
"residential": false,
"deliveryPoint": "27",
"carrierRoute": "C010",
"status": "VALIDATED_CHANGED"
}
Error Codes¶
Error codes specific to address validation are seven-digits long and start with 10
. See the address-specific errors in 10-Prefix Error Codes.
For a list of all error codes returned by the Ecommerce APIs, please see Error Codes.