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?
The following Address Object fields are required:
addressLines
postalCode
countryCode
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¶
The API call sends and receives an Address Object. The following table describes all possible fields in an Address Object. Some fields might not apply to this operation and are marked accordingly.
Important
For the required fields, see the Considerations above.
Name |
Data Type |
Description |
---|---|---|
addressLines |
Array[String] |
Conditional. Street address or P.O. Box. Include apartment number, if applicable. You can specify up to 3 address lines. To determine if this field is required, see the Considerations section on the API request’s documentation page. For USPS® domestic shipments: ensure that the street address is specified as the last of the 3 address lines. This way, the street address is printed right above the city, state, and postal code, per USPS label guidelines. |
cityTown |
String |
Conditional. The city or town. To determine if this field is required, see the API request’s documentation page. |
stateProvince |
String |
Conditional. The state or province. For a US or Canadian address, use the 2-letter state or province code. To determine if this field is required, see the API request’s documentation page. |
postalCode |
String |
Conditional. The postal code or ZIP code. To determine if this field is required, see the API request’s documentation page. For US addresses, use either the 5-digit or 9-digit ZIP code in one of the following formats:
If you use a different format, such as |
countryCode |
String |
Conditional. Two-character country code from the ISO country list. To determine if this field is required, see the API request’s documentation page. |
company |
String |
Conditional. The name of the company. To determine if this field is required, see the API request’s documentation page. |
name |
String |
Conditional. The first and last name. To determine if this field is required, see the API request’s documentation page. |
phone |
String |
Conditional. The phone number. Enter the digits with or without spaces or hyphens. When used for Pickups, the maximum is 10 digits. To determine if this field is required, see the API request’s documentation page. |
String |
Conditional. The email address. To determine if this field is required, see the API request’s documentation page. |
|
residential |
Boolean |
Conditional. Indicates whether this is a residential address. Pitney Bowes recommends including this parameter to improve address verification. This field is required for APAC Services. |
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. |
taxId |
String |
Pickup Request Only. Tax identification number. This is optional for pickup requests. |
status |
String |
RESPONSE ONLY. This field applies to the Validate Address and Suggest Addresses APIs. The field indicates whether the submitted address is valid and whether the API made changes to the address. Possible values are:
|
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.