Events API

Send and query events via the REST API.

Send a single event

http: POST /v1/events
POST /v1/events
json: "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/batch
json: "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=premium

Query parameters:

  • limit: Number of events (1-100, default 50)
  • cursor: Pagination cursor from previous response
  • type: Filter by event type
  • userId: Filter by user ID
  • search: Search in type, user, data, and context
  • startDate: ISO timestamp for start of time range
  • endDate: ISO timestamp for end of time range

Response:

json: "data": [...],
{
  "data": [...],
  "meta": {
    "nextCursor": "...",
    "hasMore": true
  }
}