v4

latestOpenAPI 3.0.02026-08-04109113304.5 KB
Campaigns

List Campaigns

Get a list of all the Campaigns in a Project

get/campaigns

Query parameters

per_pageinteger

Optional pagination argument that specifies the maximum number of objects to return per request

pageinteger

Optional pagination argument that specifies the page to return. If you have 140 objects and you choose to return 100 objects per page you will be able to access the last 40 objects on page 2. The default value is 1.

project_idinteger required

The Project ID of the Project you would like to list all Campaigns for

for_journeyboolean

Filter campaigns by journey status

archivedboolean

Filter campaigns by archived status

Response

Return all Campaigns

archivedboolean

Whether the Campaign has been archived

createdstring date-time

The time the Campaign was initially created

custom_field_valuesobject

Map of custom field api_name to value for this Campaign. Keys correspond to the api_name of a custom field definition for the Project, and values are typed according to that definition's field_type. Returns an empty object when no values are set.

descriptionstring

The description or goal for a Campaign

earlieststring date-time

The first time the Campaign was activated

for_journeyboolean

Whether the Campaign has been part of journey or not

holdbackinteger

Percentage of visitors to exclude from personalization, measured in basis points. 100 basis points = 1% traffic. For example, a value of 500 would mean that 95% of visitors will see a personalized experience and 5% will see the holdback.

idinteger

The unique identifier for the Campaign

journey_idstring

The journey this campaign is associated with, or null if not set

last_modifiedstring date-time

The last time the Campaign was modified

lateststring date-time

The last time the Campaign was paused (not present if the Campaign still running)

namestring

The name of the Campaign

page_idsinteger[]

A list of Page IDs used in the Campaign

project_idinteger required

The Project ID the Campaign is in

status'not_started' | 'running' | 'paused' | 'archived'

Current state of the Campaign. not_started means the Campaign has never been published to the world. running means the Campaign is currently live to the world. paused means the Campaign has been published, but is currently not running. archived means the Campaign is paused and not visible in the web UI.

type'personalization' | 'other'

Indicates the type of this campaign. Campaigns created or fetched via the API should currently all have a type of personalization, but if you get a campaign_id for an experiment and look it up, you may get an other value.

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
    }
  }
]