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
Đối tượng
Liệt kê các phân khúc đối tượng trên tài khoản quảng cáo Snapchat, kèm loại, quy mô và việc một lượt boost đã có thể nhắm tới từng phân khúc hay chưa.
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"
}
Liệt kê các phân khúc đối tượng trên tài khoản quảng cáo Snapchat: danh sách khách hàng của bạn, khách truy cập trang web mà Snap Pixel ghi nhận, và lookalike. Dùng các id trong
targeting.audiences hoặc targeting.excludedAudiences khi bạn boost một Snap.
- Các phân khúc được tạo trong Snapchat Ads Manager cũng được liệt kê, không chỉ những phân khúc được tạo qua Ayrshare.
status.readylàtruekhi Snapchat cho biết một lượt boost có thể nhắm tới phân khúc. Phân khúc có quá ít người được khớp thì chưa sẵn sàng (TOO_FEW_USERS).sizelà số người được khớp do chính Snapchat đếm, được gửi dưới dạng cảlowervàupper.- Kết quả không được lưu cache: quy mô và trạng thái sẵn sàng của phân khúc thay đổi trong khi nó được lấp đầy.
- Snapchat tự đặt kích thước trang, nên
limitkhông có tác dụng ở đây.
Tham số Header
Tham số truy vấn
ID tài khoản quảng cáo Snapchat của bạn có các phân khúc cần liệt kê, ví dụ
5a0d0000-0000-4000-8000-000000000003.Khi phản hồi có
meta.pagination.hasMore: true, gửi giá trị meta.pagination.next của nó vào đây để lấy trang tiếp theo. Giữ nguyên các tham số khác: giá trị next từ một yêu cầu khác sẽ trả về code: 101.Phản hồi
Mỗi đối tượng có:id: id phân khúc dùng khi boost, thêm người hoặc xóa.name: tên hiển thị trong Ads Manager.type:customerList,website,lookalike, hoặcothercho loại phân khúc mà Ayrshare không tạo.size:{ lower, upper }, cả hai đều là số đếm của Snapchat, hoặcnullkhi Snapchat không báo số nào.status:{ ready, code, description }.readylàtruekhi một lượt boost có thể nhắm tới phân khúc ngay bây giờ.codeluôn lànull.descriptionlà trạng thái của Snapchat:READY,NOT_READYhoặcTOO_FEW_USERS.created: thời điểm phân khúc được tạo, theo ISO 8601, hoặcnull.
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"
}