Events API
Send and query events via the REST API.
Send a single event
http: POST /v1/events
POST /v1/eventsjson: "type": "purchase",
{
"type": "purchase",
"data": {
"product": "Premium",
"price": 19.99
}
}Response (201):
json: "data": {
{
"data": {
"id": "...",
"type": "purchase",
"timestamp": "2024-12-15T10:32:01Z",
"data": { "product": "Premium", "price": 19.99 }
}
}Send a batch of events
http: POST /v1/events/batch
POST /v1/events/batchjson: "events": [
{
"events": [
{ "type": "purchase", "data": { "product": "A" } },
{ "type": "page.view", "data": { "path": "/pricing" } }
]
}Response (201):
json: "data": {
{
"data": {
"received": 2,
"accepted": 2,
"rejected": 0
}
}List events
http: GET /v1/projects/:projectId/events?limit=50&cursor=...&type=purchase&search=prem
GET /v1/projects/:projectId/events?limit=50&cursor=...&type=purchase&search=premiumQuery parameters:
limit: Number of events (1-100, default 50)cursor: Pagination cursor from previous responsetype: Filter by event typeuserId: Filter by user IDsearch: Search in type, user, data, and contextstartDate: ISO timestamp for start of time rangeendDate: ISO timestamp for end of time range
Response:
json: "data": [...],
{
"data": [...],
"meta": {
"nextCursor": "...",
"hasMore": true
}
}