- Build the filter to retrieve code-based experiments that were paused or stopped since 2026.
- Retrieve the filtered experiments using the Get all experiments endpoint.
- Identify the winning variation by retrieving the experiment results.
- Retrieve the JS and CSS code using the Get a variation endpoint.
Prerequisites
Before you use the Automation API, ensure that you have an access token. To obtain a token, see the Authentication guide.Build the filter
To filter experiments, use thefilter query parameter. Filter the experiments based on the following criteria:
status: Set toPAUSEDorSTOPPED.dateStatusModified: Set to greater than January 1, 2026.type: Set toDEVELOPER.
Example filter
Retrieve the filtered experiments
Pass the filter as a URL query parameter. Percent-encode the JSON filter before you add it to the URL.Example request
Example response
id: The experiment ID.mainGoalId: Required to retrieve the experiment results.variations: The list of variation IDs.
Find the winning variation
To identify the winning variation, complete the following steps:- Retrieve the experiment results. For more information, see Retrieve experiment results.
- Include the
mainGoalIdfrom the previous response. - Compare the
improvementRatefor each variation.
Example request
Response
After submitting the request, you will receive a data code. Use this code to retrieve the results. For more information, see the retrieve experiment results guide.Identify the winner
In the response data, locate thegoalsData for each variation ID (for example, 1199120 and 1199121), ignoring the _reference (baseline) variation.
Compare the improvementRate of each variation. The variation with the highest positive improvementRate is the winner.
In this example:
1199120has animprovementRateof 26.57.1199121has animprovementRateof -15.5.
1199120.
Retrieve the JS and CSS code
You can find experiment-level code in the following fields from your initial experiment response:commonJavaScriptCodecommonCssCodeglobalScript(custom experiment script)
Example request
Example response
Locate the code
You can find the variation-level code in the following fields:- JavaScript code:
jsCode - CSS code:
cssCode
