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"
}