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