List Campaigns
1 min
GET
https://api.optimizely.com/v2/campaigns
Query Parameters
- per_pageintegerDescriptionDefault25Maximum100
- pageintegerDescriptionDefault1
- project_idinteger<int64>requiredDescriptionFormatint64
- for_journeybooleanDescription
- archivedbooleanDescription
Responses
200
- Campaign[]
- archivedbooleanDescriptionDefaultfalse
- changesSharedCodeChange[]Description
- asyncbooleanDescription
- dependenciesstring[]Example
[ "993fd09c-b64a-4c13-95a9-13b3ed2c454e", "95cf0144-fb63-431d-829b-193fe55ada18" ]
Description - idstring<uuid>DescriptionFormatuuid
- namestringExampleDescription
- selectorstringExampleDescription
- srcstringDescription
- typestring<custom_code | custom_css>requiredDescriptionAllowedcustom_codecustom_css
- valuestringrequiredExampleDescription
- createdstring<date-time>DescriptionFormatdate-time
- custom_field_valuesmap<string, string>Description
- descriptionstringExampleDescription
- earlieststring<date-time>DescriptionFormatdate-time
- experiment_prioritiesarray[]Description
- for_journeybooleanDescriptionDefaultfalse
- holdbackintegerExampleDescriptionMinimum0Maximum10000
- idinteger<int64>ExampleDescriptionFormatint64
- journey_idstringDescription
- last_modifiedstring<date-time>DescriptionFormatdate-time
- lateststring<date-time>DescriptionFormatdate-time
- metricsMetric[]Description
- aggregatorstring<unique | count | sum | bounce | exit | ratio>DescriptionAlloweduniquecountsumbounceexitratio
- display_titlestringDescription
- event_idinteger<int64>DescriptionFormatint64
- event_propertiesMetricEventPropertiesDescription
- filterMetricFilterDescription
- combine_operatorstring<and | or>DescriptionAllowedandor
- conditionsMetricFilterCondition[]Description
- namestringDescription
- operatorstring<equal_to | not_equal_to | greater_than | greater_than_or_equal_to | less_than | less_than_or_equal_to | contains | does_not_contain>DescriptionAllowedequal_tonot_equal_togreater_thangreater_than_or_equal_toless_thanless_than_or_equal_tocontainsdoes_not_contain
- typestring<boolean | number | string>DescriptionAllowedbooleannumberstring
- valuestringDescription
- fieldstring<revenue | value>DescriptionAllowedrevenuevalue
- metricsCompoundSubMetric[]Description
- aggregatorstring<unique | count | sum>DescriptionDefaultuniqueAlloweduniquecountsum
- event_idinteger<int64>DescriptionFormatint64
- event_typestring<custom | click | pageview>DescriptionAllowedcustomclickpageview
- fieldstring<revenue | value>DescriptionAllowedrevenuevalue
- scopestring<session | visitor | event>DescriptionDefaultvisitorAllowedsessionvisitorevent
- scopestring<session | visitor | event>DescriptionAllowedsessionvisitorevent
- time_windowstringDescription
- winning_directionstring<increasing | decreasing>DescriptionAllowedincreasingdecreasing
- namestringExampleDescription
- page_idsinteger[]Description
- project_idinteger<int64>requiredExampleDescriptionFormatint64
- statusstring<not_started | running | paused | archived>DescriptionAllowednot_startedrunningpausedarchived
- typestring<personalization | other>DescriptionDefaultpersonalizationAllowedpersonalizationother
- url_targetingURLTargeting
- activation_codestringExampleDescription
- activation_typestring<immediate | manual | polling | callback | dom_changed | url_changed>ExampleDescriptionAllowedimmediatemanualpollingcallbackdom_changedurl_changed
- conditionsstringExample
[ "and", { "type": "url", "match_type": "substring", "value": "optimize" } ]Description - edit_urlstringrequiredExampleDescription
- keystringExampleDescriptionMax Length64Pattern^[a-zA-Z0-9_]+$
- page_idinteger<int64>ExampleDescriptionFormatint64
401
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
403
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
404
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
default
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
curl
curl --request GET \
--url 'https://api.optimizely.com/v2/campaigns?per_page=25&page=1&project_id=integer%3Cint64%3E' \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.optimizely.com/v2/campaigns?per_page=25&page=1&project_id=integer<int64>", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.optimizely.com/v2/campaigns?per_page=25&page=1&project_id=integer<int64>")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.optimizely.com/v2/campaigns?per_page=25&page=1&project_id=integer<int64>"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// Return all Campaigns
[
{
"archived": false,
"changes": [
{
"async": false,
"dependencies": [
""
],
"id": "",
"name": "Setting button text",
"selector": "head",
"src": "",
"type": "",
"value": "window.someGlobalFunction();"
}
],
"created": "",
"custom_field_values": "",
"description": "Tailor the landing page hero element for specific audiences",
"earliest": "",
"experiment_priorities": [
[
""
]
],
"for_journey": false,
"holdback": 500,
"id": 2000,
"journey_id": "",
"last_modified": "",
"latest": "",
"metrics": [
{
"aggregator": "",
"display_title": "",
"event_id": "",
"event_properties": {
"filter": {
"combine_operator": "",
"conditions": [
{
"name": "",
"operator": "",
"type": "",
"value": ""
}
]
}
},
"field": "",
"metrics": [
{
"aggregator": "",
"event_id": "",
"event_type": "",
"field": "",
"scope": ""
}
],
"scope": "",
"time_window": "",
"winning_direction": ""
}
],
"name": "Landing Page Optimization",
"page_ids": [
0
],
"project_id": 1000,
"status": "",
"type": "",
"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
}
}
]401
// Invalid credentials
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}403
// You do not have access to Campaigns under the specified Project
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}404
// Project not found
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}default
// Unexpected error
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}