Upsert user
curl --request POST \
--url https://api.example.com/api/v1/users \
--header 'Content-Type: application/json' \
--data '
{
"external_user_id": "<string>",
"email": "<string>",
"traits": {}
}
'import requests
url = "https://api.example.com/api/v1/users"
payload = {
"external_user_id": "<string>",
"email": "<string>",
"traits": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({external_user_id: '<string>', email: '<string>', traits: {}})
};
fetch('https://api.example.com/api/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://api.example.com/api/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' => '<string>',
'email' => '<string>',
'traits' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/users"
payload := strings.NewReader("{\n \"external_user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"traits\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/v1/users")
.header("Content-Type", "application/json")
.body("{\n \"external_user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"traits\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"traits\": {}\n}"
response = http.request(request)
puts response.read_body{
"data.accepted": true
}Users
Upsert user
POST /api/v1/users — identify or update a user.
POST
/
api
/
v1
/
users
Upsert user
curl --request POST \
--url https://api.example.com/api/v1/users \
--header 'Content-Type: application/json' \
--data '
{
"external_user_id": "<string>",
"email": "<string>",
"traits": {}
}
'import requests
url = "https://api.example.com/api/v1/users"
payload = {
"external_user_id": "<string>",
"email": "<string>",
"traits": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({external_user_id: '<string>', email: '<string>', traits: {}})
};
fetch('https://api.example.com/api/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://api.example.com/api/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' => '<string>',
'email' => '<string>',
'traits' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/users"
payload := strings.NewReader("{\n \"external_user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"traits\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/v1/users")
.header("Content-Type", "application/json")
.body("{\n \"external_user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"traits\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"traits\": {}\n}"
response = http.request(request)
puts response.read_body{
"data.accepted": true
}Upserts a user. Same call works for first-touch and updates — the backend deduplicates by
external_user_id.
Request
POST /api/v1/users HTTP/1.1
Host: api.vibefollow.com
Authorization: Bearer sk_live_••••
Content-Type: application/json
Idempotency-Key: 7b6c7e9e-2c2d-4a8d-9d3a-4f3d2c1b0a99
Body
{
"external_user_id": "usr_42",
"email": "jane@acme.io",
"traits": {
"name": "Jane Doe",
"plan": "trial",
"signupDate": "2026-05-17T14:00:00Z",
"company": "Acme Inc.",
"role": "engineering_lead"
}
}
string
required
Your primary key for the user. Stable across re-identifies.
string
Email address. Stored in a dedicated column for fast lookup and PII access control.
object
Trait bag. Known keys (
name, plan, signupDate, company, role) are stored in dedicated columns; any other key flows into the traits JSON column.Response
HTTP/1.1 202 Accepted
Content-Type: application/json
{ "data": { "accepted": true } }
boolean
Always
true on success. The upsert is enqueued and processed asynchronously — downstream views (audiences, etc.) reflect the new state within a few hundred milliseconds.Examples
import { VibeFollow } from '@vibefollow/sdk';
const vf = new VibeFollow({ apiKey: process.env.VIBEFOLLOW_API_KEY! });
await vf.users.identify('usr_42', {
email: 'jane@acme.io',
name: 'Jane Doe',
plan: 'trial',
});
curl https://api.vibefollow.com/api/v1/users \
-X POST \
-H "Authorization: Bearer $VIBEFOLLOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"external_user_id": "usr_42",
"email": "jane@acme.io",
"traits": { "name": "Jane Doe", "plan": "trial" }
}'
Common errors
401 auth_required
401 auth_required
Missing or malformed
Authorization header.403 forbidden
403 forbidden
API key valid but not authorised for this resource.
422 validation_failed
422 validation_failed
Body failed schema validation;
errors[0].field indicates the offending field.429 rate_limited
429 rate_limited
Wait
Retry-After seconds.5xx server_error
5xx server_error
Retry — the
Idempotency-Key prevents duplicates.