Manage user profile data and properties
curl --request POST \
--url https://api.mixpanel.com/engage \
--header 'Content-Type: application/json' \
--data '
{
"$token": "<string>",
"$distinct_id": "<string>",
"$set": {},
"$set_once": {},
"$add": {},
"$union": {},
"$append": {},
"$remove": {},
"$unset": [
{}
],
"$delete": "<string>",
"$ignore_alias": true
}
'Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mixpanel/docs/llms.txt
Use this file to discover all available pages before exploring further.
https://api.mixpanel.com/engage
1, uses the request IP for geolocation1 or 0curl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$set": {
"$email": "user@example.com",
"$name": "John Doe",
"plan": "premium",
"credits": 100
}
}
]'
curl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$set_once": {
"first_login": "2024-01-15",
"signup_source": "google_ads",
"referrer": "friend_user456"
}
}
]'
curl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$add": {
"login_count": 1,
"credits": 50,
"failed_attempts": -1
}
}
]'
curl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$union": {
"favorite_genres": ["action", "comedy"],
"visited_pages": ["homepage", "pricing"],
"used_features": ["export", "analytics"]
}
}
]'
curl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$append": {
"purchase_history": {"item": "Premium Plan", "date": "2024-01-15"},
"activity_log": "Logged in from mobile"
}
}
]'
curl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$remove": {
"favorite_genres": "horror",
"interests": "deprecated_feature"
}
}
]'
curl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$unset": ["temp_token", "session_id", "cache_data"]
}
]'
true to delete only this specific distinct_id without following alias chainscurl https://api.mixpanel.com/engage \
--data-urlencode data='[
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$delete": "",
"$ignore_alias": false
}
]'
data = [
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user123",
"$set": {"$email": "user1@example.com"}
},
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user456",
"$add": {"login_count": 1}
},
{
"$token": "YOUR_PROJECT_TOKEN",
"$distinct_id": "user789",
"$unset": ["temp_data"]
}
]
response = requests.post(
'https://api.mixpanel.com/engage',
data={'data': json.dumps(data)}
)
$) for special purposes:
| Property | Description |
|---|---|
$email | User’s email address |
$name | User’s full name |
$first_name | User’s first name |
$last_name | User’s last name |
$phone | User’s phone number |
$avatar | URL to user’s avatar image |
$created | Profile creation time (set automatically) |
$last_seen | Last activity time (set automatically) |
$ prefix for your custom properties.Use $set_once for immutable properties
$set_once to prevent overwriting:"$set_once": {
"signup_date": "2024-01-15",
"first_referrer": "google.com"
}
Batch profile updates
updates = []
for user in users:
updates.append(create_profile_update(user))
# Send in batches of 2000
Use appropriate data types
"credits": 100"plan": "premium""interests": ["tech", "gaming"]"last_purchase": "2024-01-15T10:30:00Z"Keep list properties manageable
curl --request POST \
--url https://api.mixpanel.com/engage \
--header 'Content-Type: application/json' \
--data '
{
"$token": "<string>",
"$distinct_id": "<string>",
"$set": {},
"$set_once": {},
"$add": {},
"$union": {},
"$append": {},
"$remove": {},
"$unset": [
{}
],
"$delete": "<string>",
"$ignore_alias": true
}
'