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, address validation does the following:

    • Verifies the delivery line (street address) and last line (city/state/postal code) for completeness.
    • Returns an error if the address is incomplete or if current USPS data indicates no delivery to that address.
    • Makes corrections to the delivery line or last line when possible.

    If you set the minimalAddressValidation query parameter to true, the API changes the behavior of bullet 3: the API makes corrections only to the last line (city/state/postal code). The delivery line (street address) is returned exactly as specified in the request. Keep in mind, the API still checks the whole address for completeness and still returns an error if any part of the address, including the delivery line, is incomplete or marked “Undeliverable” by USPS. If you use minimal address validation, always ensure the delivery line you enter is actually deliverable.

  4. Address validation returns 2-digit delivery points when available. You can find more information on delivery points at the Wikipedia Delivery Point page. If you use minimal address validation and if the delivery line (street address) cannot be confirmed, the response will not include the delivery point.

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

Possible 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 (new) Available in Sandbox: 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 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" \
-H "X-PB-UnifiedErrorStructure: true" \
-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 Complete 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.