Identities
Create Identity
POST
/
track#create-identity
Create Identity
curl --request POST \
--url 'https://{region}.mixpanel.com/track#create-identity' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'data={
"event": "$identify",
"properties": {
"$identified_id": "ORIGINAL_ID",
"$anon_id": "NEW_ID",
"token": "YOUR_PROJECT_TOKEN"
}
}
' \
--data strict=0import requests
url = "https://{region}.mixpanel.com/track#create-identity"
payload = {
"data": "{
\"event\": \"$identify\",
\"properties\": {
\"$identified_id\": \"ORIGINAL_ID\",
\"$anon_id\": \"NEW_ID\",
\"token\": \"YOUR_PROJECT_TOKEN\"
}
}
",
"strict": "0"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
data: '{\n "event": "$identify",\n "properties": {\n "$identified_id": "ORIGINAL_ID",\n "$anon_id": "NEW_ID",\n "token": "YOUR_PROJECT_TOKEN"\n }\n}\n',
strict: '0'
})
};
fetch('https://{region}.mixpanel.com/track#create-identity', 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://{region}.mixpanel.com/track#create-identity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://{region}.mixpanel.com/track#create-identity"
payload := strings.NewReader("data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{region}.mixpanel.com/track#create-identity")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.mixpanel.com/track#create-identity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0"
response = http.request(request)
puts response.read_body1The
$identify event payload is only useful for projects using the Original ID Merge system; it has no functionality in other ID management systems. Please review this section of our documentation for more information.You can also use the import endpoint: https://api.mixpanel.com/import/
curl --request POST \
--url 'https://api.mixpanel.com/track#create-identity' \
--header 'accept: text/plain' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'data={
"event": "$identify",
"properties": {
"$identified_id": "YOUR_CHOSEN_USER_ID",
"$anon_id": "ORIGINAL_ANON_ID",
"token": "YOUR_PROJECT_TOKEN"
}
}
'

| Event Object property | Type | Description |
|---|---|---|
| event | String required | value must be: $identify |
| properties | Object required | |
| properties.distinct_id | String optional | The distinct ID post-identification (same as $identified_id - it will be inferred from $identified_id if not included) |
| properties.$identified_id | String required | A distinct_id to merge with the $anon_id. |
| properties.$anon_id | String required | A distinct_id to merge with the $identified_id. The $anon_id must be UUID v4 format and not already merged to an $identified_id. |
| properties.token | String required | The project token. |
Body
application/x-www-form-urlencoded
data
string<blob>
default:{
"event": "$identify",
"properties": {
"$identified_id": "ORIGINAL_ID",
"$anon_id": "NEW_ID",
"token": "YOUR_PROJECT_TOKEN"
}
}
required
A JSON object with the required Event Object fields and any additional event properties.
If present and equal to 1, Mixpanel will validate the provided records and return a JSON object with per-record error messages for records that fail validation.
Required range:
0 <= x <= 1Response
1- All data objects provided are valid. This does not signify a valid project token or secret.0- One or more data objects in the body are invalid.
The response is of type enum<integer>.
Available options:
1, 0 Was this page helpful?
⌘I
Create Identity
curl --request POST \
--url 'https://{region}.mixpanel.com/track#create-identity' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'data={
"event": "$identify",
"properties": {
"$identified_id": "ORIGINAL_ID",
"$anon_id": "NEW_ID",
"token": "YOUR_PROJECT_TOKEN"
}
}
' \
--data strict=0import requests
url = "https://{region}.mixpanel.com/track#create-identity"
payload = {
"data": "{
\"event\": \"$identify\",
\"properties\": {
\"$identified_id\": \"ORIGINAL_ID\",
\"$anon_id\": \"NEW_ID\",
\"token\": \"YOUR_PROJECT_TOKEN\"
}
}
",
"strict": "0"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
data: '{\n "event": "$identify",\n "properties": {\n "$identified_id": "ORIGINAL_ID",\n "$anon_id": "NEW_ID",\n "token": "YOUR_PROJECT_TOKEN"\n }\n}\n',
strict: '0'
})
};
fetch('https://{region}.mixpanel.com/track#create-identity', 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://{region}.mixpanel.com/track#create-identity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://{region}.mixpanel.com/track#create-identity"
payload := strings.NewReader("data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{region}.mixpanel.com/track#create-identity")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.mixpanel.com/track#create-identity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "data=%7B%0A%20%20%20%20%20%20%22event%22%3A%20%22%24identify%22%2C%0A%20%20%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%24identified_id%22%3A%20%22ORIGINAL_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22%24anon_id%22%3A%20%22NEW_ID%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22token%22%3A%20%22YOUR_PROJECT_TOKEN%22%0A%20%20%20%20%20%20%7D%0A%7D%0A&strict=0"
response = http.request(request)
puts response.read_body1