Zernio
APIFor you
Zernio
APIFor you
API Reference

Campaigns and Ads

Overview

Get campaign treeGETGet daily account metricsGET

Campaigns

List campaignsGETCreate a standalone campaignPOSTGet live campaign detailsGETUpdate a campaignPUTDuplicate a campaignPOSTDelete a campaignDELETEPause or resume a campaignPUTPause or resume many campaignsPOSTList campaign assetsGETAttach campaign assetsPOSTUpdate campaign assetsPUTRemove campaign assetsDELETERead a Google campaign's device, location, excluded location, and language targetingGETEdit a Google campaign's device, location, excluded location, or language targetingPUTRead a campaign's ad schedule (dayparting)GETReplace a campaign's ad schedule (dayparting)PUTGet campaign conversion goalsGETUpdate campaign conversion goalsPATCH

Asset Groups

List Performance Max asset groupsGETCreate a Performance Max asset groupPOSTGet a Performance Max asset groupGETUpdate a Performance Max asset groupPATCHRemove a Performance Max asset groupDELETELink or unlink asset group assetsPOSTReplace an asset group's listing-group treePUT

Ad Sets

List ad setsGETCreate a standalone ad groupPOSTGet live ad-set detailsGETUpdate an ad setPUTDuplicate an ad setPOSTDelete an ad setDELETEPause or resume a single ad setPUTList ad-group assetsGETAttach ad-group assetsPOSTUpdate ad-group assetsPUTRemove ad-group assetsDELETE

Ads

List adsGETGet ad detailsGETCreate standalone adPOSTBoost post as adPOSTUpdate adPUTDuplicate an adPOSTCancel an adDELETEPause or resume a single adPUT

Keywords

List Search keywordsGETAdd Search ad-group keywordsPOSTPause or enable a Search keywordPATCHRemove a Search keywordDELETEList campaign-level negative keywordsGETReplace campaign-level negative keywordsPUTList campaign negative listsGETReplace campaign negative listsPUT

Bidding

Read a campaign's current biddingGETList portfolio bid strategiesGETCreate portfolio bid strategyPOSTUpdate portfolio bid strategyPATCH

Recommendations

List Google Ads recommendationsGETApply Google Ads recommendationsPOSTDismiss Google Ads recommendationsPOST

Other

Create a shared budgetPOSTRead the platform's review verdict for an adGETReview status of each creative in a TikTok Smart+ adGETList shared budgetsGETReview status of every TikTok Smart+ ad of an advertiserGET
Dashboard
OverviewPlatformsAPI ReferenceResources
Campaigns and Ads

Edit a Google campaign's device, location, excluded location, or language targeting

Changes a Google campaign's device, location, excluded location or language targeting after it was created.

Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards. Send at least one of devices, locations, excludedLocations, languages, locationTargetingType; each provided field REPLACES that field's existing criteria on the campaign (a full set, not a delta). Fields left out of the body are untouched. Google only; every other platform returns 501.

devices is the full set of device bid modifiers: a supported device you leave out is switched off with a bid modifier of 0, since Google cannot remove a device criterion. A device the campaign's channel does not carry, and a set that switches every device off, both return 422.

locations accepts the same shapes as campaign creation: a bare array of ISO country codes, or an object with countries/regions/cities/zips/metros key lists (key from GET /v1/ads/targeting/search?dimension=geo). Excluded locations are left untouched by locations. An empty location list returns 400 instead of removing every criterion: a Google campaign with no location criteria targets every country, so omit locations to leave targeting alone.

excludedLocations takes the same two shapes and replaces the campaign's negative location criteria (the places it never serves in), leaving the targeted locations untouched. An empty list (or {}) removes every exclusion. Radius exclusions are not supported. A place cannot be both targeted and excluded: a request whose result would leave one on both sides returns 400 before anything is written, and moving a place from one side to the other in the same request is applied atomically. Example: { "platform": "google", "targeting": { "excludedLocations": { "countries": ["CA"], "regions": ["21137"] } } }.

The removes and the creates go out in ONE Google googleAds:mutate, so a failed edit leaves the campaign's previous set intact rather than a half-applied one.

languages is an array of Google's language codes (ISO 639-1, plus variants such as zh_CN); an unknown code returns 400.

locationTargetingType switches who the location targeting reaches: presence (people in or regularly in the locations) or presence_or_interest (also people searching for or interested in them). Example: { "platform": "google", "targeting": { "locationTargetingType": "presence" } }.

The response includes the refreshed devices/locations/excludedLocations/languages state read back from Google after the edit, and invalidates the cached copy GET on this campaign would otherwise keep serving.

Demand Gen: Google keeps a Demand Gen campaign's locations and languages on its ad groups and refuses them on the campaign. When the campaign has one ad group they are written there and the response carries its adGroupId (the campaign-level locations/languages read back then stay empty). With several ad groups the call returns 400 naming them: edit each one with PUT /v1/ads/{adId} targeting on an ad of that ad group. Campaigns migrated from Discovery that still target on the campaign keep being written there. devices and locationTargetingType stay campaign-level. excludedLocations is not available on Demand Gen yet and returns 400.


PlatformsGoogle
PUT
/v1/ads/campaigns/{campaignId}/targeting

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

In: header

Path Parameters

campaignId*string

Google platform campaign ID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response 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.adcampaigns.updateCampaignTargeting({  path: {    campaignId: 'campaign_abc123',  },  body: {    platform: 'google',    targeting: {      devices: [        'MOBILE',      ],      locations: [        'string',      ],      languages: [        'string',      ],    },  },});console.log(data);
{  "campaignId": "string",  "adGroupId": "string",  "updated": [    "devices"  ],  "locationTargetingType": "presence",  "devices": [    {      "device": "MOBILE",      "included": true,      "bidModifier": 0    }  ],  "locations": [    {      "geoTargetId": "string",      "negative": true,      "name": "string",      "canonicalName": "string",      "type": "string",      "countryCode": "string"    }  ],  "excludedLocations": [    {      "geoTargetId": "string",      "negative": true,      "name": "string",      "canonicalName": "string",      "type": "string",      "countryCode": "string"    }  ],  "languages": [    {      "code": "string",      "id": "string",      "name": "string"    }  ]}
Was this page helpful?

Read a Google campaign's device, location, excluded location, and language targeting

Shows a Google campaign's device, location, excluded location and language targeting so you can build an editor for it. Google Ads compliance requires geo, language, budget, and bidding targeting set at creation to stay editable afterwards; this reads the campaign state so an integrator can build an editor around it. Cached for the quota window (10 minutes fresh, up to 7 days last-good), not always a live read. Google only; every other platform returns 501. `devices` lists the device criteria the campaign carries, which depends on its channel: Search campaigns have MOBILE, DESKTOP and TABLET, Display campaigns also have CONNECTED_TV. `bidModifier` is Google's bid adjustment for that device, `null` when it has none, and `0` when the device is switched off; `included` is false for exactly that case. `excludedLocations` lists the campaign's negative location criteria (the places it never serves in). `locations` still lists every location criterion, each flagged with `negative`, so a client reading the targeted set filters `negative: false`.

Read a campaign's ad schedule (dayparting)

Shows the days and hours a Google campaign runs and its bid adjustments, optionally with performance by day and hour. The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them. An EMPTY `schedule` is meaningful and is not a failed lookup: Google has no "all day" criterion, so a campaign with no ad schedule serves around the clock. `servesAroundTheClock` states that explicitly. Set `includePerformance=true` to also get delivery split by day of week and by hour, which is the evidence for deciding what the schedule should be. It is one extra Google call segmented by both dimensions at once, so the two views always agree. Google Ads only. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.

platform*"google"

Value in

  • "google"
targeting*
Properties1 <= properties