Creates a user address
Creates a new user address from the provided details and returns the created address.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const userAddress = await client.userAddresses.create({
business_name: "Toy-O'Kon",
country_code: 'US',
first_name: 'Alfred',
last_name: 'Foster',
locality: 'Austin',
street_address: '600 Congress Avenue',
});
console.log(userAddress.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
)
user_address = client.user_addresses.create(
business_name="Toy-O'Kon",
country_code="US",
first_name="Alfred",
last_name="Foster",
locality="Austin",
street_address="600 Congress Avenue",
)
print(user_address.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"),
)
userAddress, err := client.UserAddresses.New(context.TODO(), telnyx.UserAddressNewParams{
BusinessName: "Toy-O'Kon",
CountryCode: "US",
FirstName: "Alfred",
LastName: "Foster",
Locality: "Austin",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", userAddress.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.useraddresses.UserAddressCreateParams;
import com.telnyx.sdk.models.useraddresses.UserAddressCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
UserAddressCreateParams params = UserAddressCreateParams.builder()
.businessName("Toy-O'Kon")
.countryCode("US")
.firstName("Alfred")
.lastName("Foster")
.locality("Austin")
.streetAddress("600 Congress Avenue")
.build();
UserAddressCreateResponse userAddress = client.userAddresses().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
user_address = telnyx.user_addresses.create(
business_name: "Toy-O'Kon",
country_code: "US",
first_name: "Alfred",
last_name: "Foster",
locality: "Austin",
street_address: "600 Congress Avenue"
)
puts(user_address)<?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 {
$userAddress = $client->userAddresses->create(
businessName: 'Toy-O\'Kon',
countryCode: 'US',
firstName: 'Alfred',
lastName: 'Foster',
locality: 'Austin',
streetAddress: '600 Congress Avenue',
administrativeArea: 'TX',
borough: 'Guadalajara',
customerReference: 'MY REF 001',
extendedAddress: '14th Floor',
neighborhood: 'Ciudad de los deportes',
phoneNumber: '+12125559000',
postalCode: '78701',
skipAddressVerification: true,
);
var_dump($userAddress);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx user-addresses create \
--api-key 'My API Key' \
--business-name "Toy-O'Kon" \
--country-code US \
--first-name Alfred \
--last-name Foster \
--locality Austin \
--street-address '600 Congress Avenue'curl --request POST \
--url https://api.telnyx.com/v2/user/addresses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"first_name": "Alfred",
"last_name": "Foster",
"business_name": "Toy-O'Kon",
"street_address": "600 Congress Avenue",
"locality": "Austin",
"country_code": "US",
"customer_reference": "MY REF 001",
"phone_number": "+12125559000",
"extended_address": "14th Floor",
"administrative_area": "TX",
"neighborhood": "Ciudad de los deportes",
"borough": "Guadalajara",
"postal_code": "78701",
"skip_address_verification": false
}
EOF{
"data": {
"id": "c3527e69-dc5a-4b3e-8f44-99d209f83c1d",
"record_type": "user_address",
"customer_reference": "MY REF 001",
"first_name": "Alfred",
"last_name": "Foster",
"business_name": "Toy-O'Kon",
"phone_number": "+12125559000",
"street_address": "600 Congress Avenue",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX",
"neighborhood": "Ciudad de los deportes",
"borough": "Guadalajara",
"postal_code": "78701",
"country_code": "US",
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Parameters that can be defined during user address creation
The first name associated with the user address.
"Alfred"
The last name associated with the user address.
"Foster"
The business name associated with the user address.
"Toy-O'Kon"
The primary street address information about the user address.
"600 Congress Avenue"
The locality of the user address. For US addresses, this corresponds to the city of the address.
"Austin"
The two-character (ISO 3166-1 alpha-2) country code of the user address.
"US"
A customer reference string for customer look ups.
"MY REF 001"
The phone number associated with the user address.
"+12125559000"
Additional street address information about the user address such as, but not limited to, unit number or apartment number.
"14th Floor"
The locality of the user address. For US addresses, this corresponds to the state of the address.
"TX"
The neighborhood of the user address. This field is not used for addresses in the US but is used for some international addresses.
"Ciudad de los deportes"
The borough of the user address. This field is not used for addresses in the US but is used for some international addresses.
"Guadalajara"
The postal code of the user address.
"78701"
An optional boolean value specifying if verification of the address should be skipped or not. UserAddresses are generally used for shipping addresses, and failure to validate your shipping address will likely result in a failure to deliver SIM cards or other items ordered from Telnyx. Do not use this parameter unless you are sure that the address is correct even though it cannot be validated. If this is set to any value other than true, verification of the address will be attempted, and the user address will not be allowed if verification fails. If verification fails but suggested values are available that might make the address correct, they will be present in the response as well. If this value is set to true, then the verification will not be attempted. Defaults to false (verification will be performed).
Response
Successful response
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const userAddress = await client.userAddresses.create({
business_name: "Toy-O'Kon",
country_code: 'US',
first_name: 'Alfred',
last_name: 'Foster',
locality: 'Austin',
street_address: '600 Congress Avenue',
});
console.log(userAddress.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
)
user_address = client.user_addresses.create(
business_name="Toy-O'Kon",
country_code="US",
first_name="Alfred",
last_name="Foster",
locality="Austin",
street_address="600 Congress Avenue",
)
print(user_address.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"),
)
userAddress, err := client.UserAddresses.New(context.TODO(), telnyx.UserAddressNewParams{
BusinessName: "Toy-O'Kon",
CountryCode: "US",
FirstName: "Alfred",
LastName: "Foster",
Locality: "Austin",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", userAddress.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.useraddresses.UserAddressCreateParams;
import com.telnyx.sdk.models.useraddresses.UserAddressCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
UserAddressCreateParams params = UserAddressCreateParams.builder()
.businessName("Toy-O'Kon")
.countryCode("US")
.firstName("Alfred")
.lastName("Foster")
.locality("Austin")
.streetAddress("600 Congress Avenue")
.build();
UserAddressCreateResponse userAddress = client.userAddresses().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
user_address = telnyx.user_addresses.create(
business_name: "Toy-O'Kon",
country_code: "US",
first_name: "Alfred",
last_name: "Foster",
locality: "Austin",
street_address: "600 Congress Avenue"
)
puts(user_address)<?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 {
$userAddress = $client->userAddresses->create(
businessName: 'Toy-O\'Kon',
countryCode: 'US',
firstName: 'Alfred',
lastName: 'Foster',
locality: 'Austin',
streetAddress: '600 Congress Avenue',
administrativeArea: 'TX',
borough: 'Guadalajara',
customerReference: 'MY REF 001',
extendedAddress: '14th Floor',
neighborhood: 'Ciudad de los deportes',
phoneNumber: '+12125559000',
postalCode: '78701',
skipAddressVerification: true,
);
var_dump($userAddress);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx user-addresses create \
--api-key 'My API Key' \
--business-name "Toy-O'Kon" \
--country-code US \
--first-name Alfred \
--last-name Foster \
--locality Austin \
--street-address '600 Congress Avenue'curl --request POST \
--url https://api.telnyx.com/v2/user/addresses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"first_name": "Alfred",
"last_name": "Foster",
"business_name": "Toy-O'Kon",
"street_address": "600 Congress Avenue",
"locality": "Austin",
"country_code": "US",
"customer_reference": "MY REF 001",
"phone_number": "+12125559000",
"extended_address": "14th Floor",
"administrative_area": "TX",
"neighborhood": "Ciudad de los deportes",
"borough": "Guadalajara",
"postal_code": "78701",
"skip_address_verification": false
}
EOF{
"data": {
"id": "c3527e69-dc5a-4b3e-8f44-99d209f83c1d",
"record_type": "user_address",
"customer_reference": "MY REF 001",
"first_name": "Alfred",
"last_name": "Foster",
"business_name": "Toy-O'Kon",
"phone_number": "+12125559000",
"street_address": "600 Congress Avenue",
"extended_address": "14th Floor",
"locality": "Austin",
"administrative_area": "TX",
"neighborhood": "Ciudad de los deportes",
"borough": "Guadalajara",
"postal_code": "78701",
"country_code": "US",
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z"
}
}