Segments & environments API
Segments are reusable, named audiences that flag rules can reference. Environments (e.g. production, staging) scope flag behavior. All endpoints require the management key vsk_live_….
Base URL: https://statskit.ai/api/v1
Segments
Section titled “Segments”List segments
Section titled “List segments”GET /segments
Scoped to an environment via ?env=.
curl "https://statskit.ai/api/v1/segments?env=production" \ -H "Authorization: Bearer vsk_live_..."Create a segment
Section titled “Create a segment”POST /segments
Define a segment by clause-based rules and/or included/excluded keys, then reference it from flag targeting.
curl -X POST https://statskit.ai/api/v1/segments \ -H "Authorization: Bearer vsk_live_..." \ -H "Content-Type: application/json" \ -d '{ "key": "beta_users", "name": "Beta users", "env": "production", "rules": [ { "clauses": [ { "attribute": "beta", "op": "in", "values": ["true"] } ] } ] }'Update a segment
Section titled “Update a segment”PATCH /segments/:key
curl -X PATCH https://statskit.ai/api/v1/segments/beta_users \ -H "Authorization: Bearer vsk_live_..." \ -H "Content-Type: application/json" \ -d '{ "name": "Beta cohort" }'Delete a segment
Section titled “Delete a segment”DELETE /segments/:key
Scoped to an environment via ?env=.
curl -X DELETE "https://statskit.ai/api/v1/segments/beta_users?env=production" \ -H "Authorization: Bearer vsk_live_..."Environments
Section titled “Environments”List environments
Section titled “List environments”GET /environments
curl https://statskit.ai/api/v1/environments \ -H "Authorization: Bearer vsk_live_..."Create an environment
Section titled “Create an environment”POST /environments
| Field | Type | Notes |
|---|---|---|
key | string | Stable environment key |
name | string | Display name |
curl -X POST https://statskit.ai/api/v1/environments \ -H "Authorization: Bearer vsk_live_..." \ -H "Content-Type: application/json" \ -d '{ "key": "staging", "name": "Staging" }'