curl --request POST \
--url http://localhost:3001/api/public/apps/identify \
--header 'Content-Type: application/json' \
--header 'PublicWriteKey: <api-key>' \
--header 'authorization: <authorization>' \
--data '
{
"messageId": "23d04926-78e5-4ebc-853f-f26c84ff629e",
"userId": "1043",
"timestamp": "2024-04-22T07:00:00.000Z",
"context": {
"ip": "192.0.2.1"
},
"traits": {
"name": "Michael Scott",
"items": [
{
"id": 1,
"name": "Paper"
},
{
"id": 2,
"name": "Stapler"
}
]
}
}
'import requests
url = "http://localhost:3001/api/public/apps/identify"
payload = {
"messageId": "23d04926-78e5-4ebc-853f-f26c84ff629e",
"userId": "1043",
"timestamp": "2024-04-22T07:00:00.000Z",
"context": { "ip": "192.0.2.1" },
"traits": {
"name": "Michael Scott",
"items": [
{
"id": 1,
"name": "Paper"
},
{
"id": 2,
"name": "Stapler"
}
]
}
}
headers = {
"authorization": "<authorization>",
"PublicWriteKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
authorization: '<authorization>',
PublicWriteKey: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
messageId: '23d04926-78e5-4ebc-853f-f26c84ff629e',
userId: '1043',
timestamp: '2024-04-22T07:00:00.000Z',
context: {ip: '192.0.2.1'},
traits: {
name: 'Michael Scott',
items: [{id: 1, name: 'Paper'}, {id: 2, name: 'Stapler'}]
}
})
};
fetch('http://localhost:3001/api/public/apps/identify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/public/apps/identify",
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([
'messageId' => '23d04926-78e5-4ebc-853f-f26c84ff629e',
'userId' => '1043',
'timestamp' => '2024-04-22T07:00:00.000Z',
'context' => [
'ip' => '192.0.2.1'
],
'traits' => [
'name' => 'Michael Scott',
'items' => [
[
'id' => 1,
'name' => 'Paper'
],
[
'id' => 2,
'name' => 'Stapler'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PublicWriteKey: <api-key>",
"authorization: <authorization>"
],
]);
$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 := "http://localhost:3001/api/public/apps/identify"
payload := strings.NewReader("{\n \"messageId\": \"23d04926-78e5-4ebc-853f-f26c84ff629e\",\n \"userId\": \"1043\",\n \"timestamp\": \"2024-04-22T07:00:00.000Z\",\n \"context\": {\n \"ip\": \"192.0.2.1\"\n },\n \"traits\": {\n \"name\": \"Michael Scott\",\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"Paper\"\n },\n {\n \"id\": 2,\n \"name\": \"Stapler\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("PublicWriteKey", "<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("http://localhost:3001/api/public/apps/identify")
.header("authorization", "<authorization>")
.header("PublicWriteKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messageId\": \"23d04926-78e5-4ebc-853f-f26c84ff629e\",\n \"userId\": \"1043\",\n \"timestamp\": \"2024-04-22T07:00:00.000Z\",\n \"context\": {\n \"ip\": \"192.0.2.1\"\n },\n \"traits\": {\n \"name\": \"Michael Scott\",\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"Paper\"\n },\n {\n \"id\": 2,\n \"name\": \"Stapler\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/public/apps/identify")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["PublicWriteKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messageId\": \"23d04926-78e5-4ebc-853f-f26c84ff629e\",\n \"userId\": \"1043\",\n \"timestamp\": \"2024-04-22T07:00:00.000Z\",\n \"context\": {\n \"ip\": \"192.0.2.1\"\n },\n \"traits\": {\n \"name\": \"Michael Scott\",\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"Paper\"\n },\n {\n \"id\": 2,\n \"name\": \"Stapler\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body"<string>"{
"message": "<string>"
}POST /api/public/apps/identify
The Identify call lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about the user, like their email, name, and more.
curl --request POST \
--url http://localhost:3001/api/public/apps/identify \
--header 'Content-Type: application/json' \
--header 'PublicWriteKey: <api-key>' \
--header 'authorization: <authorization>' \
--data '
{
"messageId": "23d04926-78e5-4ebc-853f-f26c84ff629e",
"userId": "1043",
"timestamp": "2024-04-22T07:00:00.000Z",
"context": {
"ip": "192.0.2.1"
},
"traits": {
"name": "Michael Scott",
"items": [
{
"id": 1,
"name": "Paper"
},
{
"id": 2,
"name": "Stapler"
}
]
}
}
'import requests
url = "http://localhost:3001/api/public/apps/identify"
payload = {
"messageId": "23d04926-78e5-4ebc-853f-f26c84ff629e",
"userId": "1043",
"timestamp": "2024-04-22T07:00:00.000Z",
"context": { "ip": "192.0.2.1" },
"traits": {
"name": "Michael Scott",
"items": [
{
"id": 1,
"name": "Paper"
},
{
"id": 2,
"name": "Stapler"
}
]
}
}
headers = {
"authorization": "<authorization>",
"PublicWriteKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
authorization: '<authorization>',
PublicWriteKey: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
messageId: '23d04926-78e5-4ebc-853f-f26c84ff629e',
userId: '1043',
timestamp: '2024-04-22T07:00:00.000Z',
context: {ip: '192.0.2.1'},
traits: {
name: 'Michael Scott',
items: [{id: 1, name: 'Paper'}, {id: 2, name: 'Stapler'}]
}
})
};
fetch('http://localhost:3001/api/public/apps/identify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/public/apps/identify",
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([
'messageId' => '23d04926-78e5-4ebc-853f-f26c84ff629e',
'userId' => '1043',
'timestamp' => '2024-04-22T07:00:00.000Z',
'context' => [
'ip' => '192.0.2.1'
],
'traits' => [
'name' => 'Michael Scott',
'items' => [
[
'id' => 1,
'name' => 'Paper'
],
[
'id' => 2,
'name' => 'Stapler'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PublicWriteKey: <api-key>",
"authorization: <authorization>"
],
]);
$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 := "http://localhost:3001/api/public/apps/identify"
payload := strings.NewReader("{\n \"messageId\": \"23d04926-78e5-4ebc-853f-f26c84ff629e\",\n \"userId\": \"1043\",\n \"timestamp\": \"2024-04-22T07:00:00.000Z\",\n \"context\": {\n \"ip\": \"192.0.2.1\"\n },\n \"traits\": {\n \"name\": \"Michael Scott\",\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"Paper\"\n },\n {\n \"id\": 2,\n \"name\": \"Stapler\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("PublicWriteKey", "<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("http://localhost:3001/api/public/apps/identify")
.header("authorization", "<authorization>")
.header("PublicWriteKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messageId\": \"23d04926-78e5-4ebc-853f-f26c84ff629e\",\n \"userId\": \"1043\",\n \"timestamp\": \"2024-04-22T07:00:00.000Z\",\n \"context\": {\n \"ip\": \"192.0.2.1\"\n },\n \"traits\": {\n \"name\": \"Michael Scott\",\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"Paper\"\n },\n {\n \"id\": 2,\n \"name\": \"Stapler\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/public/apps/identify")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["PublicWriteKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messageId\": \"23d04926-78e5-4ebc-853f-f26c84ff629e\",\n \"userId\": \"1043\",\n \"timestamp\": \"2024-04-22T07:00:00.000Z\",\n \"context\": {\n \"ip\": \"192.0.2.1\"\n },\n \"traits\": {\n \"name\": \"Michael Scott\",\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"Paper\"\n },\n {\n \"id\": 2,\n \"name\": \"Stapler\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body"<string>"{
"message": "<string>"
}{
"userId": "532",
"traits": {
"email": "john@email.com"
},
"messageId": "6f5f436d-8534-4070-8023-d18f8b78ed39"
}
Authorizations
Authorization header for the request, in the format Bearer <token>. You can collect your token at https://app.tranthor.com/dashboard/settings#write-key.
Headers
Authorization header for the request, in the format Bearer <token>. You can collect your token at https://app.tranthor.com/dashboard/settings#write-key.
Body
- Option 1
- Option 2
Unique identifier for the message, used as an idempotency key for safe retries. Can provide a UUID.
"23d04926-78e5-4ebc-853f-f26c84ff629e"
Unique identifier for the user. Should be the id of the user in your system. Only applicable to logged in users.
"1043"
"user-123"
"0a58e5e4-c753-477e-a6c4-f9b0e3396b9b"
ISO 8601 formatted timestamp of when the event occurred. If not provided, the current server time will be used.
"2024-04-22T07:00:00.000Z"
Provides metadata about the user submitting the event and the context in which the event occurred.
Show child attributes
Show child attributes
{ "ip": "192.0.2.1" }
Free-form dictionary of traits of the user, like email or name. Can contain arbitrary JSON values.
Show child attributes
Show child attributes
{
"name": "Michael Scott",
"items": [
{ "id": 1, "name": "Paper" },
{ "id": 2, "name": "Stapler" }
]
}
Response
An empty String
An empty String

