Ads · Ad Campaigns
Edits a Google campaign's device, location, excluded location, or language targeting. Works with Google Ads.
https://api.pozy.ai/v1/ads/campaigns/{campaignId}/targetingGuide: Google Ads
Request
Send your API key as Authorization: Bearer pz_live_.... Read-only keys cannot call it. Keys with the ads resource group disabled get 403 resource_group_disabled. Authentication
Path parameters
| Name | Type | Notes |
|---|---|---|
campaignIdrequired | string |
Request body
application/json, required
platformstringrequiredOne of
google.targetingobjectrequireddevicesarray of string or objectOne of:
string
Option 2 (2 fields)
devicestringrequiredOne of
MOBILE,DESKTOP,TABLET,CONNECTED_TV.bidModifiernumberrequired
locationsarray of string or objectOne of:
array of string
Option 2 (5 fields)
countriesarray of stringregionsarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
citiesarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
zipsarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
metrosarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
languagesarray of stringexcludedLocationsarray of string or objectOne of:
array of string
Option 2 (5 fields)
countriesarray of stringregionsarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
citiesarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
zipsarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
metrosarray of string or objectOne of:
string
Option 2 (2 fields)
keystringrequirednamestring
locationTargetingTypestringOne of
presence,presence_or_interest.
Example
curl -X PUT "https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e/targeting" \
-H "Authorization: Bearer $POZY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "google",
"targeting": {
"devices": [
"MOBILE"
],
"locations": [
"string"
],
"languages": [
"string"
]
}
}'const res = await fetch("https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e/targeting", {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.POZY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
platform: "google",
targeting: {
devices: [
"MOBILE"
],
locations: [
"string"
],
languages: [
"string"
]
}
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);import os
import requests
resp = requests.put(
"https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e/targeting",
headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
json={
"platform": "google",
"targeting": {
"devices": [
"MOBILE",
],
"locations": [
"string",
],
"languages": [
"string",
],
},
},
timeout=30,
)
resp.raise_for_status()
print(resp.json())Response
200 on success
campaignIdstringadGroupIdstringupdatedarray of stringEach item: one of
devices,locations,excludedLocations,languages,locationTargetingType.locationTargetingTypestringOne of
presence,presence_or_interest. Can be null.devicesarray of objectdevicestringOne of
MOBILE,DESKTOP,TABLET,CONNECTED_TV.includedbooleanbidModifiernumberCan be null.
locationsarray of objectgeoTargetIdstringnegativebooleannamestringCan be null.
canonicalNamestringCan be null.
typestringCan be null.
countryCodestringCan be null.
excludedLocationsarray of objectgeoTargetIdstringnegativebooleannamestringCan be null.
canonicalNamestringCan be null.
typestringCan be null.
countryCodestringCan be null.
languagesarray of objectcodestringidstringnamestring
{
"campaignId": "65a3737dd8b11ea61f199e6e",
"adGroupId": "6ad180be375f36f2c328e52b",
"updated": [
"devices"
],
"locationTargetingType": "presence",
"devices": [
{
"device": "MOBILE",
"included": true,
"bidModifier": 12.5
}
],
"locations": [
{
"geoTargetId": "686554da543721f04aabf2a9",
"negative": true,
"name": "Acme",
"canonicalName": "Acme",
"type": "string",
"countryCode": "US"
}
],
"excludedLocations": [
{
"geoTargetId": "686554da543721f04aabf2a9",
"negative": true,
"name": "Acme",
"canonicalName": "Acme",
"type": "string",
"countryCode": "US"
}
],
"languages": [
{
"code": "string",
"id": "6bfebd43ddc270f6d2c56fc5",
"name": "Acme"
}
]
}Errors
Errors use one shape: { error, type, code, param?, details? }. The ones you are most likely to see here:
| 400 | invalid_request_error | A parameter or body field is missing or invalid. param names it. |
| 401 | authentication_error | The API key is missing, revoked or expired. |
| 403 | permission_error | The key is read-only, scoped to other profiles, or has this resource group disabled. |
| 404 | not_found | Nothing with that id exists in your workspace. |
| 429 | rate_limit_error | Too many requests this minute. Wait for Retry-After seconds. |
Every code is listed in Errors.