Create an Experiment
1 min
POST
https://api.optimizely.com/v2/experiments
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.</p>
acceptstringGenerated from available response content types
bodyobjectA string in JSON format that includes all the fields to create an Experiment
201Return the created Experiment
400Invalid request body content
defaultUnexpected error
curl --request POST \
--url https://api.optimizely.com/v2/experiments \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"audience_conditions": "everyone",
"changes": [
{
"type": "",
"value": "window.someGlobalFunction();"
}
],
"metrics": [
{
"metrics": [
{
"aggregator": "unique",
"scope": "visitor"
}
]
}
],
"project_id": 1000,
"schedule": {
"time_zone": "UTC"
},
"type": "a/b",
"url_targeting": {
"edit_url": "https://www.optimizely.com"
},
"variations": [
{
"actions": [
{
"changes": [
{
"type": ""
}
],
"page_id": ""
}
],
"weight": ""
}
],
"whitelist": [
{
"user_id": "user_1",
"variation_id": 12345
}
]
}'