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
- Connect the network in the app with purpose Ads. Copy
connectorId. List ad accounts withGET /api/v1/connectors/ad-accounts?platform=META(use the platform id you will publish). POST /api/v1/campaigns, thenPOST /api/v1/campaigns/{id}/publish.POST /api/v1/campaigns/{campaignId}/ad-sets, then publish that ad set.POST …/ad-sets/{adSetId}/ads, then publish that ad.- Pull numbers with
POST …/syncon the campaign, ad set, or ad. The body isplatformandconnectorId.
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.
platform | What to send |
|---|---|
META | Also accepted as FACEBOOK or INSTAGRAM. adAccountId and, for page ads, facebookPageId. |
LINKEDIN | adAccountId. The ad set needs objectiveType. Optional linkedinOffsiteDeliveryEnabled and linkedinPoliticalIntent. |
TIKTOK | Advertiser id as adAccountId. The ad creative is a video id, img: for an image, or item: / spark: for a Spark Ad. |
PINTEREST | adAccountId. Ad publish can send pinId. Optional campaignBudgetOptimization and billableEvent (CLICKTHROUGH or IMPRESSION). Campaign objectiveType: AWARENESS, CONSIDERATION, VIDEO_VIEW, WEB_CONVERSION, CATALOG_SALES, VIDEO_COMPLETION. |
SNAPCHAT | Ad 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. |
REDDIT | adAccountId. The ad promotes an existing Reddit post id. |
GOOGLE_ADS | Customer id as adAccountId. Budget uses the GOOGLE_ADS key in budgetAllocation. |
YOUTUBE | YouTube video id as the creative. Put the format in facebookPageId: IN_STREAM_SKIPPABLE, BUMPER, IN_FEED, or SHORTS. |
MICROSOFT_ADVERTISING | Microsoft Advertising account. BING maps to this id. |
TWITTER | X Ads account. The ad needs a tweet id. Optional funding instrument on campaign publish. X maps to this id. |
AMAZON_ADVERTISING | Also AMAZON_ADS. Advertising profile as the ad account. The creative field is an ASIN, a product URL, or ASIN|SKU. |
APPLE_SEARCH_ADS | Org id as the ad account. Campaign publish needs the App Store app id. The ad needs a numeric creativeId created in Apple Ads. |
OPENAI_ADS | adAccountId. 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_ADS | Audio 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. |
TABOOLA | Account from the Taboola connection. An ad is an item under the campaign. Ad set publish passes the campaign id through. |
OUTBRAIN | Marketer account. Campaign publish creates a budget and a campaign. An ad is a promoted link. |
YAHOO_ADS | Yahoo DSP account. |
ALIBABA_MARKETING | Seller session as the ad account id. |
BAIDU_ADS | Baidu account. An ad set is an ad group. External ids use campaignId:adgroupId. |
TENCENT_ADS | Tencent Marketing account id. |
MGID | Client id on the connection. Ads are teasers. |
REVCONTENT | Boosts and content items. |
YANDEX_ADS | Yandex Direct account from the OAuth connection. |
MERCADO_ADS | Product Ads advertiser from the OAuth connection. |
CRITEO | Advertiser from the OAuth connection. |
DV360 | Advertiser id. An ad set publishes as an insertion order. An ad is a draft line item. |
TRADE_DESK | Advertiser id. Campaign create is supported. Ad create stays in the partner UI. |
ROKU_ADS | Account id. Sync reads a 7-day metrics window. Campaign create registers a remote id until the write API is available. |
GRAB_ADS | Connect works. Campaign publish is blocked until Grab opens the write API. |
QUORA | Planning label. Publish does not create a Quora campaign. |
PROGRAMMATIC_DISPLAY, CTV, LINEAR_TV | Planning 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.
| Field | Required | Description |
|---|---|---|
platform | Yes | A value from the table above. |
connectorId | Yes | Ads connection. |
adAccountId | Usually | Platform account, such as a Meta act_… id. |
facebookPageId | No | Meta page, or a YouTube ad format. |
objectiveType | No | Platform objective. Required when you publish a LinkedIn ad set. |
campaignBudgetOptimization | No | Pinterest campaign budget optimization. |
billableEvent | No | Pinterest CLICKTHROUGH or IMPRESSION. |
dailyBudgetOverride | No | Replaces the ad set daily budget for this publish. |
pinId | No | Pinterest pin to promote. |
linkedinOffsiteDeliveryEnabled | No | LinkedIn Audience Network. |
linkedinPoliticalIntent | No | POLITICAL, NOT_POLITICAL, or NOT_DECLARED. |
defaultTargetingCountries | No | Comma-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.