Retrieve Running Experiments
Retrieve all running experiments from your Storyblok space.
https://api.storyblok.com/v2/cdn/experimentsQuery parameters
Section titled “Query parameters”cvintegerCached version Unix timestamp. Learn more in the Caching concept.
tokenrequired stringA preview or public access token configured in a space.
Response properties
Section titled “Response properties”experimentsarray<Experiment>The experiments object.
Show child properties
idintegerNumeric ID of the experiment.
namestringInternal name (lowercase letters, numbers, and underscores).
display_namestringHuman-readable display name.
story_idsarray<integer>IDs of stories assigned to the experiment.
variantsarray<ExperimentVariant>Variants belonging to the experiment.
Show child properties
namestringInternal name (lowercase letters, numbers, and underscores).
display_namestringHuman-readable display name.
public_idstringPublic identifier for stable bucketing.
weightintegerTraffic weight percentage (0-100).
is_controlbooleanReturns
trueif the variant is the control.story_mappingsarray<object>Mappings between original stories and their variant copies.
Show child properties
original_story_idintegerNumeric ID of the original story.
original_slugstring | nullSlug of the original story.
variant_story_idinteger | nullNumeric ID of the variant story copy.
variant_slugstring | nullSlug of the variant story copy.
cvinteger | nullCached version Unix timestamp. Learn more in the Caching concept.
Examples
Section titled “Examples”curl "https://api.storyblok.com/v2/cdn/experiments\?token=ask9soUkv02QqbZgmZdeDAtt"// storyblok-js-client@>=7, node@>=18import Storyblok from "storyblok-js-client";
const storyblok = new Storyblok({ accessToken: "krcV6QGxWORpYLUWt12xKQtt",});
try { const response = await storyblok.get('cdn/experiments', {}) console.log({ response })} catch (error) { console.log(error)}$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
$client->get('experiments')->getBody();HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/experiments?token=ask9soUkv02QqbZgmZdeDAtt") .asString();var client = new RestClient("https://api.storyblok.com/v2/cdn/experiments?token=ask9soUkv02QqbZgmZdeDAtt");var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);import requests
url = "https://api.storyblok.com/v2/cdn/experiments"
querystring = {"token":"ask9soUkv02QqbZgmZdeDAtt"}
payload = ""headers = {}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(token: 'YOUR_TOKEN')
client.get('experiments')let storyblok = URLSession(storyblok: .cdn(accessToken: "ask9soUkv02QqbZgmZdeDAtt"))let request = URLRequest(storyblok: storyblok, path: "experiments")let (data, _) = try await storyblok.data(for: request)print(try JSONSerialization.jsonObject(with: data))val client = HttpClient { install(Storyblok(CDN)) { accessToken = "ask9soUkv02QqbZgmZdeDAtt" }}
val response = client.get("experiments")
println(response.body<JsonElement>()){"experiments": [ { "id": 501, "name": "homepage_hero_test", "display_name": "Homepage Hero Test", "story_ids": [ 371891025 ], "variants": [ { "name": "control", "display_name": "Control", "public_id": "var_abc123def456", "weight": 50, "is_control": true, "story_mappings": [ { "original_story_id": 371891025, "original_slug": "home", "variant_story_id": null, "variant_slug": null } ] }, { "name": "variant_a", "display_name": "Variant A", "public_id": "var_789ghi012jkl", "weight": 50, "is_control": false, "story_mappings": [ { "original_story_id": 371891025, "original_slug": "home", "variant_story_id": 371891777, "variant_slug": "home-variant-a" } ] } ] }],"cv": 1709500000}Was this page helpful?
This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.
Get in touch with the Storyblok community