Events REST API
Track and query user events via the REST API.
Endpoints
Log Event
Track a custom event.
POST /v1/apps/:appId/events
Request Body:
{
"eventId": "evt_purchase_completed",
"userId": "user_123",
"sessionId": "session_abc",
"metadata": {
"amount": 99.99,
"currency": "USD",
"productId": "prod_123"
}
}
Example Request:
curl -X POST \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"eventId":"evt_button_clicked","userId":"user_123"}' \
https://api.getresync.com/v1/apps/7/events
Example Response:
{
"success": true,
"eventId": "evt_purchase_completed",
"timestamp": "2025-11-23T10:00:00Z"
}
Query Events
Get events for analysis.
GET /v1/apps/:appId/events
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
eventId | string | Filter by event ID |
userId | string | Filter by user ID |
startDate | string | Start date (ISO 8601) |
endDate | string | End date (ISO 8601) |
limit | number | Number of results (default: 100, max: 1000) |
Example Request:
curl -H "Authorization: Bearer your-api-key" \
"https://api.getresync.com/v1/apps/7/events?eventId=evt_purchase_completed&startDate=2025-01-01T00:00:00Z"
Example Response:
{
"data": [
{
"id": 789,
"eventId": "evt_purchase_completed",
"userId": "user_123",
"sessionId": "session_abc",
"metadata": {
"amount": 99.99,
"currency": "USD"
},
"timestamp": "2025-11-23T10:00:00Z"
}
],
"count": 1
}
Event Metadata
Include relevant context in metadata:
{
"eventId": "evt_purchase_completed",
"userId": "user_123",
"metadata": {
"amount": 99.99,
"currency": "USD",
"productId": "prod_123",
"category": "electronics",
"source": "mobile_app"
}
}
Event Retention
| Plan | Retention Period |
|---|---|
| All | 90 days |
| Enterprise | Custom |