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

  1. Only U.S. domestic addresses are validated using this POST operation at this time.

  2. 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?

  3. 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 true, the complete address (delivery line and last line) is validated but only the last line (city, state, and postal code) would be changed by the validation check.

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:

  • true

  • false

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 application/json.

Accept-Language

Language and country code. Default: en-US

X-PB-UnifiedErrorStructure

Recommended. Set this to true to use the standard error object if an error occurs.

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:

  • 12345

  • 12345-6789

If you use a different format, such as 12345- or 123451234, you will receive an error.

countryCode

String

Required. The two-character country code: US

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.

email

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:

  • VALIDATED_CHANGED: The address is valid, but the API made changes to improve the address. For example, if an address has a valid street number and street name (e.g. “100 Elm”) but is missing the street suffix (e.g. “St”), the API would add the suffix.

  • VALIDATED_AND_NOT_CHANGED: The address is valid. The API made no changes.

  • NOT_CHANGED: The address could not be validated. The API made no changes.

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.