Skip to main content

Get Experiment Preview URLs

GET/v2/project/{project_key}/experiment/{test_id}/preview-urls

Return ready-to-share preview links for every variant of an experiment — Control plus all treatments. Each link forces the requested variant to render regardless of the visitor's normal bucketing or any active segment rules. Useful for QA, customer-support flows, or stakeholder review before launch.

Path parameters

ParameterTypeDescription
project_keystringYour project key (the key= value in the Mida script tag).
test_idintegerNumeric experiment ID. Get this from List Experiments.

Example

curl "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/1234/preview-urls" \
-H "Authorization: Bearer YOUR_GENERATED_API_KEY"

Success response

{
"success": true,
"test_id": 1234,
"test_name": "Homepage CTA Button Color Test",
"page_url": "https://example.com/",
"variants": [
{
"variant_id": 0,
"name": "Control",
"preview_url": "https://example.com/?test-preview=1234&test-variant=0"
},
{
"variant_id": 1,
"name": "Variant 1",
"preview_url": "https://example.com/?test-preview=1234&test-variant=Variant_1"
}
]
}

Response fields

FieldTypeDescription
test_idintegerThe experiment's ID
test_namestringExperiment display name
page_urlstringThe page URL the experiment runs on (taken from test.url, falling back to the first key in test.data)
variantsarrayOne entry per variant — Control first, treatments after
variants[].variant_idinteger0 for Control, 1+ for treatments
variants[].namestringVariant name (e.g. Control, Variant 1)
variants[].preview_urlstringFull URL — open it in any browser to render that specific variant

How the preview URL works

Each link appends two query parameters to the experiment's page URL:

ParameterValue
test-previewThe numeric test_id
test-variant0 for Control, or the treatment name with spaces replaced by _ (for example Variant 1 becomes Variant_1)

When the Mida script loads on a page with these parameters, it bypasses normal traffic allocation, segment rules, and country/device targeting, then renders the requested variant directly. Control is rendered through the experiment's control_attr and is always available as variant_id=0.

Treatment tokens are based on the fixed API variant name, not the nickname:

Variant namePreview token
Control0
Variant 1Variant_1
Variant 12Variant_12

Base URL rules

A/B tests and personalization previews use the experiment URL as the base URL. If the experiment URL contains wildcards, replace them with concrete path values before opening the preview link.

For split URL tests, the Control preview uses the experiment URL. Treatment previews use the treatment redirect URL from variants[].data[0].url.

Preview session

The Mida script must be installed on the previewed page. Preview state persists in sessionStorage and window.name for the same tab; close the tab or clear sessionStorage to exit preview mode.

Error responses

StatusMeaning
400test_id missing or non-numeric
401Invalid or missing API key
403Project is inactive
404Experiment not found in this project (or already deleted)
409Experiment has no page URL configured — cannot build a preview link. Set url via Update Experiment.
Next step

Send the Control + Variant URLs to your customer or QA team. They'll see the exact rendering Mida produces in the live experiment, without having to be in the test's traffic bucket.