Postal Address Verification API

Quick Start: Python

There are three steps to integrating the Postal Address Verification API into your Python project.

1. Create an account.

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

2. Install Python.

Install Python if it is not on your computer already. To check, run this command in your terminal: python --version

PS C:\> python --version
Python 3.11.0

Next, make sure you have pip (the Python package installer). This is usually included when you install Python, but you can install pip separately here. To check, run this command in your terminal: python -m pip --version

PS C:\> python -m pip --version
pip 22.3 from C:\Python311\Lib\site-packages\pip (python 3.11)

3. Verify an address.

Install httpx, an HTTP client library for Python. Run this command in your terminal: pip install httpx

Create a new Python file. Let’s call it

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.

import httpx

headers = {"Accept": "application/json"}
url = ""

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

with httpx.Client(headers=headers) as client:
    response =, json=request)

response = response.json()

return_code_description = {
    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",
}.get(response["ReturnCode"], "Unknown return code")

print(f"Return code: {response['ReturnCode']} - {return_code_description}")
{response['CityName']}, {response['StateAbbreviation']} {response['ZipCode']}"""

Run the project in your terminal with this command: python The program will display the results of the address verification.

PS C:\PythonDemo> python
Return code: 100 - Input address is DPV-confirmed for all components
CHESAPEAKE, VA 23322-5514

Let’s start sending, together.