Events API
The events endpoint ingests pageviews, clicks, form submissions, and custom events. This is a public endpoint — no authentication required.
Ingest Events
POST
/api/eventsIngest one or more tracking events
Accepts two payload formats: snippet (single event from the browser) and batch (multiple events from the SDK).
Snippet Format
Used by the Apex JavaScript snippet for individual browser events.
| Parameter | Type | Description |
|---|---|---|
typerequired | string | Event type: pageview, click, form_submit, or a custom event name |
visitorIdrequired | string | Anonymous visitor identifier generated by the snippet |
projectKeyrequired | string | Your Apex project key |
urlrequired | string | Full URL where the event occurred |
data | object | Arbitrary event properties (e.g. element ID, form fields, custom data) |
referrer | string | Document referrer URL |
timestamp | string | ISO 8601 timestamp. Defaults to server receipt time. |
curl -X POST https://your-instance.com/api/events \
-H "Content-Type: application/json" \
-d '{
"type": "pageview",
"visitorId": "v_abc123",
"projectKey": "pk_live_xyz",
"url": "https://example.com/pricing",
"referrer": "https://google.com"
}'
Batch Format
Used by the server-side SDK to send multiple events in a single request.
| Parameter | Type | Description |
|---|---|---|
projectKeyrequired | string | Your Apex project key |
userId | string | Known user/lead ID to associate with all events in the batch |
eventsrequired | array | Array of event objects, each with type, url, and optional data/timestamp |
curl -X POST https://your-instance.com/api/events \
-H "Content-Type: application/json" \
-d '{
"projectKey": "pk_live_xyz",
"userId": "lead_456",
"events": [
{ "type": "pageview", "url": "/pricing", "timestamp": "2025-01-15T10:30:00Z" },
{ "type": "click", "url": "/pricing", "data": { "elementId": "plan-pro" } },
{ "type": "form_submit", "url": "/signup", "data": { "plan": "pro" } }
]
}'
Response
Returns 200 OK with the count of events processed:
{ "received": 3 }
Tip
Batch events whenever possible. A single batch request counts as one request against rate limits regardless of array size.