Create or Update User

Create or update user profile information

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

ParameterTypeRequiredDescription
user_idstringYesYour unique identifier for the user
emailstringNoUser's email address
phonestringNoUser's phone number with country code (e.g., +1234567890)
propertiesobjectNoAdditional user attributes as key-value pairs
originobjectNoFree-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 CodeDescription
400Bad Request - Invalid request body or missing required fields
401Unauthorized - Invalid or missing API key
429Too Many Requests - Rate limit exceeded
500Internal 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 origin object for better attribution
  • Include email or phone for push notification delivery
  • Use meaningful property values for audience segmentation