Create an experiment
You can create an experiment from the dashboard, the REST API, or an AI agent over MCP. All three hit the same backend and produce the same experiment.
-
Open your project and go to Experiments, then New experiment.
-
Pick a type (
element,cta, ormanual), name it, and set the target URL. -
For
elementandcta, enter the CSS selector and the variant content. Add at least acontroland one variant. -
Choose the goal and the stats engine, then create. Leaving it active starts it running immediately.
POST https://statskit.ai/api/v1/experiments with a secret key.
curl -X POST https://statskit.ai/api/v1/experiments \ -H "Authorization: Bearer vsk_live_…" \ -H "Content-Type: application/json" \ -d '{ "type": "element", "name": "Hero headline test", "url": "/", "selector": "#hero h1", "goal": "signup", "statsEngine": "bayesian", "variants": [ { "key": "control" }, { "key": "b", "content": "Ship 2x faster" } ], "activate": true }'curl -X POST https://statskit.ai/api/v1/experiments \ -H "Authorization: Bearer vsk_live_…" \ -H "Content-Type: application/json" \ -d '{ "type": "cta", "name": "Signup button test", "url": "/pricing", "selector": "a.signup-btn", "variants": [ { "key": "control" }, { "key": "b", "content": "Start free trial", "href": "/signup", "bg": "#111", "color": "#fff" } ], "activate": true }'Fields
Section titled “Fields”type:element(default),cta, ormanual.name: required.url: the target URL pattern. Defaults to*(all pages).selector: a CSS selector for the element to test. Required forelementandcta.goal: the conversion event. Optional forelement/cta(actaexperiment defaults tocta_click); required formanual.statsEngine:bayesian(default) orfrequentist.variants: at least two, one withkey: "control". Per-variantcontent,href,bg, andcolorshape the override.activate: defaults totrue, which starts the experiment running. Setfalseto create it as a draft.
An AI agent connected to the StatsKit MCP server can create experiments with the create_experiment tool. It takes the same shape as the REST payload: type, name, url, selector, goal, statsEngine, and variants.
Create an element experiment named "Hero headline test" on "/" that swaps"#hero h1" to "Ship 2x faster" for variant b, goal signup, and start it.The tool returns the experiment id, key, and status so the agent can follow up with results or set status.
What you get back
Section titled “What you get back”A successful create returns the experiment id, its assignment key, the resolved type, and status (running when activate is not false, otherwise draft). Use the id to read results or to set status with POST /v1/experiments/:id.