curl --request POST \
--url https://{subdomain}.truust.io/2.0/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "John Doe",
"email": "john@example.com",
"prefix": "+34",
"phone": "612345678"
}
'import requests
url = "https://{subdomain}.truust.io/2.0/customers"
payload = {
"name": "John Doe",
"email": "john@example.com",
"prefix": "+34",
"phone": "612345678"
}
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: 'John Doe', email: 'john@example.com', prefix: '+34', phone: '612345678'})
};
fetch('https://{subdomain}.truust.io/2.0/customers', 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",
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' => 'John Doe',
'email' => 'john@example.com',
'prefix' => '+34',
'phone' => '612345678'
]),
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"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"prefix\": \"+34\",\n \"phone\": \"612345678\"\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"prefix\": \"+34\",\n \"phone\": \"612345678\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/customers")
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\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"prefix\": \"+34\",\n \"phone\": \"612345678\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/customers/abc123",
"uuid": "<string>",
"type": "<string>",
"name": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"prefix": "+34",
"phone": "<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."
]
}
}Create Customer
Creates a new customer (buyer or seller). If a customer with the same email/phone already exists for this account, the existing record is updated and returned.
Either email or phone (with prefix) is required.
curl --request POST \
--url https://{subdomain}.truust.io/2.0/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "John Doe",
"email": "john@example.com",
"prefix": "+34",
"phone": "612345678"
}
'import requests
url = "https://{subdomain}.truust.io/2.0/customers"
payload = {
"name": "John Doe",
"email": "john@example.com",
"prefix": "+34",
"phone": "612345678"
}
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: 'John Doe', email: 'john@example.com', prefix: '+34', phone: '612345678'})
};
fetch('https://{subdomain}.truust.io/2.0/customers', 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",
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' => 'John Doe',
'email' => 'john@example.com',
'prefix' => '+34',
'phone' => '612345678'
]),
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"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"prefix\": \"+34\",\n \"phone\": \"612345678\"\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"prefix\": \"+34\",\n \"phone\": \"612345678\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/customers")
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\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"prefix\": \"+34\",\n \"phone\": \"612345678\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/customers/abc123",
"uuid": "<string>",
"type": "<string>",
"name": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"prefix": "+34",
"phone": "<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.
Body
255"John Doe"
255"John"
255"Doe"
Required if phone is not provided.
255"john@example.com"
Phone country prefix (e.g. +34). Required with phone.
"+34"
Phone number without prefix. Required if email is not provided.
"612345678"
Customer's preferred locale.
"es"
Custom tag for grouping or filtering.
100Tax identification number.
255Gateway-linked customer type. When set, additional KYC fields become required.
CLEARJUNCTION requires id card fields; CURRENCYCLOUD also requires email and phone.
CLEARJUNCTION, CURRENCYCLOUD Arbitrary key-value metadata. For CLEARJUNCTION and CURRENCYCLOUD types,
pass KYC data under metadata.kyc.
Show child attributes
Show child attributes
Response
Customer created or updated
"/2.0/customers/abc123"
"+34"
Hypermedia links to related resources.
Show child attributes
Show child attributes
