Signups are closed. We're building something great. Talk soon.

REST API Reference

The sessionvision REST API provides programmatic access to your analytics data. All endpoints are under https://app.sessionvision.com/api/v1/.

Authentication

Authenticate with either session cookies (from the web app) or API tokens for programmatic access. Include your API token in the Authorization header:

curl -H "Authorization: Bearer YOUR_API_TOKEN" \
  https://app.sessionvision.com/api/v1/projects/:project_id/events

Pagination

All list endpoints use cursor-based (keyset) pagination:

{
  "data": [...],
  "meta": {
    "next_cursor": "eyJ0cyI6...",
    "has_more": true
  }
}

Pass the next_cursor value as a cursor query parameter to get the next page.

Ingest

POST /api/v1/ingest/events

Accepts batched events from the SDK. Validates events and enqueues them for processing.

// Request
POST /api/v1/ingest/events
Content-Type: application/json

{
  "projectToken": "sv_pub_...",
  "events": [
    {
      "event": "$pageview",
      "timestamp": 1709856000000,
      "properties": { "$current_url": "https://example.com" },
      "anonymousId": "550e8400-...",
      "userId": null,
      "sessionId": "a1b2c3d4-..."
    }
  ]
}

// Response
{
  "status": "accepted",
  "accepted": 1,
  "rejected": 0,
  "errors": []
}

POST /api/v1/ingest/recordings

Returns a presigned URL for direct upload of recording chunks to object storage.

Persons

All person endpoints are under /api/v1/projects/:project_id/persons.

MethodPathDescription
GET/personsList persons (supports limit, cursor, search, country, device_type, browser, has_user_id filters)
GET/persons/:distinct_idGet a single person
GET/persons/:distinct_id/eventsList events for a person
GET/persons/:distinct_id/sessionsList sessions for a person

Events

MethodPathDescription
GET/eventsList events (supports limit, cursor, date_from, date_to, event, distinct_id, session_id filters)
GET/events/:event_idGet a single event

Sessions

MethodPathDescription
GET/sessionsList sessions (supports limit, cursor, date_from, date_to, distinct_id, min/max_duration, is_bounce, entry_url, country, device_type, browser filters)
GET/sessions/:session_idGet a single session
GET/sessions/:session_id/eventsList events within a session

Insights

POST /insights/trends

Time-series analysis with breakdowns.

POST /api/v1/projects/:project_id/insights/trends
Content-Type: application/json

{
  "events": [
    { "name": "$pageview", "math": "unique_persons" }
  ],
  "interval": "day",
  "date_from": "2025-01-01",
  "date_to": "2025-01-31",
  "breakdown": "$browser"
}
ParamTypeDescription
eventsarray (1-10)Events to analyze
events[].namestringEvent name
events[].mathstringtotal, unique_persons, unique_sessions, per_session
intervalstringhour, day, week, month
breakdownstringProperty to break down by
date_fromstringStart date (ISO 8601)
date_tostringEnd date (ISO 8601)

POST /insights/funnel

Multi-step conversion funnel analysis. Uses ClickHouse windowFunnel() for accurate conversion tracking.

POST /api/v1/projects/:project_id/insights/funnel
Content-Type: application/json

{
  "steps": [
    { "event": "$pageview", "properties": { "$current_url": "/pricing" } },
    { "event": "checkout_started" },
    { "event": "purchase_completed" }
  ],
  "conversion_window": "7d",
  "date_from": "2025-01-01",
  "date_to": "2025-01-31"
}

Event & Property Definitions

MethodPathDescription
GET/event_definitionsDistinct event names with volume_30d and last_seen
GET/property_definitionsProperty keys with inferred types and example values

Smart Events

MethodPathDescription
GET/action_definitionsList smart events (excludes archived by default)
GET/action_definitions/:idGet a single smart event
POST/action_definitionsCreate a smart event
PATCH/action_definitions/:idUpdate a smart event
DELETE/action_definitions/:idDelete a smart event
POST/action_definitions/:id/previewPreview matching events

Error Codes

StatusCodeDescription
400INVALID_PARAMETERInvalid or missing request parameter
401NOT_AUTHENTICATEDMissing or invalid authentication
403NOT_AUTHORIZEDInsufficient permissions
404NOT_FOUNDResource not found
422VALIDATION_ERRORRequest validation failed

Error responses follow this format:

{
  "error": "Description of what went wrong",
  "code": "INVALID_PARAMETER"
}