Metrics & events API
Define analysis-time metrics and send events. Metric definitions require the management key vsk_live_…. Batch event ingest accepts ssk_ or vsk_.
Base URL: https://statskit.ai/api/v1
Metrics
Section titled “Metrics”Metrics are a Statsig-style lens over your events: a metric definition names an event, an aggregation, and a direction, and experiment results are computed against it.
List metrics
Section titled “List metrics”GET /metrics
curl https://statskit.ai/api/v1/metrics \ -H "Authorization: Bearer vsk_live_..."Create a metric
Section titled “Create a metric”POST /metrics
| Field | Type | Notes |
|---|---|---|
name | string | Display name |
event | string | The event name this metric reads |
aggregation | sum | mean | count | conversion | How to aggregate |
direction | higher | lower | Which direction is a win |
format | string | Display format (e.g. currency, percent) |
key | string | Optional stable key |
description | string | Optional |
curl -X POST https://statskit.ai/api/v1/metrics \ -H "Authorization: Bearer vsk_live_..." \ -H "Content-Type: application/json" \ -d '{ "name": "Revenue per visitor", "event": "purchase", "aggregation": "sum", "direction": "higher", "format": "currency" }'Delete a metric
Section titled “Delete a metric”DELETE /metrics/:id
curl -X DELETE https://statskit.ai/api/v1/metrics/met_abc123 \ -H "Authorization: Bearer vsk_live_..."Track a single event
Section titled “Track a single event”POST /track
Send one server-side event, tied to a unit (visitor/user id). Use this for conversions you can’t fire from the browser.
| Field | Type | Notes |
|---|---|---|
unit | string | Visitor/user id the event belongs to |
event | string | Event name (matches a goal / metric) |
value | number | Optional; amount in cents for revenue |
currency | string | Optional |
props | object | Optional custom properties |
url | string | Optional page URL |
ts | number | Optional timestamp |
eventId | string | Optional idempotency key |
curl -X POST https://statskit.ai/api/v1/track \ -H "Authorization: Bearer vsk_live_..." \ -H "Content-Type: application/json" \ -d '{ "unit": "user_123", "event": "purchase", "value": 4900, "currency": "USD", "props": { "plan": "pro" } }'Batch events (SDK ingest)
Section titled “Batch events (SDK ingest)”POST /events
Batch-ingest events, used by the SDK’s server-side track(). Accepts ssk_ or vsk_.
curl -X POST https://statskit.ai/api/v1/events \ -H "Authorization: Bearer ssk_live_..." \ -H "Content-Type: application/json" \ -d '{ "events": [ { "unit": "user_123", "event": "signup" }, { "unit": "user_456", "event": "purchase", "value": 2900 } ] }'