Update an Experiment
1 min
PATCH
https://api.optimizely.com/v2/experiments/{experiment_id}
experiment_idinteger<int64>The Experiment ID of the Experiment you want to change
actionstring<p>Action to change the state of the experiment. <code>publish</code> saves and stages your experiment. If you have not started your experiment or the experiment is paused, your changes will not be visible to visitors when you publish. <code>start</code> makes your experiment live to all visitors who are in your targeted audience and changes the status to <code>running</code>. <code>pause</code> stops the experiment and changes the status to <code>paused</code>. No new visitors will see a <code>paused</code> experiment until you restart it. See <a href="https://help.optimizely.com/Get_Started/Differences_among_publish%2C_start%2C_and_pause" target="_blank">Differences among publish, start, and pause</a> for details. <code>resume</code> resumes the experiment from a paused status without publishing any new changes. Status will be <code>running</code>. <code>unarchive</code> unarchives an archived experiment. Status will be <code>paused</code>.</p>
acceptstringGenerated from available response content types
bodyobject<p>A string in JSON format that includes all the fields you'd like to change for an Experiment except when action=unarchive then set the payload as an empty JSON object ie. {}</p>
200Successfully updated Experiment
401Invalid credentials
403You do not have permission to update the specified Experiment
404Experiment not found
409<p>Experiment edit conflict: there are changes currently drafted on the Experiment. Provide "override_changes" parameter to force an update.</p>
500Internal server error
defaultUnexpected error
curl --request PATCH \
--url https://api.optimizely.com/v2/experiments/{experiment_id} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"changes": [
{
"type": "",
"value": "window.someGlobalFunction();"
}
],
"metrics": [
{
"metrics": [
{
"aggregator": "unique",
"scope": "visitor"
}
]
}
],
"url_targeting": {
"edit_url": "https://www.optimizely.com"
},
"variations": [
{
"actions": [
{
"changes": [
{
"type": ""
}
],
"page_id": ""
}
],
"weight": ""
}
],
"whitelist": [
{
"user_id": "user_1",
"variation_id": 12345
}
]
}'