Validate an address
Validates an address for emergency services.
POST
/
addresses
/
actions
/
validate
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.addresses.actions.validate({
country_code: 'US',
postal_code: '78701',
street_address: '600 Congress Avenue',
});
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.addresses.actions.validate(
country_code="US",
postal_code="78701",
street_address="600 Congress Avenue",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Addresses.Actions.Validate(context.TODO(), telnyx.AddressActionValidateParams{
CountryCode: "US",
PostalCode: "78701",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.addresses.actions.ActionValidateParams;
import com.telnyx.sdk.models.addresses.actions.ActionValidateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionValidateParams params = ActionValidateParams.builder()
.countryCode("US")
.postalCode("78701")
.streetAddress("600 Congress Avenue")
.build();
ActionValidateResponse response = client.addresses().actions().validate(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.addresses.actions.validate(
country_code: "US",
postal_code: "78701",
street_address: "600 Congress Avenue"
)
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->addresses->actions->validate(
countryCode: 'US',
postalCode: '78701',
streetAddress: '600 Congress Avenue',
administrativeArea: 'TX',
extendedAddress: '14th Floor',
locality: 'Austin',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx addresses:actions validate \
--api-key 'My API Key' \
--country-code US \
--postal-code 78701 \
--street-address '600 Congress Avenue'curl --request POST \
--url https://api.telnyx.com/v2/addresses/actions/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"street_address": "600 Congress Avenue",
"postal_code": "78701",
"country_code": "US",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX"
}
'{
"data": {
"result": "valid",
"suggested": {
"street_address": "600 Congress Avenue",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX",
"postal_code": "78701",
"country_code": "US",
"borough": "Guadalajara",
"neighborhood": "Ciudad de los deportes",
"latitude": 123,
"longitude": 123
},
"record_type": "address_validation",
"errors": [
{
"title": "Invalid street address",
"source": {
"pointer": "/street_address"
},
"code": "20207",
"description": "The street address provided is invalid."
}
]
}
}Authorizations
Body
application/json
Parameters that can be defined during address validation
Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.addresses.actions.validate({
country_code: 'US',
postal_code: '78701',
street_address: '600 Congress Avenue',
});
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.addresses.actions.validate(
country_code="US",
postal_code="78701",
street_address="600 Congress Avenue",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Addresses.Actions.Validate(context.TODO(), telnyx.AddressActionValidateParams{
CountryCode: "US",
PostalCode: "78701",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.addresses.actions.ActionValidateParams;
import com.telnyx.sdk.models.addresses.actions.ActionValidateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionValidateParams params = ActionValidateParams.builder()
.countryCode("US")
.postalCode("78701")
.streetAddress("600 Congress Avenue")
.build();
ActionValidateResponse response = client.addresses().actions().validate(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.addresses.actions.validate(
country_code: "US",
postal_code: "78701",
street_address: "600 Congress Avenue"
)
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->addresses->actions->validate(
countryCode: 'US',
postalCode: '78701',
streetAddress: '600 Congress Avenue',
administrativeArea: 'TX',
extendedAddress: '14th Floor',
locality: 'Austin',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx addresses:actions validate \
--api-key 'My API Key' \
--country-code US \
--postal-code 78701 \
--street-address '600 Congress Avenue'curl --request POST \
--url https://api.telnyx.com/v2/addresses/actions/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"street_address": "600 Congress Avenue",
"postal_code": "78701",
"country_code": "US",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX"
}
'{
"data": {
"result": "valid",
"suggested": {
"street_address": "600 Congress Avenue",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX",
"postal_code": "78701",
"country_code": "US",
"borough": "Guadalajara",
"neighborhood": "Ciudad de los deportes",
"latitude": 123,
"longitude": 123
},
"record_type": "address_validation",
"errors": [
{
"title": "Invalid street address",
"source": {
"pointer": "/street_address"
},
"code": "20207",
"description": "The street address provided is invalid."
}
]
}
}