Add or remove targeting
curl --request PATCH \
--url https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audienceId": "aud-ent-6524f0c1e4b0a1b2c3d4e5f6",
"add": [
{
"section": "keywords",
"text": "building sets for kids",
"matchType": "PHRASE"
}
],
"remove": [
{
"section": "adAffinities",
"text": "Travel"
}
]
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
audienceId: 'aud-ent-6524f0c1e4b0a1b2c3d4e5f6',
add: [{section: 'keywords', text: 'building sets for kids', matchType: 'PHRASE'}],
remove: [{section: 'adAffinities', text: 'Travel'}]
})
};
fetch('https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting"
payload = {
"audienceId": "aud-ent-6524f0c1e4b0a1b2c3d4e5f6",
"add": [
{
"section": "keywords",
"text": "building sets for kids",
"matchType": "PHRASE"
}
],
"remove": [
{
"section": "adAffinities",
"text": "Travel"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"added": 123,
"updated": 123,
"removed": 123,
"audience": {
"id": "<string>",
"name": "<string>",
"audienceId": "<string>",
"status": "not_generated",
"error": "<string>",
"updatedAt": "<string>",
"items": [
{
"section": "<string>",
"label": "<string>",
"text": "<string>",
"matchType": "<string>",
"source": "<string>"
}
]
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}Targeting
Add or remove targeting
The app’s Add and Delete for one audience. Removed terms come out of Google Ads on the next sync. Not allowed while the audience is generating.
Scope: campaigns:write.
Send an Idempotency-Key header to make retries safe.
PATCH
/
campaigns
/
{campaignId}
/
targeting
Add or remove targeting
curl --request PATCH \
--url https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audienceId": "aud-ent-6524f0c1e4b0a1b2c3d4e5f6",
"add": [
{
"section": "keywords",
"text": "building sets for kids",
"matchType": "PHRASE"
}
],
"remove": [
{
"section": "adAffinities",
"text": "Travel"
}
]
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
audienceId: 'aud-ent-6524f0c1e4b0a1b2c3d4e5f6',
add: [{section: 'keywords', text: 'building sets for kids', matchType: 'PHRASE'}],
remove: [{section: 'adAffinities', text: 'Travel'}]
})
};
fetch('https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting"
payload = {
"audienceId": "aud-ent-6524f0c1e4b0a1b2c3d4e5f6",
"add": [
{
"section": "keywords",
"text": "building sets for kids",
"matchType": "PHRASE"
}
],
"remove": [
{
"section": "adAffinities",
"text": "Travel"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"added": 123,
"updated": 123,
"removed": 123,
"audience": {
"id": "<string>",
"name": "<string>",
"audienceId": "<string>",
"status": "not_generated",
"error": "<string>",
"updatedAt": "<string>",
"items": [
{
"section": "<string>",
"label": "<string>",
"text": "<string>",
"matchType": "<string>",
"source": "<string>"
}
]
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>",
"requestId": "<string>"
}
}Authorizations
Headers
Body
application/json

