Experiments API
Manage A/B tests and experiments.
List Experiments
http
GET /v1/experimentsResponse:
json
{
"data": [
{
"id": "exp_123",
"key": "checkout-v2",
"status": "running",
"variants": ["control", "variant-a"],
"createdAt": "2024-01-15T10:00:00Z"
}
]
}Get Experiment
http
GET /v1/experiments/:keyResponse:
json
{
"data": {
"id": "exp_123",
"key": "checkout-v2",
"status": "running",
"variants": [
{ "key": "control", "weight": 50 },
{ "key": "variant-a", "weight": 50 }
],
"metrics": ["conversion_rate", "revenue"],
"results": {
"control": { "conversion": 0.12, "sampleSize": 5000 },
"variant-a": { "conversion": 0.15, "sampleSize": 4800 }
}
}
}Create Experiment
http
POST /v1/experimentsRequest:
json
{
"key": "checkout-v2",
"description": "Test new checkout flow",
"variants": [
{ "key": "control", "weight": 50 },
{ "key": "variant-a", "weight": 50 }
],
"metrics": ["conversion_rate"]
}Start Experiment
http
POST /v1/experiments/:key/startStop Experiment
http
POST /v1/experiments/:key/stopGet Variant
http
POST /v1/experiments/:key/variantRequest:
json
{
"userId": "user-123"
}Response:
json
{
"data": {
"variant": "variant-a",
"experimentId": "exp_123"
}
}