Generate targeting
curl --request POST \
--url https://fandom-api-preview.vercel.app/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://fandom-api-preview.vercel.app/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://fandom-api-preview.vercel.app/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://fandom-api-preview.vercel.app/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://fandom-api-preview.vercel.app/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://fandom-api-preview.vercel.app/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
An API key from Settings → API access, starting with fnd_.
Headers
Any unique string. Repeating a request with the same key returns the first result instead of doing it twice.
Maximum string length:
200Path Parameters
Campaign id.
Pattern:
^[a-f0-9]{24}$Body
application/json
Audience slots on the campaign (the id in Get targeting).
Maximum array length:
25Required string length:
1 - 200
