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.

Things to Consider

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

  2. Addresses are validated by the Pitney Bowes Address Validation (AV) engine.

  3. By default, the complete address is validated. The complete address is the address lines and the city/state/zip. An error is returned if validation fails.

    • When the minimalAddressValidation query parameter flag is set to true, the address lines are left as is and are not formatted, re-arranged, or included in the validation check. Only the city/state/zip is checked for validity.

      Note: When using this option, please ensure that street addresses on the labels are actually deliverable, as street addresses are not validated by the Pitney Bowes AV engine.

    • When the minimalAddressValidation query parameter flag is set to false, which is the default, the complete address (the address lines and the city/state/zip) is included in the validation check.

  4. Address validation returns 2-digit delivery points when available. You can find more information on delivery points at the Wikipedia Delivery Point page.

  5. 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 URIs

Sandbox: https://api-sandbox.pitneybowes.com/shippingservices/v1/addresses/verify
Production: https://api.pitneybowes.com/shippingservices/v1/addresses/verify

Query Parameter

The query parameter is optional.

Important: The parameter is case-sensitive.

Name Data Type Description
minimalAddressValidation Boolean When set to true, only City, State, and PostalCode (ZIP) are validated.

Request Headers

Name Data Type Description
Authorization String Required. OAuth token generated using the Generate an OAuth Token API.
Content-Type String Required. The media type of the request entity. Set this to application/json.
Accept-Language String Language and country code. Default: en-US

Request / Response Elements

The API call sends and receives an address object. The table below describes all the elements in an address object. Some fields might not apply to your operation and are marked as such.

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.

For USPS domestic destinations, 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, postal ZIP code, per USPS label guidelines.

cityTown String

The city or town name.

Required in the following cases:

stateProvince String

State or province name. For US address, use the 2-letter state code.

Required in the following cases:

postalCode String Required. Postal/ZIP code. For US addresses, either the 5-digit or 9-digit ZIP code.
countryCode String Required. Two-character country code from the ISO country list.
company String

Name of the company.

Required in the following cases:

name String

First and last name.

Required in the following cases:

phone String

Phone number.

Required in the following cases:

  • Priority Mail Express (EM) shipments (a.k.a. Express Mail shipments) require this field in the fromAddress object.
  • Scheduling a pickup.
  • Creating an SBR label requires this field in the fromAddress object.
email String

Email address.

Required in the fromAddress object if creating an SBR label.

residential Boolean Indicates whether this is a residential address. It is recommended that this parameter be passed in as the address verification process is more accurate with it.
deliveryPoint String The 2-digit delivery point, when available.
carrierRoute String The last four characters of the USPS 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. Indicates whether the address is valid and whether the validation check made changes to the address.

Note: The response does not return this field if minimal address validation is enabled.

Valid Values are:

  • VALIDATED_CHANGED: The address is valid. The validation check made changes to the address.
  • VALIDATED_AND_NOT_CHANGED: The address is valid. No changes were made.
  • NOT_CHANGED: The address could not be validated. No changes were made.

Sample Request

curl -X POST .../v1/addresses/verify?minimalAddressValidation=false \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-d '
{
    "addressLines": [
        "27 Waterview Drive",
        "",
        ""
    ],
    "cityTown": "Shelton",
    "stateProvince": "CT",
    "postalCode": "06484",
    "countryCode": "US",
    "company": "Pitney Bowes Inc.",
    "name": "John Q",
    "phone": "203-000-0000",
    "email": "john.q@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 Q",
    "phone": "203-000-0000",
    "email": "john.q@example.com",
    "residential": false,
    "deliveryPoint": "27",
    "carrierRoute": "C010",
    "status": "VALIDATED_CHANGED"
}

Error Codes

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

The following codes are specific to address validation.

Error Code Message  
1000505 Country Code must be 2 letters.  
1010990 Invalid or missing value for countryCode  
1012003 Company field cannot exceed ___ characters  
1012010 email field cannot exceed ___ characters  
1012012 Invalid/missing cityTown  
1012013 CityTown field cannot exceed ___ characters  
1012014 Invalid/missing stateProvince  
1012015 Invalid stateProvince field value. stateProvince field length has to be ___ characters  
1012016 Invalid/missing postalCode  
1012020 Only 3 address delivery lines are allowed  
1012021 Invalid/missing addressDeliveryLine1  
1012022 AddressLines field cannot exceed 79 characters SOLUTION
1012038 Either companyName or name fields are mandatory  
1012049 Provide at least one addressLine  
1019000 Invalid address provided SOLUTION
1019002 Invalid or missing value for countryCode.  
1019003 Either Invalid or missing street or stateProvince or postalcode.