Campaign Example
The following is an example of the JSON data structure of a Campaign. Additional details about the individual attributes of Campaigns can be found below.JSON
Campaign Attributes
nameCurrently read-only. The Campaign name, set by the advertiser.
advertiserIdRead-only. The advertiser associated with the Campaign.
goalThe marketing goal of the Campaign. Can be
Acquisition, Retention or Unspecified (only for older campaigns).
spendLimit.spendLimitTypeWhether the Campaign spend is capped or not. Can be
capped or uncapped.
spendLimit.spendLimitRenewalThe cadence of spend limit renewal. Can be
daily, monthly, lifetime, or undefined. The value undefined is only returned for an uncapped spend limit.
spendLimit.spendLimitAmountA decimal value representing the spend limit for the Campaign in the advertiser’s currency. It is required when
spendLimitType is capped. If spendLimitType is uncapped, the value is null. In PATCH requests, set it to null when switching a Campaign to uncapped.
budgetAutomation.enabledWhether Campaign-level budget automation is active. To enable budget automation, set this field to
true and provide a valid budgetConfiguration. If omitted, it defaults to false.
budgetAutomation.budgetConfiguration.adSetObjectivesThe optimization objective used by budget automation. Can be
conversions, revenue, visits, or videoViews. This field is required when budgetAutomation.enabled is true.
Create a campaign
A new campaign can be created for a specific advertiser by making aPOST call to the Campaign’s endpoint.The request body should specify the type (
Campaign) and the campaign attributes.
Spend LimitIf
spendLimitType is capped, both spendLimitRenewal and spendLimitAmount are required.
If spendLimitType is uncapped, omit spendLimitRenewal and spendLimitAmount from the request. The response returns spendLimitRenewal as undefined and spendLimitAmount as null.GoalThe field goal is mandatory and can be either Acquisition or Retention.Budget Automation
budgetAutomation is optional.
To create a Campaign with budget automation enabled, set enabled to true and provide budgetConfiguration.adSetObjectives.
If budgetAutomation is omitted, the Campaign is created with budget automation disabled.JSON
Campaign) and the Campaign attributes of the new Campaign.
Searching Campaigns
Retrieving Campaigns by Filtering
Campaigns can be retrieved by specifying filters to apply to the set of all campaigns in your portfolio. Using filters, you can restrict the returned results to particularadvertiserIds or specific campaignIds. Filters can be combined.
For example, to retrieve the Campaigns in your portfolio related to a particular advertiser, filter by advertiserIds:
Sample request
JSON
JSON
Retrieving All Campaigns
When no filters are specified in the JSON payload, all campaigns in your portfolio will be returned, as in the example below:Retrieving One Specific Campaign
You can also fetch the details for a single Campaign using aGET request:
Sample response
The response data will be a single object containing the Campaign details.
JSON
Update Campaigns
The fields of one or more Campaigns can be updated by making aPATCH call to the Campaigns endpoint. The payload should be an array of partial or whole Campaigns, each specifying the fields to be modified.
For example, the following call would update the spendLimit settings of an existing Campaign:
Sample request
JSON
data.These will contain only two parameters,
type and id.
JSON
Partial Success / Partial Failure
Each Campaign update is processed individually and can succeed or fail without impacting other updates in the same payload. As a result, those Campaign updates processed successfully will be returned in thedata array of the response, while Campaign updates that have failed will return as an entry in the errors array of the response.
For instance, for this payload which intends to update two Campaigns:
Sample request
JSON
JSON
Error
instanceThe instance field for validation errors will specify the index of the related update, beginning with index 0. For the example above, @data/1 refers to the second requested update in the request’s data array.In addition to general API errors , you may encounter validation errors when updating a Campaign. Below is a list of error codes for Campaign validation and a more detailed description of their meaning.
Validation Errors and Warnings
Campaign Update Errors:campaign--campaign-update-check--spend-limit-does-not-existAn update to spend limit was attempted on a Campaign which does not have a spend limit (e.g. an uncapped Campaign). Alternatively, the requestor may not have permissions to update the spend limit of the Campaign.
campaign--campaign-update-check--cannot-decrease-lifetime-spend-limit-below-what-is-already-spentAn update attempted to decrease a lifetime spend limit of a Campaign to a value lower than what has already been spent.
campaign--campaign-update-check--validation-failed-on-spend-limitTK
campaign--campaign-update-check--cannot-update-same-campaign-multiple-timesThe Campaign is included multiple times in the same update payload. All Campaign field updates should be consolidated into one array item.
campaign--campaign-update-check--unavailable-feature-for-this-advertiserTK Campaign Update Warnings:
campaign--campaign-update-check--new-spend-limit-amount-will-take-place-at-the-next-period-startThe update to spend limit was processed, but it will not take effect until the next period specified by
spendLimitRenewal (e.g. the next day). This is typically because the new spend amount specified is lower than the amount already spent in the current period.