curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "type": "lookalike", "name": "Like my subscribers", "seedAudienceId": "8c1e2f3a-0000-4000-8000-000000000101", "countries": ["US", "GB"], "similarity": "balance"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
type: "lookalike",
name: "Like my subscribers",
seedAudienceId: "8c1e2f3a-0000-4000-8000-000000000101",
countries: ["US", "GB"],
similarity: "balance"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'type': 'lookalike',
'name': 'Like my subscribers',
'seedAudienceId': '8c1e2f3a-0000-4000-8000-000000000101',
'countries': ['US', 'GB'],
'similarity': 'balance'
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"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-02T12:00: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": "ratio is not a recognised field."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "event is required on snapchat: one of APP_INSTALL, PURCHASE, ..."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Snapchat's reason"
}
Snapchat Ads
创建受众
创建 Snapchat 客户名单、网站或类似受众细分,在通过 Ayrshare 推广 Snap 时包含或排除。
POST
/
ads
/
snapchat
/
audiences
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "type": "lookalike", "name": "Like my subscribers", "seedAudienceId": "8c1e2f3a-0000-4000-8000-000000000101", "countries": ["US", "GB"], "similarity": "balance"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
type: "lookalike",
name: "Like my subscribers",
seedAudienceId: "8c1e2f3a-0000-4000-8000-000000000101",
countries: ["US", "GB"],
similarity: "balance"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'type': 'lookalike',
'name': 'Like my subscribers',
'seedAudienceId': '8c1e2f3a-0000-4000-8000-000000000101',
'countries': ['US', 'GB'],
'similarity': 'balance'
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"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-02T12:00: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": "ratio is not a recognised field."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "event is required on snapchat: one of APP_INSTALL, PURCHASE, ..."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Snapchat's reason"
}
在 Snapchat 广告账户上创建受众细分。支持三种类型,通过
Snapchat 不支持
Snapchat 类似受众没有规模百分比:
type 选择:
customerList:你自己的人员名单,通过受众成员以哈希标识符填充。website:你的 Snap Pixel 在你的网站上记录到触发某个事件的人。lookalike:你指定国家中与你某个客户名单里的人相似的人。
audience 下返回,格式与受众相同,且 status.ready: false。Snapchat 会随时间填充它。列出细分以查看 status.ready 何时变为 true,然后在推广 Snap时,在 targeting.audiences 或 targeting.excludedAudiences 中使用其 id。
- Snapchat 匹配到足够多的人后,推广即可定位该细分。在此之前,
status.ready为false。 - 一个广告账户最多可有 1,000 个客户名单,细分名称最多 375 个字符。超出时 Snapchat 会以
code: 369拒绝。 - Snapchat 无法在此创建互动受众。
type: engagement会返回带有code: 101的400。 - 如果可能重试,请发送
idempotencyKey:使用相同键和相同请求体重试,会返回第一次的响应,而不会创建第二个细分。
请求头参数
请求体参数
客户名单
没有其他字段。名单初始为空,并会保留人员,直到你将其移除。customerFileSource 为可选:Snapchat 名单只包含你自己的数据,因此除 USER_PROVIDED_ONLY 外的任何值都会返回 code: 101。
网站
访客必须触发过的像素事件,按 Snapchat 的拼写:
PAGE_VIEW、VIEW_CONTENT、ADD_CART、START_CHECKOUT、PURCHASE、SIGN_UP、SUBSCRIBE、SEARCH、ADD_TO_WISHLIST、CUSTOM_EVENT_1 到 CUSTOM_EVENT_5,或其他 Snapchat 像素事件。在 Snapchat 上为必填。urlContains:Snapchat 的网站细分只按像素事件保留人员,因此会返回 code: 101。
类似受众
用于查找相似人群的客户名单(受众中的
type: customerList)。Snapchat 只能基于客户名单创建类似受众,因此不是你在此广告账户上的客户名单的种子(其他类型的细分、其他账户的细分或已删除的细分)会返回 code: 101。ratio 和 allowInternationalSeeds 会返回 code: 101。
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "type": "lookalike", "name": "Like my subscribers", "seedAudienceId": "8c1e2f3a-0000-4000-8000-000000000101", "countries": ["US", "GB"], "similarity": "balance"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
type: "lookalike",
name: "Like my subscribers",
seedAudienceId: "8c1e2f3a-0000-4000-8000-000000000101",
countries: ["US", "GB"],
similarity: "balance"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'type': 'lookalike',
'name': 'Like my subscribers',
'seedAudienceId': '8c1e2f3a-0000-4000-8000-000000000101',
'countries': ['US', 'GB'],
'similarity': 'balance'
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"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-02T12:00: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": "ratio is not a recognised field."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "event is required on snapchat: one of APP_INSTALL, PURCHASE, ..."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Snapchat's reason"
}