Postal Address Verification API

Quick Start: C#

There are three steps to integrating the Postal Address Verification API into your Visual Studio C# project.

1. Create an account.

Sign up for an account. When you register you will receive a license key to send messages from. You will need this to use the API.

2. Add a web service reference to your project.

In order to call the Postal Address Verification API, you will need to create a project with a web service reference.

Start by creating a new Console App project in Visual Studio. Then, in the Solution Explorer, right click on your project and select Add > Service Reference….

Visual Studio will open an “Add service reference” dialog. Select WCF Web Service and click the Next button.

In the URI field, type in the URL for the Postal Address Verification service description file: https://pav3.esendex.us/PavService.svc?wsdl. Then click the Go button.

Once the wizard has successfully contacted the Postal Address Verification service, the service will be shown below the URL.

Change the Namespace to something appropriate for your project. Let’s call it WSDL.

Click the Next button. Visual Studio will offer some options for customizing the service, but you can leave these as default.

The wizard will add the service to your project’s service references (as shown).

3. Verify an address.

You can use the VerifyAddressAdvanced method to verify an address. Add the displayed code to your new file.

Replace the LicenseKey value with your account’s license key.

using WSDL;

var config = PavServiceClient.EndpointConfiguration.pavws_secure;
var client = new PavServiceClient(config);

var request = new PavRequest
{
    LicenseKey = "00000000-0000-0000-0000-000000000000",
    FirmOrRecipient = "City Manager's Office",
    PrimaryAddressLine = "306 Cedar Road",
    SecondaryAddressLine = "6th Floor",
    CityName = "Chesapeake",
    State = "VA",
    ZipCode = "23322"
};

var response = await client.VerifyAddressAdvancedAsync(request);

var returnCodeDescription = response.ReturnCode switch
{
    1 => "Invalid input",
    2 => "Invalid license key",
    10 => "Input address is not found",
    100 => "Input address is DPV-confirmed for all components",
    101 => "Input address is found, but not DPV-confirmed",
    102 => "Input address primary number is DPV-confirmed, secondary number is present but not DPV-confirmed",
    103 => "Input address primary number is DPV-confirmed, secondary number is missing",
    200 => "Canadian address on input, verified on city level only",
    _ => "Unknown return code"
};

Console.WriteLine($"Return Code: {response.ReturnCode} - {returnCodeDescription}");
Console.WriteLine(
    response.FirmOrRecipient + "\n" +
    response.PrimaryDeliveryLine + "\n" +
    response.CityName + ", " +
    response.StateAbbreviation + " " +
    response.ZipCode + "\n" +
    response.Country);

Run the project. Visual Studio will open a debug console. The console will display the results of the address verification.

Return Code: 100 - Input address is DPV-confirmed for all components
CITY MANAGER'S OFFICE
306 CEDAR ROAD 6TH FLOOR
CHESAPEAKE, VA 23322-5514
USA

Let’s start sending, together.