Events API
The Events API allows you to send custom tracking data to Emp-Mix from any backend or client source.
Track Single Event
Use this endpoint to track a single user action.
Endpoint
POST /public/track
Authentication
Include your Public API Key in the JSON payload.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your Public API Key. |
| event | string | Yes | The name of the event. |
| distinct_id | string | Yes | The unique identifier of the user who triggered the event. |
| properties | object | No | Custom metadata describing the event. |
| timestamp | number | No | Epoch timestamp in milliseconds. Defaults to current server time if omitted. |
Request Example
curl -X POST "https://api.empmix.com/public/track" \
-H "Content-Type: application/json" \
-d '{
"apiKey": "YOUR_PUBLIC_API_KEY",
"event": "purchase",
"distinct_id": "user_123",
"properties": {
"price": 99.99,
"currency": "USD"
}
}'Response Example
{
"status": 1,
"error": null
}Bulk Import Events
Use this endpoint to import historical data or flush large queues of events.
Endpoint
POST /public/track/bulk
Authentication
⚠️
Privileged Endpoint
This endpoint requires your Secret Key, not your Public API Key.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your Secret Key. |
| events | array | Yes | An array of event objects. Maximum 1000 events per request. |
Request Example
{
"apiKey": "YOUR_SECRET_KEY",
"events": [
{
"event": "signup",
"distinct_id": "user_123",
"timestamp": 1672531200000,
"properties": {}
}
]
}Fetch Raw Events
Export your raw events data for external processing or backup.
Endpoint
GET /public/events
Authentication
Pass your Secret Key in the x-api-key HTTP Header.
Parameters (Query String)
| Parameter | Type | Required | Description |
|---|---|---|---|
| limit | integer | No | Number of events to return. Max 10,000. Default: 50. |
| page | integer | No | Page number for pagination. Default: 1. |
Request Example
curl -X GET "https://api.empmix.com/public/events?limit=10&page=1" \
-H "x-api-key: YOUR_SECRET_KEY"