Update ad
Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform.
Per-platform support:
- Meta (Facebook + Instagram): all fields supported.
- TikTok: status, budget, targeting (via
/v2/adgroup/update/), and creative (via/v2/ad/update/patch-style —headlineis ignored,bodybecomesad_text). - Pinterest / X / LinkedIn / Google: status + budget only. Sending
targetingorcreativereturns 501 with codeunsupported_platform_operation.
API key authentication - use your Zernio API key as a Bearer token
In: header
Path Parameters
"active" | "paused"Meta + TikTok only. Pinterest / X / LinkedIn / Google return 501.
Replace the ad's creative. Meta + TikTok only.
- Meta: requires
headline,body,callToAction,linkUrl,imageUrl. The ad's existing creative is replaced via a new/act_X/adcreativesupload + ad update. The old creative is retained on the ad account for historical reporting. - TikTok: patch-style. Pass any subset;
headlineis ignored (TikTok creatives have no headline slot).bodybecomes the in-feedad_text;linkUrlbecomeslanding_page_url;videoUrltriggers a fresh upload.
Rename the ad. Now propagated to Meta (POST /{ad-id}); non-Meta platforms return 501.
length <= 255Response Body
application/json
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.ads.updateAd({ path: { adId: 'ad_abc123', }, body: { status: 'active', budget: { amount: 0, type: 'daily', }, targeting: { ageMin: 13, ageMax: 13, countries: [ 'string', ], }, },});console.log(data);{
"ad": {
"_id": "string",
"name": "string",
"platform": "facebook",
"status": "active",
"adType": "boost",
"goal": "engagement",
"isExternal": true,
"budget": {
"amount": 0,
"type": "daily"
},
"metrics": {
"spend": 0,
"impressions": 0,
"reach": 0,
"clicks": 0,
"ctr": 0,
"cpc": 0,
"cpm": 0,
"engagement": 0,
"conversions": 0,
"costPerConversion": 0,
"actions": {
"link_click": 160,
"post_engagement": 300,
"offsite_conversion.fb_pixel_purchase": 42
},
"actionValues": {
"offsite_conversion.fb_pixel_purchase": 2456.78,
"offsite_conversion.fb_pixel_add_to_cart": 980.5
},
"purchaseValue": 0,
"roas": 0,
"lastSyncedAt": "2019-08-24T14:15:22Z"
},
"platformAdId": "string",
"platformAdAccountId": "string",
"platformCampaignId": "string",
"platformAdSetId": "string",
"campaignName": "string",
"adSetName": "string",
"platformObjective": "OUTCOME_SALES",
"optimizationGoal": "OFFSITE_CONVERSIONS",
"platformAdAccountName": "Zernio - previously Late",
"platformCreatedAt": "2019-08-24T14:15:22Z",
"bidStrategy": "LOWEST_COST_WITHOUT_CAP",
"bidAmount": 5,
"roasAverageFloor": 2,
"promotedObject": {
"custom_event_type": "PURCHASE",
"pixel_id": "string",
"page_id": "string",
"application_id": "string",
"product_set_id": "string"
},
"creative": {
"thumbnailUrl": "string",
"imageUrl": "string",
"videoId": "string",
"videoUrl": "string",
"objectType": "string",
"objectStoryId": "string",
"effectiveObjectStoryId": "string",
"effectiveInstagramMediaId": "string",
"instagramUserId": "string",
"instagramPermalinkUrl": "string",
"mediaUrls": [
"string"
],
"body": "string",
"googleHeadline": "string",
"googleDescription": "string",
"linkUrl": "string",
"pinterestImageUrl": "string",
"pinterestTitle": "string",
"pinterestDescription": "string"
},
"targeting": {},
"schedule": {
"startDate": "2019-08-24T14:15:22Z",
"endDate": "2019-08-24T14:15:22Z"
},
"rejectionReason": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
},
"message": "string"
}{
"error": "Unauthorized"
}{
"error": "Not found"
}Get ad details GET
Returns an ad with its creative, targeting, status, and performance metrics. The `{adId}` path segment accepts any identifier dialect Zernio indexes for the ad: - the Zernio internal `_id` (24-char hex) - Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`) - the creative's `effective_object_story_id` (`{pageId}_{postId}` shape, Facebook side) - the creative's `effective_instagram_media_id` (Instagram side) Any of the four resolve to the same ad. Caller doesn't need a translation step.
Cancel an ad DELETE
Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history.