curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users \
-d '{"accountId": "a2_abcdefg", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
})
})
.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",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "ca.129482487242828",
"received": 1,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[0][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id ca.129482487242999 is a website audience; members can be added to or removed from a customer-list audience only."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}
Reddit Ads
受众成员
发送电子邮件或移动广告 ID 的 SHA-256 哈希,向 Reddit 客户名单受众添加或移除人员。
POST
/
ads
/
reddit
/
audiences
/
{id}
/
users
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users \
-d '{"accountId": "a2_abcdefg", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
})
})
.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",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "ca.129482487242828",
"received": 1,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[0][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id ca.129482487242999 is a website audience; members can be added to or removed from a customer-list audience only."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}
向通过创建受众创建的客户名单受众(
type: customerList)添加人员,或将其移除。您以规范化标识符的 SHA-256 哈希形式发送每个人;Reddit 将哈希与账户匹配;原始值永远不会离开您的系统。
DELETE /ads/reddit/audiences/{id}/users 接受相同的请求体,改为移除这些人员。
- 当 Reddit 匹配到至少 1,000 人后,名单即可用于推广。届时受众会显示
status.ready。 - 每个请求最多包含 10,000 行,请求体最大 10 MiB。较大的名单请分多个请求发送。
- 如果请求中途失败,失败前已发送的行仍保留在受众中。请重新发送整个请求:添加已在名单中的人员不会产生任何变化。
- ID 必须是
accountId指定的广告账户上的客户名单受众。任何其他 ID 都会返回带有code: 101的400。
哈希标识符属于个人数据
根据 GDPR 及类似法律,经过哈希处理的电子邮件或广告 ID 仍属于个人数据。上传名单时:- 您是数据控制者。 您需要合法依据(通常是名单中人员的同意)才能将他们的数据用于广告,这是您的隐私政策和 Reddit 的广告政策所要求的。
- Ayrshare 是数据处理者。 我们将哈希传递给 Reddit,除计数外不保留任何内容:请求体中的任何行都不会被记录、缓存或存储,响应也绝不会回显任何行。
- 您在发送前进行哈希。 Ayrshare 绝不会替您进行哈希。不是哈希的值会在向 Reddit 发送任何内容之前被拒绝。
如何进行哈希
按照 Reddit 的客户名单指南规范化每个值,然后用 SHA-256 进行哈希,并以 64 个小写十六进制字符发送结果。简而言之:EMAIL:去除空格并转为小写,例如jane@example.com。MADID:设备的移动广告 ID(Google 的 GAID 或 Apple 的 IDFA)。
请求头参数
路径参数
请求体参数
每人一行:一个数组,每个
schema 列对应一个 SHA-256 哈希,以 64 个小写十六进制字符表示。最多 10,000 行。不是此类哈希的单元格、宽度错误的行或不受支持的键,会在向 Reddit 发送任何内容之前返回带有 code: 101 的 400。消息会指明行和列,但绝不包含值,例如 data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters.响应
仅包含计数:received:Reddit 接收的行数。invalid:在 Reddit 上始终为0。Reddit 不报告无法匹配的行。匹配结果稍后会体现在受众中该受众的size和status中。batches:这些行分几次上传发送。Reddit 每次上传接收 2,500 行。
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users \
-d '{"accountId": "a2_abcdefg", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
})
})
.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",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "ca.129482487242828",
"received": 1,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[0][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id ca.129482487242999 is a website audience; members can be added to or removed from a customer-list audience only."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}