curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003"
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003', headers=headers)
print(r.json())
{
"status": "success",
"audiences": [
{
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"name": "Newsletter subscribers",
"type": "customerList",
"size": { "lower": 12000, "upper": 12000 },
"status": { "ready": true, "code": null, "description": "READY" },
"created": "2026-11-20T09:12:00.000Z"
},
{
"id": "8c1e2f3a-0000-4000-8000-000000000102",
"name": "Like my subscribers",
"type": "lookalike",
"size": { "lower": 0, "upper": 0 },
"status": { "ready": false, "code": null, "description": "NOT_READY" },
"created": "2026-12-01T16:40:00.000Z"
}
],
"meta": { "pagination": { "hasMore": false } }
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "accountId is required."
}
{
"action": "ads",
"status": "error",
"code": 370,
"message": "Error getting audiences. Please try again.",
"details": "Snapchat's reason"
}
Snapchat Ads
受众
列出 Snapchat 广告账户的受众细分,包括每个细分的类型、规模以及推广是否已可定位它。
GET
/
ads
/
snapchat
/
audiences
curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003"
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003', headers=headers)
print(r.json())
{
"status": "success",
"audiences": [
{
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"name": "Newsletter subscribers",
"type": "customerList",
"size": { "lower": 12000, "upper": 12000 },
"status": { "ready": true, "code": null, "description": "READY" },
"created": "2026-11-20T09:12:00.000Z"
},
{
"id": "8c1e2f3a-0000-4000-8000-000000000102",
"name": "Like my subscribers",
"type": "lookalike",
"size": { "lower": 0, "upper": 0 },
"status": { "ready": false, "code": null, "description": "NOT_READY" },
"created": "2026-12-01T16:40:00.000Z"
}
],
"meta": { "pagination": { "hasMore": false } }
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "accountId is required."
}
{
"action": "ads",
"status": "error",
"code": 370,
"message": "Error getting audiences. Please try again.",
"details": "Snapchat's reason"
}
列出 Snapchat 广告账户的受众细分:你的客户名单、Snap Pixel 记录到的网站访客,以及类似受众。推广 Snap时,在
targeting.audiences 或 targeting.excludedAudiences 中使用这些 ID。
- 在 Snapchat Ads Manager 中创建的细分也会列出,而不仅仅是通过 Ayrshare 创建的细分。
- 当 Snapchat 表示推广可以定位该细分时,
status.ready为true。已匹配人数过少的细分尚未就绪(TOO_FEW_USERS)。 size是 Snapchat 自己统计的已匹配人数,同时作为lower和upper发送。- 结果不会缓存:细分在填充过程中,其规模和就绪状态会不断变化。
- Snapchat 自行设定每页大小,因此
limit在此无效。
请求头参数
查询参数
当响应包含
meta.pagination.hasMore: true 时,将其 meta.pagination.next 值发送到这里以获取下一页。其他参数保持不变:来自其他请求的 next 值会返回 code: 101。响应
每个受众包含:id:推广、添加人员或删除时使用的细分 ID。name:在 Ads Manager 中显示的名称。type:customerList、website、lookalike,或对于 Ayrshare 不创建的细分类型为other。size:{ lower, upper },两者均为 Snapchat 的计数;Snapchat 未报告时为null。status:{ ready, code, description }。当推广现在即可定位该细分时,ready为true。code始终为null。description是 Snapchat 的状态:READY、NOT_READY或TOO_FEW_USERS。created:细分的创建时间,采用 ISO 8601 格式,或null。
curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003"
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003', headers=headers)
print(r.json())
{
"status": "success",
"audiences": [
{
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"name": "Newsletter subscribers",
"type": "customerList",
"size": { "lower": 12000, "upper": 12000 },
"status": { "ready": true, "code": null, "description": "READY" },
"created": "2026-11-20T09:12:00.000Z"
},
{
"id": "8c1e2f3a-0000-4000-8000-000000000102",
"name": "Like my subscribers",
"type": "lookalike",
"size": { "lower": 0, "upper": 0 },
"status": { "ready": false, "code": null, "description": "NOT_READY" },
"created": "2026-12-01T16:40:00.000Z"
}
],
"meta": { "pagination": { "hasMore": false } }
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "accountId is required."
}
{
"action": "ads",
"status": "error",
"code": 370,
"message": "Error getting audiences. Please try again.",
"details": "Snapchat's reason"
}