Track multiple events in a single API call for improved performance.
Endpoint
Authentication
Required: Bearer token in Authorization header
Authorization: Bearer YOUR_API_KEY
Request Body
{
"events": [
{
"event_name": "page_view",
"user_id": "user_123",
"properties": {
"page": "/dashboard"
},
"ip": "192.168.1.1",
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
},
{
"event_name": "button_click",
"user_id": "user_123",
"properties": {
"button_id": "cta_button"
}
}
]
}
Parameters
| Parameter | Type | Required | Description |
|---|
events | array | Yes | Array of event objects to track (max 100 events) |
Event Object
| Parameter | Type | Required | Description |
|---|
event_name | string | Yes | Name of the event to track |
user_id | string | Yes | Your unique identifier for the user |
properties | object | No | Additional event attributes as key-value pairs |
ip | string | No | User's IP address for analytics tracking |
ua | string | No | User agent string for device/browser tracking |
Response
{
"success": true,
"processed_count": 2,
"message": "Batch events tracked successfully"
}
Examples
JavaScript
const response = await fetch('https://api.appizer.com/v1/events/batch', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
events: [
{
event_name: 'page_view',
user_id: 'user_123',
properties: { page: '/dashboard' }
},
{
event_name: 'button_click',
user_id: 'user_123',
properties: { button_id: 'cta_button' }
}
]
})
});
const data = await response.json();
console.log(data);
Python
import requests
response = requests.post(
'https://api.appizer.com/v1/events/batch',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'events': [
{
'event_name': 'page_view',
'user_id': 'user_123',
'properties': {'page': '/dashboard'}
},
{
'event_name': 'button_click',
'user_id': 'user_123',
'properties': {'button_id': 'cta_button'}
}
]
}
)
print(response.json())
cURL
curl -X POST https://api.appizer.com/v1/events/batch \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
{
"event_name": "page_view",
"user_id": "user_123",
"properties": {"page": "/dashboard"}
},
{
"event_name": "button_click",
"user_id": "user_123",
"properties": {"button_id": "cta_button"}
}
]
}'
Error Responses
| Status Code | Description |
|---|
| 400 | Bad Request - Invalid request body, missing required fields, or too many events |
| 401 | Unauthorized - Invalid or missing API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Something went wrong on our end |
Rate Limits
- 100 requests per minute
- Maximum 100 events per batch
Best Practices
- Use batch tracking for better performance when tracking multiple events
- Group events from the same user session
- Don't exceed 100 events per batch
- Handle partial failures gracefully
- Implement retry logic for failed batches