import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.addresses.actions.validate({
country_code: 'US',
postal_code: '78701',
street_address: '600 Congress Avenue',
});
console.log(response.data);{
"data": {
"result": "valid",
"suggested": {
"street_address": "600 Congress Avenue",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX",
"postal_code": "78701",
"country_code": "US"
},
"record_type": "address_validation",
"errors": [
{
"title": "Invalid street address",
"source": {
"pointer": "/street_address"
},
"code": "20207",
"description": "The street address provided is invalid."
}
]
}
}Validates an address for emergency services.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.addresses.actions.validate({
country_code: 'US',
postal_code: '78701',
street_address: '600 Congress Avenue',
});
console.log(response.data);{
"data": {
"result": "valid",
"suggested": {
"street_address": "600 Congress Avenue",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX",
"postal_code": "78701",
"country_code": "US"
},
"record_type": "address_validation",
"errors": [
{
"title": "Invalid street address",
"source": {
"pointer": "/street_address"
},
"code": "20207",
"description": "The street address provided is invalid."
}
]
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Parameters that can be defined during address validation
The primary street address information about the address.
"600 Congress Avenue"
The postal code of the address.
"78701"
The two-character (ISO 3166-1 alpha-2) country code of the address.
"US"
Additional street address information about the address such as, but not limited to, unit number or apartment number.
"14th Floor"
The locality of the address. For US addresses, this corresponds to the city of the address.
"Austin"
The locality of the address. For US addresses, this corresponds to the state of the address.
"TX"
Action response
Show child attributes
Indicates whether an address is valid or invalid.
valid, invalid "valid"
Provides normalized address when available.
Show child attributes
The primary street address information about the address.
"600 Congress Avenue"
Additional street address information about the address such as, but not limited to, unit number or apartment number.
"14th Floor"
The locality of the address. For US addresses, this corresponds to the city of the address.
"Austin"
The locality of the address. For US addresses, this corresponds to the state of the address.
"TX"
The postal code of the address.
"78701"
The two-character (ISO 3166-1 alpha-2) country code of the address.
"US"
Identifies the type of the resource.
"address_validation"
Show child attributes
Was this page helpful?