Search code examples
avalara

How do I validate an address using Avalara's REST api?


I have been looking at the AvaTax API documentation https://developer.avalara.com/api-reference/avatax/rest/v2/ and would like to know the best way to not only validate an address but also uncover the taxing authority data? What is the recommended approach?


Solution

  • You can retrieve geolocation and jurisdiction/tax authority information for the specified address.

    If the address provided can be resolved, it will resolve against Avalara's address-validation system.

    See: https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Addresses/ResolveAddress/

    There are two methods to obtain a result:

    GET https://sandbox-rest.avatax.com/api/v2/addresses/resolve?line1=255 S King St %231800&city= Seattle&region=wa&postalCode=98104&country=US&textCase=Mixed

    or

    POST https://sandbox-rest.avatax.com/api/v2/addresses/resolve

    {
    "line1": "255 S King St",
    "textCase": "Mixed",
    "city": "Seattle",
    "region": "WA",
    "country": "US",
    "postalCode":"98104"
    }     
    

    Results for the example used above will appear as follows:

    {
    "address": {
        "textCase": "Mixed",
        "line1": "255 S King St",
        "city": "seattle",
        "region": "WA",
        "country": "US",
        "postalCode": "98104"
    },
    "validatedAddresses": [
        {
            "addressType": "HighRiseOrBusinessComplex",
            "line1": "255 S King St",
            "line2": "",
            "line3": "",
            "city": "Seattle",
            "region": "WA",
            "country": "US",
            "postalCode": "98104-3317",
            "latitude": 47.59821,
            "longitude": -122.33108
        }
    ],
    "coordinates": {
        "latitude": 47.59821,
        "longitude": -122.33108
    },
    "resolutionQuality": "Intersection",
    "taxAuthorities": [
        {
            "avalaraId": "2986",
            "jurisdictionName": "KING",
            "jurisdictionType": "County",
            "signatureCode": "BVVZ"
        },
        {
            "avalaraId": "61",
            "jurisdictionName": "WASHINGTON",
            "jurisdictionType": "State",
            "signatureCode": "BVPJ"
        },
        {
            "avalaraId": "167796",
            "jurisdictionName": "SEATTLE",
            "jurisdictionType": "City",
            "signatureCode": "BVXK"
        }
    ]
    }