Ads

Create campaign

Promote a published Page post as a paused campaign.

POSThttps://app.tryadeli.com/api/v1/ads/campaigns
AuthorizationBearer <API key>How keys work

Promotes a post the connected Page already published, creating a campaign, ad set, creative and ad. Everything is created paused. Nothing delivers and nothing spends until you activate it, which is a separate call.

An Idempotency-Key header is required. This is the only endpoint in the API where a retry has a cost, so the same key replays the original result rather than creating a second campaign: 200 with the same object ids when the campaign was built, 409 campaign_create_failed with the original reason when it failed, and 409 campaign_create_in_progress while it is still being created. To retry a failed create, send a new key.

Body

adAccountIdstringRequired
The ad account to create in.
pagePostIdstringRequired
The post id alone; the Page half of Meta's story id is server-derived.
dailyBudgetnumberRequired
Whole currency units, as Meta expects: 25 means 25.00.
startDatedateRequired
YYYY-MM-DD.
endDatedateRequired
YYYY-MM-DD, on or after startDate.
campaignNamestringRequired
Shown in Ads Manager.

Responds 201 with the created object ids, Adeli's campaign record (its id is the campaignRecordId used by Activate, pause or resume), and a preview when Meta returns one: Meta's body markup, plus the url, width and height of the facebook.com preview page it wraps. Embed url in an iframe that allows scripts; the page renders blank without them. If a step fails, Adeli deletes what it already created and responds 502 campaign_create_failed with the failing step and any orphanedObjectIds it could not remove — those are paused, so they cost nothing, but they are named so you can find them in Ads Manager.