curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences \
-d '{"accountId": "a2_abcdefg", "name": "Site visitors 30d", "type": "website", "pixelId": "t2_pixel123", "retentionDays": 30, "event": "purchase"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"id": "ca.129482487242999",
"name": "Site visitors 30d",
"type": "website",
"size": null,
"status": { "ready": false, "code": null, "description": "PENDING" },
"created": "2026-12-02T10:05: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": "retentionDays on reddit is at most 90."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Reddit's reason"
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Reddit's reason"
}
Reddit Ads
Tạo đối tượng
Tạo đối tượng tùy chỉnh Reddit từ danh sách khách hàng của riêng bạn hoặc khách truy cập trang web, để bao gồm hay loại trừ khi boost bài đăng.
POST
/
ads
/
reddit
/
audiences
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences \
-d '{"accountId": "a2_abcdefg", "name": "Site visitors 30d", "type": "website", "pixelId": "t2_pixel123", "retentionDays": 30, "event": "purchase"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"id": "ca.129482487242999",
"name": "Site visitors 30d",
"type": "website",
"size": null,
"status": { "ready": false, "code": null, "description": "PENDING" },
"created": "2026-12-02T10:05: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": "retentionDays on reddit is at most 90."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Reddit's reason"
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Reddit's reason"
}
Tạo một đối tượng tùy chỉnh trên tài khoản quảng cáo Reddit. Hỗ trợ hai loại, chọn bằng
type:
customerList: danh sách người của riêng bạn, được điền bằng các định danh đã băm qua Thành viên đối tượng.website: những người mà pixel Reddit của bạn đã ghi nhận trên trang web của bạn.
audience với cùng cấu trúc như Đối tượng, kèm status.ready: false. Reddit điền đối tượng theo thời gian. Hãy liệt kê để xem khi nào status.ready chuyển thành true, rồi dùng id của nó trong targeting.audiences hoặc targeting.excludedAudiences khi bạn boost một bài đăng.
- Reddit không thể tạo đối tượng tương tác hoặc đối tượng tương tự tại đây. Gửi
type: engagementhoặctype: lookalikesẽ trả về400vớicode: 101. - Một đối tượng cần khớp được ít nhất 1.000 người trước khi một lượt boost có thể nhắm tới nó.
Tham số Header
Tham số Body
Cả hai loại đều nhận các tham số sau:customerList hoặc website. Mỗi loại chỉ nhận các trường riêng của nó bên dưới. Một trường thuộc loại khác sẽ trả về 400 với code: 101 nêu tên trường đó.Một giá trị duy nhất mới, chẳng hạn UUID, cho mỗi đối tượng mới. Nếu bạn lặp lại yêu cầu với cùng khóa, Ayrshare trả về phản hồi đầu tiên, được đánh dấu
idempotentReplayed: true, và không tạo đối tượng thứ hai. Bạn có thể gửi khóa trong header Idempotency-Key thay vào đó; nếu gửi cả hai, chúng phải khớp nhau. Dùng lại một khóa cho yêu cầu khác, hoặc khi yêu cầu đầu tiên vẫn đang xử lý, sẽ trả về 409. 503 nghĩa là không thể giữ chỗ khóa và chưa có gì được tạo: hãy thử lại sau với cùng khóa.Đối tượng danh sách khách hàng
Danh sách khách hàng không cần thêm trường bắt buộc nào khác và ban đầu trống. Thêm người bằng Thành viên đối tượng. Định danh đã băm vẫn là dữ liệu cá nhân: hãy đọc trang đó trước khi tải lên một danh sách.customerFileSource không được chấp nhận trên Reddit trừ khi giá trị là USER_PROVIDED_ONLY: Reddit chỉ nhận danh sách của riêng bạn.
Đối tượng trang web
Chỉ giữ những khách truy cập đã kích hoạt sự kiện này. Các sự kiện tiêu chuẩn của Reddit là
PAGE_VISIT, VIEW_CONTENT, SEARCH, ADD_TO_CART, ADD_TO_WISHLIST, PURCHASE, LEAD và SIGN_UP, viết hoa hay viết thường đều được. Mọi giá trị khác được gửi dưới dạng tên sự kiện tùy chỉnh. Bỏ qua để tính mọi lượt truy cập.urlContains không được chấp nhận trên Reddit: Reddit không có bộ lọc URL cho đối tượng trang web.
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences \
-d '{"accountId": "a2_abcdefg", "name": "Site visitors 30d", "type": "website", "pixelId": "t2_pixel123", "retentionDays": 30, "event": "purchase"}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"name": "Site visitors 30d",
"type": "website",
"pixelId": "t2_pixel123",
"retentionDays": 30,
"event": "purchase"
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"audience": {
"id": "ca.129482487242999",
"name": "Site visitors 30d",
"type": "website",
"size": null,
"status": { "ready": false, "code": null, "description": "PENDING" },
"created": "2026-12-02T10:05: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": "retentionDays on reddit is at most 90."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Reddit's reason"
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to create the audience. Please try again.",
"details": "Reddit's reason"
}