Skip to content

UPS - Validate Address

This module validates a shipping address using the UPS Address Validation (XAV) service. It receives the address, city, state, zip code, and country. It makes a POST request to the /api/addressvalidation/v1/1 endpoint with the XAVRequest format. It returns whether the address is valid, the corrected candidate address, the classification (Residential or Commercial), and whether no candidates were found.

ParameterTypeRequiredDescription
credentials_idcredentialsYesUPS credential (provider: ups)
streettextYesMain address line
citytextYesCity
statetextYesState or province
postal_codetextYesZip code
country_codetextYesISO country code (default: US)

A ups type credential is required with the following fields:

  • client_id: UPS API Client ID
  • client_secret: UPS API Client Secret
{
"success": true,
"valid": true,
"candidate": {
"AddressLine": ["123 MAIN ST"],
"PoliticalDivision2": "MEMPHIS",
"PoliticalDivision1": "TN",
"PostcodePrimaryLow": "38118",
"CountryCode": "US"
},
"classification": "Residential",
"is_residential": true,
"no_candidates": false,
"message": "Direccion validada: Residential"
}
{
"credentials_id": "mi_credencial_ups",
"street": "123 Main Street",
"city": "Memphis",
"state": "TN",
"postal_code": "38118",
"country_code": "US"
}
  • The request format uses XAVRequest with AddressKeyFormat
  • UPS internal field names use PoliticalDivision1 (state) and PoliticalDivision2 (city)
  • The no_candidates field indicates whether UPS could not find any candidate address
  • The classification can be “Residential” or “Commercial”
  • The first candidate from the response is used