[Shippo] Address Validation API Returns Valid Zip Code Even When Invalid Zip Code is Passed
It appears that Shippo’s Address Validation API can retrieve a valid zip code even when an invalid zip code is passed.
This article describes how I wanted to validate zip codes and checked whether Shippo’s Address Validation API could be used for verification.
Here’s a sample code:
Request
I tried sending a validation API request with zip=a, a value that doesn’t exist in the US.
curl https://api.goshippo.com/addresses/ \\
-H "Authorization: ShippoToken " \\
-d name="Shawn Ippotle" \\
-d company="Shippo" \\
-d street1="215 Clayton St." \\
-d city="San Francisco" \\
-d state="CA" \\
-d zip=a \\
-d country="US" \\
-d email="[email protected]"\\
-d validate=true
Response
I confirmed that the API response returns “object_state”: “VALID” and “zip”: “94117-1913”, which is a correct value.
{
"object_state":"VALID",
"object_purpose":"QUOTE",
"object_source":"VALIDATOR",
"object_created":"2019-09-10T12:50:31.681Z",
"object_updated":"2019-09-10T12:50:31.689Z",
"object_id":"5cee8f0855514008a9688f9199df6fa6",
"object_owner":"[email protected]",
"name":"Shawn Ippotle",
"company":"Shippo",
"street_no":"",
"street1":"215 Clayton St",
"street2":"",
"street3":"",
"city":"San Francisco",
"state":"CA",
"zip":"94117-1913",
"country":"US",
"longitude":-122.44938,
"latitude":37.77335,
"phone":"",
"email":"[email protected]",
"is_residential":true,
"ip":"",
"messages":[
],
"metadata":"",
"test":true
}
It seems that the Address Validation API cannot validate the input zip value. However, since it can retrieve the correct zip based on country, state, city, street1, etc., I think implementing it to use the zip from the API response would work fine.
That’s all from the Gemba.