Quickstart: Create and Launch an Experiment
This guide walks you through the full experiment lifecycle using the Mida API — from creation to reading results. Copy-paste the curl commands and replace the placeholder values.
You'll need:
- Your Project Key — from Dashboard → Settings → API
- Your API Key — from Dashboard → Settings → API Keys
- Your region —
usoreu
Step 1 — Create the experiment
Create an experiment in status 9 (draft). The experiment is saved but not yet running.
curl --request POST \
--url "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/create-experiment" \
--header "Authorization: Bearer YOUR_GENERATED_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"test_name": "Homepage CTA Button Color Test",
"url": "https://example.com/",
"variants": [
{
"name": "Control",
"data": []
},
{
"name": "Red CTA Button",
"customCSS": ".cta-button { background-color: #FF5733 !important; color: #fff !important; }",
"customJS": "",
"data": []
}
],
"primary_goal": {
"goal_name": "CTA Button Click",
"goal_type": "clickOnElement",
"goal_value": ".cta-button"
},
"configuration": {
"traffic_allocation": 100,
"confidence_interval": 95
}
}'
Response:
{
"success": true,
"status": 9,
"test_id": 28222,
"company_id": 1001,
"goal_profile_id": 8936,
"secondary_goals_count": 0,
"warnings": []
}
Save the test_id — you'll use it in every subsequent step.
- The first variant is always the Control (the original, unmodified page). Its
dataarray must be empty. - Add one object per variant you want to test. Use
customCSSand/orcustomJSto inject changes. data: []is required on every variant (even if empty). It holds visual editor DOM changes.
Step 2 — Launch the experiment
Set status to 1 (live) to begin splitting traffic between variants.
curl --request PATCH \
--url "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/28222/status" \
--header "Authorization: Bearer YOUR_GENERATED_API_KEY" \
--header "Content-Type: application/json" \
--data '{"status": 1}'
Response:
{
"success": true,
"test_id": 28222,
"status": 1
}
The experiment is now live. Visitors to the test URL will be split between Control and your variant.
Step 3 — Check results
After visitors have arrived and conversions have been tracked, retrieve per-variant results:
curl "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/28222/result" \
-H "Authorization: Bearer YOUR_GENERATED_API_KEY"
Response:
{
"success": true,
"test_id": 28222,
"test_name": "Homepage CTA Button Color Test",
"status": 1,
"days_running": 7,
"total_visitors": 2980,
"total_conversions": 268,
"variants": [
{
"variant_id": "0",
"name": "Control",
"visitors": 1500,
"conversions": 120,
"conversion_rate": 8.0,
"is_control": true
},
{
"variant_id": "1",
"name": "Red CTA Button",
"visitors": 1480,
"conversions": 148,
"conversion_rate": 10.0,
"improvement": 25.0,
"is_control": false
}
]
}
The improvement field shows relative lift vs the control. Here, the Red CTA Button variant converts 25% better than Control.
Step 4 — Deactivate the experiment
When you have a winner, deactivate the experiment with status 0:
curl --request PATCH \
--url "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/28222/status" \
--header "Authorization: Bearer YOUR_GENERATED_API_KEY" \
--header "Content-Type: application/json" \
--data '{"status": 0}'
Setting status 0 stops data collection but preserves all results. You can restart the experiment at any time by setting status back to 1.
Common patterns
Filter results by date range
curl "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/28222/result?start_date=2024-01-15&end_date=2024-02-15" \
-H "Authorization: Bearer YOUR_GENERATED_API_KEY"
Create experiment with a pre-existing goal
If you've already created a goal and have its key, reference it directly:
--data '{
"test_name": "Pricing Page Headline Test",
"url": "https://example.com/pricing",
"variants": [
{ "name": "Control", "data": [] },
{ "name": "Variant 1", "customCSS": "h1 { font-size: 2.5rem; }", "data": [] }
],
"primary_goal_key": "cta_button_click"
}'
Create experiment and launch immediately
Pass "status": 1 in the create request to skip the draft step:
--data '{
"test_name": "Homepage Hero Test",
"status": 1,
"url": "https://example.com/",
"variants": [...]
}'
Prevent duplicate experiments (idempotency)
Pass a unique idempotency_key to safely retry without creating duplicates. Same key returns the original response for 24 hours:
--data '{
...
"idempotency_key": "deploy-2026-04-01-homepage-cta"
}'
Status codes reference
| Code | Meaning |
|---|---|
9 | Draft — saved, not running |
1 | Live — actively running |
0 | Inactive — stopped, data preserved, can be restarted |
Goal types reference
When setting a primary_goal inline, use one of these goal_type values:
goal_type | What it tracks | goal_value example |
|---|---|---|
clickOnElement | Click on a CSS selector | .buy-btn |
clickOnText | Click on an element with matching text | Add to cart |
formSubmit | Form submission | form#signup |
pageview | URL partial match | /thank-you |
pageviewExact | Exact URL match | https://example.com/thank-you |
pageviewWildcard | URL with * wildcards | /products/*/confirm |
pageviewRegex | Regex URL pattern | ^/checkout/.+/success$ |
script | Custom JS event trigger | purchase_complete |
What's next
- Create Experiment — full reference for all fields including targeting, secondary goals, and advanced configuration
- Update Experiment Status — all status transitions and constraints
- Get Experiment Result — full result response schema
- Create Goal — create reusable goals to share across experiments