Skip to main content

/o/campaign

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint​

/o/campaign

Overview​

Reads attribution campaigns and campaign performance data. The response shape changes based on whether the request asks for one campaign, a campaign name list, time-series data for selected campaign IDs, or a table-style campaign list.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

  • Attribution Read permission for the target app.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)Dashboard API key.
auth_tokenStringYes (or use api_key)Dashboard auth token.
app_idStringYesTarget app ID.
camp_idStringNoReturns one campaign object and attaches time-series data under data.
listBooleanNoReturns only campaign _id and name pairs for the app.
dataJSON String (Array)NoArray of campaign IDs to fetch time-series data for. Supports the organic campaign ID too.
getTableBooleanNoReturns paginated table data for campaigns.
filterStringNoTable filter. Currently campaign-hidden selects hidden campaigns; other values default to visible campaigns.
sSearchStringNoSearch text applied to campaign name in table mode.
iDisplayStartNumberNoOffset for table mode.
iDisplayLengthNumberNoRow limit for table mode.
iSortCol_0NumberNoTable sort column index.
sSortDir_0StringNoTable sort direction: asc or desc.
periodString or ArrayNoPeriod for attached campaign metric data.

Examples​

Example 1: Read one campaign with metric data​

/o/campaign?api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&camp_id=campaign-summer-2026&period=30days

Example 2: List campaign names​

/o/campaign?api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&list=true

Example 3: Fetch data for several campaigns​

/o/campaign?api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&data=["campaign-summer-2026","[CLY]_organic"]&period=30days

Example 4: Read campaign table rows​

/o/campaign?api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&getTable=true&iDisplayStart=0&iDisplayLength=20&sSearch=summer

Response​

Success Response​

Single campaign mode (camp_id):

{
"_id": "campaign-summer-2026",
"name": "Summer 2026",
"app_id": "6991c75b024cb89cdc04efd2",
"cost": 0.5,
"costtype": "click",
"aclk": 120,
"clk": 88,
"ins": 31,
"rev": 42.4,
"ses": 65,
"data": {
"2026.3.30": {
"aclk": 10,
"clk": 8
}
}
}

List mode (list=true):

[
{
"_id": "campaign-summer-2026",
"name": "Summer 2026"
}
]

Error Responses​

Status Code: 200 OK

{}

Returned for missing campaign reads in camp_id mode.

Behavior​

Behavior Modes​

ModeTriggerResponse Shape
Single campaign modecamp_id is providedOne campaign document with attached data time series.
Name list modelist is truthyArray of { _id, name } objects.
Multi-data modedata is providedArray of { _id, data } objects for the requested campaign IDs.
Table modegetTable is truthyData-table style campaign list with search, sort, and pagination behavior.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.campaignsCampaign source dataReads campaign definitions and table/list rows.
countly.campaigndataCampaign metric sourceReads period-based click/install/revenue/session metrics.