Skip to main content

/i/campaign/create

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

/i/campaign/create

Overview

Creates an attribution campaign from the JSON object passed in args.

Authentication

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

Permissions

  • Attribution Create 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.
argsJSON String (Object)YesCampaign definition.

args supports:

  • _id optional custom campaign ID
  • name required campaign name
  • link optional default target URL
  • fingerprint optional boolean
  • cost optional numeric string
  • costtype optional click, install, or campaign
  • links optional per-platform link map
  • type optional campaign type
  • typedata optional type-specific object
  • postbacks optional array

Example

/i/campaign/create?api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&args={"name":"Summer 2026","link":"https://example.com/install","cost":"0.5","costtype":"click","links":{"android":"https://play.google.com/store/apps/details?id=com.example"}}

Response

Success Response

{
"result": "Success"
}

Error Responses

Status Code: 200 OK

{
"result": "Not enough args"
}

Status Code: 200 OK

{
"result": "Duplicate campaign link"
}

Behavior

  • Parses args from JSON.
  • Generates _id automatically when missing.
  • Normalizes defaults for cost, costtype, links, type, typedata, and postbacks.
  • Initializes summary counters such as aclk, clk, ins, rev, and ses.
  • If costtype=campaign, initializes totalCost with the campaign cost.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.campaignsCampaign storageInserts a new campaign document.