curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences \
-d '{"accountId": "a2_abcdefg", "name": "Site visitors 30d", "type": "website", "pixelId": "t2_pixel123", "retentionDays": 30, "event": "purchase"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"id": "ca.129482487242999",
"name": "Site visitors 30d",
"type": "website",
"size": null,
"status": { "ready": false, "code": null, "description": "PENDING" },
"created": "2026-12-02T10:05:00.000Z"
}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "retentionDays on reddit is at most 90."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Reddit's reason"
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Reddit's reason"
}
Reddit Ads
建立受眾
建立由您自己的顧客名單或網站訪客組成的 Reddit 自訂受眾,用於推廣貼文時納入或排除。
POST
/
ads
/
reddit
/
audiences
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences \
-d '{"accountId": "a2_abcdefg", "name": "Site visitors 30d", "type": "website", "pixelId": "t2_pixel123", "retentionDays": 30, "event": "purchase"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"id": "ca.129482487242999",
"name": "Site visitors 30d",
"type": "website",
"size": null,
"status": { "ready": false, "code": null, "description": "PENDING" },
"created": "2026-12-02T10:05:00.000Z"
}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "retentionDays on reddit is at most 90."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Reddit's reason"
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Reddit's reason"
}
在 Reddit 廣告帳戶上建立自訂受眾。支援兩種類型,透過
在 Reddit 上不接受
type 選擇:
customerList:您自己的人員名單,透過受眾成員以雜湊識別碼填充。website:您的 Reddit 像素在您的網站上偵測到的人。
audience 下返回,status.ready: false。Reddit 會逐步填充它。列出受眾以查看 status.ready 何時變為 true,然後在推廣貼文時將其 id 用於 targeting.audiences 或 targeting.excludedAudiences。
- Reddit 無法在這裡建立互動受眾或類似受眾。傳送
type: engagement或type: lookalike會返回帶有code: 101的400。 - 受眾需要比對到至少 1,000 人,推廣才能鎖定它。
請求頭參數
請求體參數
兩種類型都接受以下參數:為每個新受眾提供一個新的唯一值,例如 UUID。如果您以相同的金鑰重複請求,Ayrshare 會返回第一次的回應,並標記
idempotentReplayed: true,不會建立第二個受眾。您也可以改為在 Idempotency-Key 標頭中傳送該金鑰;如果兩者都傳送,它們必須一致。將金鑰用於不同的請求,或在第一個請求仍在處理時重複使用該金鑰,會返回 409。503 表示無法保留該金鑰且未建立任何內容:請稍後以相同的金鑰重試。顧客名單受眾
顧客名單不需要其他必填欄位,建立時為空。請透過受眾成員新增人員。雜湊識別碼仍屬於個人資料:上傳名單前請先閱讀該頁面。 在 Reddit 上,除非customerFileSource 為 USER_PROVIDED_ONLY,否則不接受該欄位:Reddit 只接受您自己的名單。
網站受眾
僅保留觸發此事件的訪客。Reddit 的標準事件為
PAGE_VISIT、VIEW_CONTENT、SEARCH、ADD_TO_CART、ADD_TO_WISHLIST、PURCHASE、LEAD 和 SIGN_UP,大小寫皆可。任何其他值都會作為自訂事件名稱傳送。省略則計算每次造訪。urlContains:Reddit 的網站受眾沒有 URL 篩選條件。
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences \
-d '{"accountId": "a2_abcdefg", "name": "Site visitors 30d", "type": "website", "pixelId": "t2_pixel123", "retentionDays": 30, "event": "purchase"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"id": "ca.129482487242999",
"name": "Site visitors 30d",
"type": "website",
"size": null,
"status": { "ready": false, "code": null, "description": "PENDING" },
"created": "2026-12-02T10:05:00.000Z"
}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "retentionDays on reddit is at most 90."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Reddit's reason"
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Reddit's reason"
}