Users
Identify a user
Associate traits and attributes with a user ID. Once identified, all future events with this user_id will be enriched with these attributes.
POST
/
identify
TypeScript SDK
import Seerstack from 'seerstack';
const client = new Seerstack({
apiKey: process.env['SEERSTACK_API_KEY'],
});
const response = await client.users.identify({
user_id: 'user_123',
email: 'grace@hopper.com',
name: 'Grace Hopper',
attributes: {
plan: 'enterprise',
team_size: 15,
is_admin: true
}
});
console.log(response.success);require "seerstack"
seerstack = Seerstack::Client.new(
api_key: ENV["SEERSTACK_API_KEY"]
)
response = seerstack.users.identify(
user_id: "user_123",
email: "grace@hopper.com",
name: "Grace Hopper",
attributes: {
plan: "enterprise",
team_size: 15,
is_admin: true
}
)
puts(response.success)curl -X POST https://api.seerstack.com/identify \
-H "Authorization: Bearer $SEERSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user_123",
"email": "grace@hopper.com",
"name": "Grace Hopper",
"attributes": {
"plan": "enterprise",
"team_size": 15,
"is_admin": true
}
}'import requests
url = "https://api.seerstack.com/identify"
payload = {
"user_id": "user_123",
"email": "user@example.com"
}
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({user_id: 'user_123', email: 'user@example.com'})
};
fetch('https://api.seerstack.com/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_URL => "https://api.seerstack.com/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([
'user_id' => 'user_123',
'email' => 'user@example.com'
]),
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://api.seerstack.com/identify"
payload := strings.NewReader("{\n \"user_id\": \"user_123\",\n \"email\": \"user@example.com\"\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://api.seerstack.com/identify")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user_123\",\n \"email\": \"user@example.com\"\n}")
.asString();{
"success": true
}{
"error": "Missing or invalid API key"
}Authorizations
Use your SeerStack API key as a Bearer token. You can find your API key in the SeerStack Dashboard under Settings > Developer.
Body
application/json
Your internal user ID. Use a stable identifier like a database primary key.
Example:
"user_123"
The user's email address.
Example:
"grace@hopper.com"
The user's display name.
Example:
"Grace Hopper"
Custom attributes to associate with the user. These can be used for filtering in the dashboard.
Example:
{
"plan": "enterprise",
"team_size": 15,
"is_admin": true
}
Response
User identified successfully
Indicates whether the operation was successful.
Example:
true
⌘I
TypeScript SDK
import Seerstack from 'seerstack';
const client = new Seerstack({
apiKey: process.env['SEERSTACK_API_KEY'],
});
const response = await client.users.identify({
user_id: 'user_123',
email: 'grace@hopper.com',
name: 'Grace Hopper',
attributes: {
plan: 'enterprise',
team_size: 15,
is_admin: true
}
});
console.log(response.success);require "seerstack"
seerstack = Seerstack::Client.new(
api_key: ENV["SEERSTACK_API_KEY"]
)
response = seerstack.users.identify(
user_id: "user_123",
email: "grace@hopper.com",
name: "Grace Hopper",
attributes: {
plan: "enterprise",
team_size: 15,
is_admin: true
}
)
puts(response.success)curl -X POST https://api.seerstack.com/identify \
-H "Authorization: Bearer $SEERSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user_123",
"email": "grace@hopper.com",
"name": "Grace Hopper",
"attributes": {
"plan": "enterprise",
"team_size": 15,
"is_admin": true
}
}'import requests
url = "https://api.seerstack.com/identify"
payload = {
"user_id": "user_123",
"email": "user@example.com"
}
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({user_id: 'user_123', email: 'user@example.com'})
};
fetch('https://api.seerstack.com/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_URL => "https://api.seerstack.com/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([
'user_id' => 'user_123',
'email' => 'user@example.com'
]),
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://api.seerstack.com/identify"
payload := strings.NewReader("{\n \"user_id\": \"user_123\",\n \"email\": \"user@example.com\"\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://api.seerstack.com/identify")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user_123\",\n \"email\": \"user@example.com\"\n}")
.asString();{
"success": true
}{
"error": "Missing or invalid API key"
}