# Address Verification Guide

This guide outlines EasyPost's Address Verification services, including background information on general AVS and a tutorial on verifying addresses using the
EasyPost API.

For an introduction to EasyPost's API, refer to the Getting Started Guide.

---

## Verification Process

Address verification uses the Address object in combination with the Verifications object.

Verification occurs when the `verify`, `verify_strict`, or `verify_carrier` parameters are included in the request.

> Note: Including the `verify` or `verify_strict` parameter enables address verification, regardless of whether the
  value is `true` or `false`. To prevent verification, omit these parameters entirely.

When `verify_carrier` is used, the response includes a `verifications` dictionary with a `verify_carrier` key indicating the carrier used (e.g., `"verifications": { ..., "verify_carrier": "fedex" }`).

When these parameters are included in the Address creation request, the response includes associated verification attributes, such as `zip4` and `delivery`.

> Note: The `verify_strict` parameter performs the same corrections as `verify`, but returns an error if the address
  cannot be verified. Correctable addresses are still corrected and returned.

### Attributes

- `zip4`: Available for U.S. addresses; verifies the Zip+4 code.
- `delivery`: Checks full address deliverability and may apply minor corrections to spelling or formatting.
- `carrier`: Returned when `verify_carrier` is provided in combination with `verify` or `verify_strict` (set to `true`); indicates carrier-grade verification performed by UPS or FedEx.

### Verification Response

Verification results appear in the Verifications object of the returned Address. Possible responses include:

- `success`: The address was successfully verified.
- `errors`: Indicates a verification failure, with one or more error messages provided.
- `details`: Additional data related to the verification, such as the longitude and latitude of the address.

---

## Street Name Abbreviation Behavior

As of August 25, 2025, EasyPost no longer abbreviates street names when verifying addresses through **USPS**. Abbreviation is applied only when the validated `street1`
field **exceeds 40 characters**. This change does not affect address verification performed through other carriers.

---

## Street1-to-Street2 Splitting Logic

For U.S. and Canada addresses, if `street1` exceeds 35 characters, `street2` is empty, and the end of `street1` contains a recognized unit number
format (e.g., “Apt 101”, “Suite 205”, “Unit #99833”), the unit number is moved to `street2`.

This behavior ensures better address formatting and verification.

[Content omitted: table content. Review the rendered documentation for complete tabular data.]

---

## International AVS

International address verification uses similar objects and responses, but `zip4` is not supported for non-U.S. addresses.

> Note: International AVS is a premium stand-alone service that must be enabled before use. For more information
  about enabling international AVS, contact an EasyPost representative.

---

## Verifying an Address

### Example: Verifying an Address

#### cURL

```shell
curl -X GET https://api.easypost.com/v2/addresses/adr_.../verify \
  -u "EASYPOST_API_KEY":
```

#### Go

```go
package example

import (
	"fmt"

	"github.com/EasyPost/easypost-go/v5"
)

func verify() {
	client := easypost.New("EASYPOST_API_KEY")

	address, _ := client.VerifyAddress("adr_...")

	fmt.Println(address)
}
```

#### Java

```java
package addresses;

import com.easypost.exception.EasyPostException;
import com.easypost.model.Address;
import com.easypost.service.EasyPostClient;

public class Verify {
    public static void main(String[] args) throws EasyPostException {
        EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY");

        Address address = client.address.verify("adr_...");

        System.out.println(address);
    }
}
```

#### C#

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyPost;
using Newtonsoft.Json;

namespace EasyPostExamples
{
    public class Examples
    {
        public static async Task Main()
        {
            var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY"));

            address = await client.Address.Verify("adr_...");

            Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
        }
    }
}
```

#### Node.js

```javascript
const EasyPostClient = require('@easypost/api');

const client = new EasyPostClient('EASYPOST_API_KEY');

(async () => {
  const address = await client.Address.verifyAddress('adr_...');

  console.log(address);
})();
```

#### PHP

```php
<?php

$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY');

$address = $client->address->verify('adr_...');

echo $address;
```

#### Python

```python
import easypost

client = easypost.EasyPostClient("EASYPOST_API_KEY")

address = client.address.verify("adr_...")

print(address)
```

#### Ruby

```ruby
require 'easypost'

client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')

address = client.address.verify('adr_...')

puts address
```

---

## Strict-Verifying an Address

### Example: Strict-Verifying an Address

#### cURL

```shell
curl -X POST https://api.easypost.com/v2/addresses \
  -u "EASYPOST_API_KEY": \
  -H 'Content-Type: application/json' \
  -d '{
    "address": {
      "street1": "000 unknown street",
      "city": "Not A City",
      "state": "ZZ",
      "zip": "00001",
      "country": "US",
      "email": "test@example.com",
      "phone": "5555555555"
    },
    "verify_strict": true
  }'
```

#### Go

```go
package example

import (
	"fmt"

	"github.com/EasyPost/easypost-go/v5"
)

func verifyStrictParam() {
	client := easypost.New("EASYPOST_API_KEY")

	address, _ := client.CreateAddress(
		&easypost.Address{
			Street1: "000 unknown street",
			City:    "Not A City",
			State:   "ZZ",
			Zip:     "00001",
			Country: "US",
			Email:   "test@example.com",
			Phone:   "5555555555",
		},
		&easypost.CreateAddressOptions{
			VerifyStrict: true,
		},
	)

	fmt.Println(address)
}
```

#### Java

```java
package addresses;

import com.easypost.exception.EasyPostException;
import com.easypost.model.Address;
import com.easypost.service.EasyPostClient;

import java.util.HashMap;

public class VerifyStrictParam {
    public static void main(String[] args) throws EasyPostException {
        EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY");

        HashMap<String, Object> params = new HashMap<String, Object>();

        params.put("street1", "000 unknown street");
        params.put("city", "Not A City");
        params.put("state", "ZZ");
        params.put("zip", "00001");
        params.put("country", "US");
        params.put("email", "test@example.com");
        params.put("phone", "5555555555");
        params.put("verify_strict", true);

        Address address = client.address.create(params);

        System.out.println(address);
    }
}
```

#### C#

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyPost;
using Newtonsoft.Json;

namespace EasyPostExamples
{
    public class Examples
    {
        public static async Task Main()
        {
            var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY"));

            EasyPost.Parameters.Address.Create parameters = new()
            {
                Street1 = "000 unknown street",
                City = "Not A City",
                State = "ZZ",
                Zip = "00001",
                Country = "US",
                Email = "test@example.com",
                Phone = "5555555555",
                VerifyStrict = true
            };

            EasyPost.Models.API.Address address = await client.Address.Create(parameters);

            Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
        }
    }
}
```

#### Node.js

```javascript
const EasyPostClient = require('@easypost/api');

const client = new EasyPostClient('EASYPOST_API_KEY');

(async () => {
  const address = await client.Address.create({
    verify_strict: true,
    street1: '000 unknown street',
    city: 'Not A City',
    state: 'ZZ',
    zip: '00001',
    country: 'US',
    email: 'test@example.com',
    phone: '5555555555',
  });

  console.log(address);
})();
```

#### PHP

```php
<?php

$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY');

$address = $client->address->create([
    'verify_strict'  => true,
    'street1' => '000 unknown street',
    'city'    => 'Not a City',
    'state'   => 'ZZ',
    'zip'     => '00001',
    'country' => 'US',
    'email' => 'test@example.com',
    'phone'   => '5555555555',
]);

echo $address;
```

#### Python

```python
import easypost

client = easypost.EasyPostClient("EASYPOST_API_KEY")

address = client.address.create(
    verify_strict=True,
    street1="000 unknown street",
    city="Not A City",
    state="ZZ",
    zip="00001",
    country="US",
    email="test@example.com",
    phone="5555555555",
)

print(address)
```

#### Ruby

```ruby
require 'easypost'

client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')

address = client.address.create(
  verify_strict: true,
  street1: '000 unknown street',
  city: 'Not A City',
  state: 'ZZ',
  zip: '00001',
  country: 'US',
  email: 'test@example.com',
  phone: '5555555555',
)

puts address
```

---

## Verify an Existing Address

### Example: Verify an Existing Address

#### cURL

```shell
curl -X POST https://api.easypost.com/v2/addresses \
  -u "EASYPOST_API_KEY": \
  -H 'Content-Type: application/json' \
  -d '{
    "address": {
      "street1": "000 unknown street",
      "city": "Not A City",
      "state": "ZZ",
      "zip": "00001",
      "country": "US",
      "email": "test@example.com",
      "phone": "5555555555"
    },
    "verify": true
  }'
```

#### Go

```go
package example

import (
	"fmt"

	"github.com/EasyPost/easypost-go/v5"
)

func verifyParam() {
	client := easypost.New("EASYPOST_API_KEY")

	address, _ := client.CreateAddress(
		&easypost.Address{
			Street1: "000 unknown street",
			City:    "Not A City",
			State:   "ZZ",
			Zip:     "00001",
			Country: "US",
			Email:   "test@example.com",
			Phone:   "5555555555",
		},
		&easypost.CreateAddressOptions{
			Verify: true,
		},
	)

	fmt.Println(address)
}
```

#### Java

```java
package addresses;

import com.easypost.exception.EasyPostException;
import com.easypost.model.Address;
import com.easypost.service.EasyPostClient;

import java.util.HashMap;

public class VerifyParam {
    public static void main(String[] args) throws EasyPostException {
        EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY");

        HashMap<String, Object> params = new HashMap<String, Object>();

        params.put("street1", "000 unknown street");
        params.put("city", "Not A City");
        params.put("state", "ZZ");
        params.put("zip", "00001");
        params.put("country", "US");
        params.put("email", "test@example.com");
        params.put("phone", "5555555555");
        params.put("verify", true);

        Address address = client.address.create(params);

        System.out.println(address);
    }
}
```

#### C#

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyPost;
using Newtonsoft.Json;

namespace EasyPostExamples
{
    public class Examples
    {
        public static async Task Main()
        {
            var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY"));

            EasyPost.Parameters.Address.Create parameters = new()
            {
                Street1 = "000 unknown street",
                City = "Not A City",
                State = "ZZ",
                Zip = "00001",
                Country = "US",
                Email = "test@example.com",
                Phone = "5555555555",
                Verify = true
            };

            EasyPost.Models.API.Address address = await client.Address.Create(parameters);

            Console.WriteLine(JsonConvert.SerializeObject(address, Formatting.Indented));
        }
    }
}
```

#### Node.js

```javascript
const EasyPostClient = require('@easypost/api');

const client = new EasyPostClient('EASYPOST_API_KEY');

(async () => {
  const address = await client.Address.create({
    verify: true,
    street1: '000 unknown street',
    city: 'Not A City',
    state: 'ZZ',
    zip: '00001',
    country: 'US',
    email: 'test@example.com',
    phone: '5555555555',
  });

  console.log(address);
})();
```

#### PHP

```php
<?php

$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY');

$address = $client->address->create([
    'verify'  => true,
    'street1' => '000 unknown street',
    'city'    => 'Not a City',
    'state'   => 'ZZ',
    'zip'     => '00001',
    'country' => 'US',
    'email' => 'test@example.com',
    'phone'   => '5555555555',
]);

echo $address;
```

#### Python

```python
import easypost

client = easypost.EasyPostClient("EASYPOST_API_KEY")

address = client.address.create(
    verify=True,
    street1="000 unknown street",
    city="Not A City",
    state="ZZ",
    zip="00001",
    country="US",
    email="test@example.com",
    phone="5555555555",
)

print(address)
```

#### Ruby

```ruby
require 'easypost'

client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')

address = client.address.create(
  verify: true,
  street1: '000 unknown street',
  city: 'Not A City',
  state: 'ZZ',
  zip: '00001',
  country: 'US',
  email: 'test@example.com',
  phone: '5555555555',
)

puts address
```

---

## Additional Resources

Related:

- [API Docs - Address](https://docs.easypost.com/guides/getting-started)