AthenousDevelopers

Ads

A campaign contains ad sets. An ad set contains ads. Create each one in Athenous, then publish in that order. A key limited to athenous_post receives 403. Field limits are in the ad field tables.

Order

  1. Connect the network in the app with purpose Ads. Copy connectorId. List ad accounts with GET /api/v1/connectors/ad-accounts?platform=META (use the platform id you will publish).
  2. POST /api/v1/campaigns, then POST /api/v1/campaigns/{id}/publish.
  3. POST /api/v1/campaigns/{campaignId}/ad-sets, then publish that ad set.
  4. POST …/ad-sets/{adSetId}/ads, then publish that ad.
  5. Pull numbers with POST …/sync on the campaign, ad set, or ad. The body is platform and connectorId.

Campaign and ad set status: DRAFT, SCHEDULED, ACTIVE, PAUSED, COMPLETED, ARCHIVED. Ad status: DRAFT, ACTIVE, PAUSED, ARCHIVED. Push local edits with POST /api/v1/campaigns/{id}/push and the same platform and connectorId. Some networks do not apply a remote update. Read publications for the network’s ids and metrics.

Delete one campaign with DELETE /api/v1/campaigns/{id} (204). Delete many with POST /api/v1/campaigns/bulk-delete and {"ids":["…"]}. The response is requested and deleted.

Meta example

CID=$(curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"API campaign","platform":"META","objectiveType":"AWARENESS","budgetAllocation":{"META":5000}}' \
  | jq -r '.id')

curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns/$CID/publish" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"platform":"META","connectorId":"CONNECTOR_UUID","adAccountId":"act_123","facebookPageId":"123456"}'

ASID=$(curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns/$CID/ad-sets" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Prospecting","dailyBudget":50,"objectiveType":"AWARENESS"}' \
  | jq -r '.id')

curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns/$CID/ad-sets/$ASID/publish" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"platform":"META","connectorId":"CONNECTOR_UUID","adAccountId":"act_123","facebookPageId":"123456"}'

ADID=$(curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns/$CID/ad-sets/$ASID/ads" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Hero","headline":"March update","bodyText":"Hello","imageUrl":"https://storage.googleapis.com/your-bucket/hero.jpg","ctaLabel":"Learn More","ctaLink":"https://example.com"}' \
  | jq -r '.id')

curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns/$CID/ad-sets/$ASID/ads/$ADID/publish" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"platform":"META","connectorId":"CONNECTOR_UUID","adAccountId":"act_123","facebookPageId":"123456"}'

curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns/$CID/sync" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"platform":"META","connectorId":"CONNECTOR_UUID"}'

GET /api/v1/campaigns?includeCounts=true adds adSetCount and adCount on each campaign, plus account-wide totalConversions, totalActiveCampaigns, and statusCounts. List ads with includePublications=true to include publication rows.

Platform ids

Send platform on publish and sync. Connect an Ads account for that network first. Quora, programmatic display, connected TV, and linear TV are planning labels. Publish does not create a campaign on those networks.

platformWhat to send
METAAlso accepted as FACEBOOK or INSTAGRAM. adAccountId and, for page ads, facebookPageId.
LINKEDINadAccountId. The ad set needs objectiveType. Optional linkedinOffsiteDeliveryEnabled and linkedinPoliticalIntent.
TIKTOKAdvertiser id as adAccountId. The ad creative is a video id, img: for an image, or item: / spark: for a Spark Ad.
PINTERESTadAccountId. Ad publish can send pinId. Optional campaignBudgetOptimization and billableEvent (CLICKTHROUGH or IMPRESSION). Campaign objectiveType: AWARENESS, CONSIDERATION, VIDEO_VIEW, WEB_CONVERSION, CATALOG_SALES, VIDEO_COMPLETION.
SNAPCHATAd account id. Leave the creative id empty to build one from the ad image or video plus a Public Profile, or paste an existing creative id.
REDDITadAccountId. The ad promotes an existing Reddit post id.
GOOGLE_ADSCustomer id as adAccountId. Budget uses the GOOGLE_ADS key in budgetAllocation.
YOUTUBEYouTube video id as the creative. Put the format in facebookPageId: IN_STREAM_SKIPPABLE, BUMPER, IN_FEED, or SHORTS.
MICROSOFT_ADVERTISINGMicrosoft Advertising account. BING maps to this id.
TWITTERX Ads account. The ad needs a tweet id. Optional funding instrument on campaign publish. X maps to this id.
AMAZON_ADVERTISINGAlso AMAZON_ADS. Advertising profile as the ad account. The creative field is an ASIN, a product URL, or ASIN|SKU.
APPLE_SEARCH_ADSOrg id as the ad account. Campaign publish needs the App Store app id. The ad needs a numeric creativeId created in Apple Ads.
OPENAI_ADSadAccountId. The ad needs an image URL and a CTA link. Campaigns are created paused. Two or more campaigns can use POST /api/v1/campaigns/openai-bulk-publish with campaignIds.
SPOTIFY_ADSAudio or video asset. Image-only ads do not publish. The ad also needs a logo, a companion image, an advertiser name, a tagline, and a CTA URL.
TABOOLAAccount from the Taboola connection. An ad is an item under the campaign. Ad set publish passes the campaign id through.
OUTBRAINMarketer account. Campaign publish creates a budget and a campaign. An ad is a promoted link.
YAHOO_ADSYahoo DSP account.
ALIBABA_MARKETINGSeller session as the ad account id.
BAIDU_ADSBaidu account. An ad set is an ad group. External ids use campaignId:adgroupId.
TENCENT_ADSTencent Marketing account id.
MGIDClient id on the connection. Ads are teasers.
REVCONTENTBoosts and content items.
YANDEX_ADSYandex Direct account from the OAuth connection.
MERCADO_ADSProduct Ads advertiser from the OAuth connection.
CRITEOAdvertiser from the OAuth connection.
DV360Advertiser id. An ad set publishes as an insertion order. An ad is a draft line item.
TRADE_DESKAdvertiser id. Campaign create is supported. Ad create stays in the partner UI.
ROKU_ADSAccount id. Sync reads a 7-day metrics window. Campaign create registers a remote id until the write API is available.
GRAB_ADSConnect works. Campaign publish is blocked until Grab opens the write API.
QUORAPlanning label. Publish does not create a Quora campaign.
PROGRAMMATIC_DISPLAY, CTV, LINEAR_TVPlanning labels. Publish is blocked.

Publish body

The same body is used for campaign, ad set, and ad publish. Sync and push send only platform and connectorId.

FieldRequiredDescription
platformYesA value from the table above.
connectorIdYesAds connection.
adAccountIdUsuallyPlatform account, such as a Meta act_… id.
facebookPageIdNoMeta page, or a YouTube ad format.
objectiveTypeNoPlatform objective. Required when you publish a LinkedIn ad set.
campaignBudgetOptimizationNoPinterest campaign budget optimization.
billableEventNoPinterest CLICKTHROUGH or IMPRESSION.
dailyBudgetOverrideNoReplaces the ad set daily budget for this publish.
pinIdNoPinterest pin to promote.
linkedinOffsiteDeliveryEnabledNoLinkedIn Audience Network.
linkedinPoliticalIntentNoPOLITICAL, NOT_POLITICAL, or NOT_DECLARED.
defaultTargetingCountriesNoComma-separated ISO codes, such as US,DE.

targetingJson on the ad set is a JSON string of audience and placement options, up to 10000 characters. platformCreativeId on the ad stores a network creative. Snapchat fills it when publish builds the creative. Spotify publish uses a READY audio or video asset id.

Import, export, and OpenAI bulk

Paid plans. GET /api/v1/campaigns/export and GET /api/v1/campaigns/export/csv download the account’s campaigns. POST /api/v1/campaigns/import accepts that JSON and runs asynchronously. CSV import uses Content-Type: text/csv on POST /api/v1/campaigns/import/csv. The header row is GET /api/v1/campaigns/import/template. Limits are GET /api/v1/campaigns/import/limits.

curl -sS -X POST "https://public-api.athenous.io/api/v1/campaigns/openai-bulk-publish" \
  -H "X-Api-Key: $ATHENOUS_API_KEY" -H "Content-Type: application/json" \
  -d '{"connectorId":"CONNECTOR_UUID","adAccountId":"AD_ACCOUNT","campaignIds":["CAMPAIGN_1","CAMPAIGN_2"]}'

That call needs at least two campaign ids. One campaign uses POST /api/v1/campaigns/{id}/openai-bulk-publish with the usual publish fields and platform OPENAI_ADS.