v4
latestOpenAPI 3.0.02026-08-04109113304.5 KBCampaigns
Create a Campaign
Create a new Campaign in your account
post/campaigns
Query parameters
action'publish' | 'start'
Action to change the state of the Campaign. 'publish' publishes your campaign, making any changes live to the world. Status will be 'paused'. 'start' publishes your campaign, making any changes live to the world. Status will be 'running'.
Request body
Example request
{
"changes": [
{
"dependencies": [
"993fd09c-b64a-4c13-95a9-13b3ed2c454e",
"95cf0144-fb63-431d-829b-193fe55ada18"
],
"name": "Setting button text",
"selector": "head",
"value": "window.someGlobalFunction();"
}
],
"description": "Tailor the landing page hero element for specific audiences",
"holdback": 500,
"id": 2000,
"name": "Landing Page Optimization",
"project_id": 1000,
"url_targeting": {
"activation_code": "function callbackFn(activate, options) { activate(); }",
"activation_type": "callback",
"conditions": "[\"and\", {\"type\": \"url\", \"match_type\": \"substring\", \"value\": \"optimize\"}]",
"edit_url": "https://www.optimizely.com",
"key": "home_page",
"page_id": 6700
}
}Response
Return the created Campaign
Example response
{
"changes": [
{
"dependencies": [
"993fd09c-b64a-4c13-95a9-13b3ed2c454e",
"95cf0144-fb63-431d-829b-193fe55ada18"
],
"name": "Setting button text",
"selector": "head",
"value": "window.someGlobalFunction();"
}
],
"description": "Tailor the landing page hero element for specific audiences",
"holdback": 500,
"id": 2000,
"name": "Landing Page Optimization",
"project_id": 1000,
"url_targeting": {
"activation_code": "function callbackFn(activate, options) { activate(); }",
"activation_type": "callback",
"conditions": "[\"and\", {\"type\": \"url\", \"match_type\": \"substring\", \"value\": \"optimize\"}]",
"edit_url": "https://www.optimizely.com",
"key": "home_page",
"page_id": 6700
}
}