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
Tạo đối tượng
Tạo phân khúc đối tượng Snapchat dạng danh sách khách hàng, trang web hoặc lookalike để bao gồm hay loại trừ khi boost Snap bằng Ayrshare.
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"
}
Tạo một phân khúc đối tượng trên tài khoản quảng cáo Snapchat. Hỗ trợ ba loại, chọn bằng
Lookalike của Snapchat không có tỷ lệ phần trăm quy mô:
type:
customerList: danh sách người của riêng bạn, được lấp đầy bằng định danh đã băm qua Thành viên đối tượng.website: những người mà Snap Pixel của bạn ghi nhận đã kích hoạt một sự kiện trên trang web.lookalike: những người ở các quốc gia bạn chỉ định có điểm tương đồng với người trong một danh sách khách hàng của bạn.
audience với cùng cấu trúc như Đối tượng, với status.ready: false. Snapchat lấp đầy nó theo thời gian. Liệt kê nó để xem khi nào status.ready chuyển thành true, sau đó dùng id của nó trong targeting.audiences hoặc targeting.excludedAudiences khi bạn boost một Snap.
- Một lượt boost có thể nhắm tới phân khúc khi Snapchat đã khớp đủ người. Trước đó,
status.readylàfalse. - Một tài khoản quảng cáo có tối đa 1.000 danh sách khách hàng, và tên phân khúc dài tối đa 375 ký tự. Snapchat từ chối phần vượt quá với
code: 369. - Snapchat không thể tạo đối tượng tương tác tại đây.
type: engagementtrả về400vớicode: 101. - Gửi
idempotencyKeynếu bạn có thể thử lại: lần thử lại với cùng khóa và cùng body sẽ trả về phản hồi đầu tiên thay vì tạo phân khúc thứ hai.
Tham số Header
Tham số Body
ID tài khoản quảng cáo Snapchat của bạn để tạo phân khúc, ví dụ
5a0d0000-0000-4000-8000-000000000003.Danh sách khách hàng
Không có trường nào khác. Danh sách bắt đầu trống và giữ người cho đến khi bạn xóa họ.customerFileSource là tùy chọn: danh sách Snapchat chỉ chứa dữ liệu của riêng bạn, nên mọi giá trị khác USER_PROVIDED_ONLY đều trả về code: 101.
Trang web
Sự kiện pixel mà khách truy cập phải đã kích hoạt, viết đúng như Snapchat:
PAGE_VIEW, VIEW_CONTENT, ADD_CART, START_CHECKOUT, PURCHASE, SIGN_UP, SUBSCRIBE, SEARCH, ADD_TO_WISHLIST, CUSTOM_EVENT_1 đến CUSTOM_EVENT_5, hoặc một sự kiện pixel khác của Snapchat. Bắt buộc trên Snapchat.urlContains không được hỗ trợ trên Snapchat: phân khúc trang web của Snapchat chỉ giữ người theo sự kiện pixel, nên trường này trả về code: 101.
Lookalike
Danh sách khách hàng dùng để tìm người tương tự (
type: customerList trong Đối tượng). Snapchat chỉ tạo lookalike từ một danh sách khách hàng, nên nguồn không phải là một trong các danh sách khách hàng của bạn trên tài khoản quảng cáo này (loại phân khúc khác, phân khúc của tài khoản khác hoặc phân khúc đã xóa) sẽ trả về code: 101.balance (mặc định) cân bằng giữa độ tương đồng và quy mô, similarity giữ những người giống nguồn nhất, và reach tìm được nhiều người nhất.ratio và allowInternationalSeeds trả về 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"
}