Generate targeting
curl --request POST \
--url https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audienceIds": [
"aud-ent-6524f0c1e4b0a1b2c3d4e5f6"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({audienceIds: ['aud-ent-6524f0c1e4b0a1b2c3d4e5f6']})
};
fetch('https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting/generate', 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/generate"
payload = { "audienceIds": ["aud-ent-6524f0c1e4b0a1b2c3d4e5f6"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"campaignId": "<string>",
"campaignType": "<string>",
"audiences": [
{
"id": "<string>",
"name": "<string>",
"audienceId": "<string>",
"status": "not_generated",
"error": "<string>",
"updatedAt": "<string>",
"items": [
{
"section": "<string>",
"label": "<string>",
"text": "<string>",
"matchType": "<string>",
"source": "<string>"
}
]
}
],
"started": [
"<string>"
],
"skipped": [
{
"id": "<string>",
"reason": "<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
Generate targeting
Starts generating in the background. With no audienceIds, generates every audience that has none yet; naming an audience regenerates it. Audiences need data stores. Poll Get targeting until ready.
Scope: campaigns:write.
Send an Idempotency-Key header to make retries safe.
POST
/
campaigns
/
{campaignId}
/
targeting
/
generate
Generate targeting
curl --request POST \
--url https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audienceIds": [
"aud-ent-6524f0c1e4b0a1b2c3d4e5f6"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({audienceIds: ['aud-ent-6524f0c1e4b0a1b2c3d4e5f6']})
};
fetch('https://www.fandom.ai/api/v1/campaigns/{campaignId}/targeting/generate', 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/generate"
payload = { "audienceIds": ["aud-ent-6524f0c1e4b0a1b2c3d4e5f6"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"campaignId": "<string>",
"campaignType": "<string>",
"audiences": [
{
"id": "<string>",
"name": "<string>",
"audienceId": "<string>",
"status": "not_generated",
"error": "<string>",
"updatedAt": "<string>",
"items": [
{
"section": "<string>",
"label": "<string>",
"text": "<string>",
"matchType": "<string>",
"source": "<string>"
}
]
}
],
"started": [
"<string>"
],
"skipped": [
{
"id": "<string>",
"reason": "<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

