Skip to content

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 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.

GET /metrics

Terminal window
curl https://statskit.ai/api/v1/metrics \
-H "Authorization: Bearer vsk_live_..."

POST /metrics

FieldTypeNotes
namestringDisplay name
eventstringThe event name this metric reads
aggregationsum | mean | count | conversionHow to aggregate
directionhigher | lowerWhich direction is a win
formatstringDisplay format (e.g. currency, percent)
keystringOptional stable key
descriptionstringOptional
Terminal window
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 /metrics/:id

Terminal window
curl -X DELETE https://statskit.ai/api/v1/metrics/met_abc123 \
-H "Authorization: Bearer vsk_live_..."

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.

FieldTypeNotes
unitstringVisitor/user id the event belongs to
eventstringEvent name (matches a goal / metric)
valuenumberOptional; amount in cents for revenue
currencystringOptional
propsobjectOptional custom properties
urlstringOptional page URL
tsnumberOptional timestamp
eventIdstringOptional idempotency key
Terminal window
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" }
}'

POST /events

Batch-ingest events, used by the SDK’s server-side track(). Accepts ssk_ or vsk_.

Terminal window
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 }
]
}'