Skip to main content
POST
/
v1
/
users
/
Create a user
curl --request POST \
  --url https://prod.truv.com/v1/users/ \
  --header 'Content-Type: application/json' \
  --header 'X-Access-Client-Id: <api-key>' \
  --header 'X-Access-Secret: <api-key>' \
  --data '
{
  "external_user_id": "12345",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "phone": "+14155554193",
  "ssn": "222233333"
}
'
import requests

url = "https://prod.truv.com/v1/users/"

payload = {
"external_user_id": "12345",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+14155554193",
"ssn": "222233333"
}
headers = {
"X-Access-Client-Id": "<api-key>",
"X-Access-Secret": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'X-Access-Client-Id': '<api-key>',
'X-Access-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
external_user_id: '12345',
first_name: 'John',
last_name: 'Doe',
email: 'john.doe@example.com',
phone: '+14155554193',
ssn: '222233333'
})
};

fetch('https://prod.truv.com/v1/users/', 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://prod.truv.com/v1/users/",
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([
'external_user_id' => '12345',
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@example.com',
'phone' => '+14155554193',
'ssn' => '222233333'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Access-Client-Id: <api-key>",
"X-Access-Secret: <api-key>"
],
]);

$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://prod.truv.com/v1/users/"

payload := strings.NewReader("{\n \"external_user_id\": \"12345\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"+14155554193\",\n \"ssn\": \"222233333\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-Access-Client-Id", "<api-key>")
req.Header.Add("X-Access-Secret", "<api-key>")
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://prod.truv.com/v1/users/")
.header("X-Access-Client-Id", "<api-key>")
.header("X-Access-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_user_id\": \"12345\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"+14155554193\",\n \"ssn\": \"222233333\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://prod.truv.com/v1/users/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Access-Client-Id"] = '<api-key>'
request["X-Access-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_user_id\": \"12345\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"+14155554193\",\n \"ssn\": \"222233333\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "24d7e80942ce4ad58a93f70ce4115f5c",
  "external_user_id": "12345",
  "created_at": "2022-05-04T11:30:00Z",
  "updated_at": "2022-05-04T12:00:00Z",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "phone": "+14155554193",
  "ssn": "222233333"
}
{
"error": {
"code": "incorrect_parameters",
"message": "Incorrect request parameters",
"extra": {
"invalid-params": [
{
"field": "access_token",
"message": "This field is required."
}
]
}
}
}
{
"error": {
"code": "authentication_failed",
"message": "No such token"
}
}
{
"error": {
"code": "not_authenticated",
"message": "Authentication credentials were not provided."
}
}

Authorizations

X-Access-Client-Id
string
header
required

Client ID

X-Access-Secret
string
header
required

Client Access Key

Body

application/json
external_user_id
string
required

External user id.

Example:

"12345"

first_name
string
required

First name of the user.

Example:

"John"

last_name
string
required

Last name of the user.

Example:

"Doe"

email
string<email>

User's email.

Example:

"john.doe@example.com"

phone
string

User's phone number.

Example:

"+14155554193"

ssn
string

User's SSN.

Example:

"222233333"

Response

id
string
required
read-only

Unique identifier of the user.

Maximum string length: 32
Example:

"24d7e80942ce4ad58a93f70ce4115f5c"

external_user_id
string | null
required

External user id.

Example:

"12345"

created_at
string<date-time>
required
read-only

Timestamp when the user was created.

Example:

"2022-05-04T11:30:00Z"

updated_at
string<date-time>
required
read-only

Timestamp when the user was updated last time.

Example:

"2022-05-04T12:00:00Z"

first_name
string

First name of the user.

Example:

"John"

last_name
string

Last name of the user.

Example:

"Doe"

email
string<email> | null

User's email.

Example:

"john.doe@example.com"

phone
string | null

User's phone number.

Example:

"+14155554193"

ssn
string

User's SSN.

Example:

"222233333"