# Verify age

Source: https://developer.avalara.com/avatax-for-bevalc/age-verification-api/verify-age/

# Verify age

The [VerifyAge](https://rest.avatax.com/swagger/ui/index.html?urls.primaryName=Alcohol%20Shipping%20Verification#/Age%20Verification) endpoint is used to determine whether a purchaser or recipient can legally purchase or receive alcoholic beverages in the specified jurisdiction. AvaTax will consider the address and (optional) date of birth specified in the request. If the response results in an`isOfAge` value of`false`, then the endpoint will also return one or more of the following failure codes:

-   `not_found`: A public records search did not return any results for the subject.
-   `dob_unverifiable`: A public records search did not return a DoB, or the DoB does not match public records.
-   `under_age`: The subject is below 21 years of age.
-   `suspected_fraud`: Based on the input data, the subject is associated with a high-risk alert from IDology.
-   `deceased`: Public records indicate that the subject is deceased.
-   `unknown_error`: An unknown error occurred. Please contact Avalara support.

## Endpoint

POST /api/v2/ageverification/verify

## Input fields for age verification

The table below describes the required and optional fields for the age verification request.

Field name

Description

Required?

`firstName`

The first name of the person whose age you want to verify.

Yes

`lastName`

The last name of the person whose age you want to verify.

Yes

`address`

The address of the person whose age you want to verify. One of the following sets of attributes are required for`address`:

-   `line1`,`city`,`region`
-   `line1`,`postalCode`

A`country` field can also be provided, but only`US` and`USA` are valid.

Yes

`DOB`

The ISO-8601 compliant date of birth of the person whose age you want to verify. Note that a date of birth can be specified in a transaction using the`PurchaserDOB` and`RecipientDOB` parameters.

No

## Parameters

The table below describes a parameter that can specified in the age verification request URL on Sandbox only. For example:

`https://sandbox-rest.avatax.com/api/v2/ageverification/verify?simulatedFailureCode=under_age`

**Note:** The`simulatedFailureCode` parameter is only available in Sandbox. You will receive an error if you attempt to use this in Production. This optional parameter provides you with a method for testing whether your integration can consume these failure codes, without incurring costs associated with running this endpoint in production.

Parameter

Description

`simulatedFailureCode`

An array of failure codes to include in a simulated response for the endpoint. These codes specify why a`false` age verification was returned. Available failure codes include:

-   `not_found`
-   `dob_unverifiable`
-   `under_age`
-   `suspected_fraud`
-   `deceased`
-   `unknown_error`

## Request

```
curl    -X POST    -H 'Accept: application/json'    -H 'Authorization: Basic aHR0cHdhdQNoOmY='    -H 'Content-Type: application/json'    --data '{      {        "firstName": "John",        "lastName": "Doe",        "address": {          "line1": "255 S King St",          "city": "Seattle",          "region": "WA",          "country": "US",          "postalCode": "98104"        },        "DOB": "1994-10-01"      }    }    'https://sandbox-rest.avatax.com/api/v2/ageverification/verify'
```

## Response

The response returns`"isOfAge": true` if purchaser or recipient is within the legal age limit. If the verification fails, the response returns`"isOfAge":false`, and the`failureCodes` line in the response will describe the reason.

```
{  "isOfAge": true,  "failureCodes": []}
```

[Previous](/avatax-for-bevalc/age-verification-api)

[Next](/avatax-for-bevalc/age-verification-api/store-verification)