Add address to customer
curl --request POST \
--url https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my_address",
"line1": "Main street 123",
"city": "Barcelona",
"state": "Catalonia",
"zip_code": "08001",
"country": "ES"
}
'import requests
url = "https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses"
payload = {
"name": "my_address",
"line1": "Main street 123",
"city": "Barcelona",
"state": "Catalonia",
"zip_code": "08001",
"country": "ES"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my_address',
line1: 'Main street 123',
city: 'Barcelona',
state: 'Catalonia',
zip_code: '08001',
country: 'ES'
})
};
fetch('https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my_address',
'line1' => 'Main street 123',
'city' => 'Barcelona',
'state' => 'Catalonia',
'zip_code' => '08001',
'country' => 'ES'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses"
payload := strings.NewReader("{\n \"name\": \"my_address\",\n \"line1\": \"Main street 123\",\n \"city\": \"Barcelona\",\n \"state\": \"Catalonia\",\n \"zip_code\": \"08001\",\n \"country\": \"ES\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my_address\",\n \"line1\": \"Main street 123\",\n \"city\": \"Barcelona\",\n \"state\": \"Catalonia\",\n \"zip_code\": \"08001\",\n \"country\": \"ES\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my_address\",\n \"line1\": \"Main street 123\",\n \"city\": \"Barcelona\",\n \"state\": \"Catalonia\",\n \"zip_code\": \"08001\",\n \"country\": \"ES\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "<string>",
"uuid": "<string>",
"name": "<string>",
"email": "<string>",
"prefix": "<string>",
"phone": "<string>",
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"zip_code": "<string>",
"tag": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Customers
Add Address to Customer
POST
/
customers
/
{uuid}
/
addresses
Add address to customer
curl --request POST \
--url https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my_address",
"line1": "Main street 123",
"city": "Barcelona",
"state": "Catalonia",
"zip_code": "08001",
"country": "ES"
}
'import requests
url = "https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses"
payload = {
"name": "my_address",
"line1": "Main street 123",
"city": "Barcelona",
"state": "Catalonia",
"zip_code": "08001",
"country": "ES"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my_address',
line1: 'Main street 123',
city: 'Barcelona',
state: 'Catalonia',
zip_code: '08001',
country: 'ES'
})
};
fetch('https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my_address',
'line1' => 'Main street 123',
'city' => 'Barcelona',
'state' => 'Catalonia',
'zip_code' => '08001',
'country' => 'ES'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses"
payload := strings.NewReader("{\n \"name\": \"my_address\",\n \"line1\": \"Main street 123\",\n \"city\": \"Barcelona\",\n \"state\": \"Catalonia\",\n \"zip_code\": \"08001\",\n \"country\": \"ES\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my_address\",\n \"line1\": \"Main street 123\",\n \"city\": \"Barcelona\",\n \"state\": \"Catalonia\",\n \"zip_code\": \"08001\",\n \"country\": \"ES\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/customers/{uuid}/addresses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my_address\",\n \"line1\": \"Main street 123\",\n \"city\": \"Barcelona\",\n \"state\": \"Catalonia\",\n \"zip_code\": \"08001\",\n \"country\": \"ES\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "<string>",
"uuid": "<string>",
"name": "<string>",
"email": "<string>",
"prefix": "<string>",
"phone": "<string>",
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"zip_code": "<string>",
"tag": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Authorizations
Use your account's Secret Key as the Bearer token.
Path Parameters
Customer UUID.
Body
application/json
Address label or recipient name.
Maximum string length:
255Example:
"my_address"
Address line 1 (street and number).
Maximum string length:
255Example:
"Main street 123"
Maximum string length:
255Example:
"Barcelona"
Maximum string length:
255Example:
"Catalonia"
ZIP or postal code.
Example:
"08001"
ISO 3166-1 alpha-2 country code.
Maximum string length:
2Example:
"ES"
Address line 2 (apartment, suite, etc.).
Maximum string length:
255Maximum string length:
255Phone country prefix (e.g. +34). Required with phone.
Example:
"+34"
Phone number. Required with prefix.
Example:
"612345678"
Maximum string length:
100Response
Address created
Hypermedia links to related resources.
Show child attributes
Show child attributes
