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.

    The following table compares complete and minimal address validation:

    Complete Address Validation (Default)


    Minimal Address Validation


    Evaluates entire address against current USPS address information.

    Evaluates entire address against current USPS address information.

    If current USPS address information indicates no delivery to the address, the API returns an error.

    If current USPS address information indicates no delivery to the address, the API returns an error.

    If the address cannot be validated against current USPS address information, the API returns an error.

    If the entire address cannot be validated against current USPS address information, the API checks whether just the last line (city/state/postal code) can be validated:

    • If the last line cannot be validated, the API returns an error.

    • If the last line can be validated, the API checks whether the delivery line (street address) has the correct format (e.g., a street number and street name). If it does, the API returns the address with any corrections only to the last line. The API does not verify or change the delivery line. The API returns the delivery line exactly as it is specified in the request. The API also does not provide a ZIP+4 or 2-digit delivery point.

      If you use minimal address validation, ensure the delivery line you enter is actually deliverable.

    If the API determines the address is a match or close match, the API returns the address with any corrections. The API also returns the ZIP+4 and the 2-digit delivery point.

    If the API determines the address is a match or close match, the API returns the address with any corrections only to the last line. The API also returns the ZIP+4 and the 2-digit delivery point.

  3. The following Address Object fields are required:

    • addressLines

    • postalCode

    • countryCode

  4. 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

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:

  • 12345

  • 12345-6789

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

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.

email

String

Conditional. The email address. To determine if this field is required, see the API request’s documentation page.

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.

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:

  • 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 7-Digit Error Codes.

For a list of all PB Shipping APIs error codes, please see Error Codes.