X

Validate an address

We currently can only validate UK & US addresses.


[POST] https://api-us1.stannp.com/v1/addresses/validate

Parameters

company string Company name.
address1 string Address line 1.
address2 string Address line 2.
city string Address city.
state string Two-letter abbreviation if possible.
zipcode string Address zipcode.
country string ISO 3166-1 Alpha 2 Country Code (US,GB,CA,FR...).

Request

                <?php
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api-us1.stannp.com/v1/addresses/validate?api_key={API_KEY}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => array(
        'company' => "Stannp",
        'address1' => "1000 N west street",
        'address2' => "Suite 1200 #1939",
        'city' => "Wilmington",
        'zipcode' => "19801",
        'country' => "US"
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
print_r($response);
?>
            

Response

{
    "success": true,
    "data": {
        "is_valid": true
    }
}