Create a new user or update an existing user's properties. If a user with the same user_id exists, their information will be updated.
Endpoint
POST /users
Authentication
Required: Bearer token in Authorization header
Authorization: Bearer YOUR_API_KEY
Request Body
{
"user_id": "user_123",
"email": "user@example.com",
"phone": "+1234567890",
"properties": {
"name": "John Doe",
"plan": "premium",
"signup_date": "2023-06-15"
},
"origin": {
"channel": "ios-app",
"campaign": "spring-launch",
"label": "Onboarding Flow"
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | Your unique identifier for the user |
email | string | No | User's email address |
phone | string | No | User's phone number with country code (e.g., +1234567890) |
properties | object | No | Additional user attributes as key-value pairs |
origin | object | No | Free-form metadata describing where this user originated (e.g., acquisition channel, campaign, internal system) |
Response
{
"success": true,
"user_id": "usr_789",
"external_id": "user_123",
"message": "User created/updated successfully"
}
Examples
JavaScript
const response = await fetch('https://api.appizer.com/v1/users', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user_id: 'user_123',
email: 'user@example.com',
phone: '+1234567890',
properties: {
name: 'John Doe',
plan: 'premium',
signup_date: '2023-06-15'
},
origin: {
channel: 'ios-app',
campaign: 'spring-launch'
}
})
});
const data = await response.json();
console.log(data);
Python
import requests
response = requests.post(
'https://api.appizer.com/v1/users',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'user_id': 'user_123',
'email': 'user@example.com',
'phone': '+1234567890',
'properties': {
'name': 'John Doe',
'plan': 'premium',
'signup_date': '2023-06-15'
},
'origin': {
'channel': 'ios-app',
'campaign': 'spring-launch'
}
}
)
print(response.json())
cURL
curl -X POST https://api.appizer.com/v1/users \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user_123",
"email": "user@example.com",
"phone": "+1234567890",
"properties": {
"name": "John Doe",
"plan": "premium",
"signup_date": "2023-06-15"
},
"origin": {
"channel": "ios-app",
"campaign": "spring-launch"
}
}'
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid request body or missing required fields |
| 401 | Unauthorized - Invalid or missing API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Something went wrong on our end |
Best Practices
- Update user profiles as soon as new information is available
- Use consistent property names across your application
- Store acquisition data in the
originobject for better attribution - Include email or phone for push notification delivery
- Use meaningful property values for audience segmentation