curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/delegations \
-d '{"owners": [{"refId": "140b8709bd6ade099b242d895e268fb886130c53"}], "platforms": ["instagram"]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/delegations", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
owners: [{ refId: "140b8709bd6ade099b242d895e268fb886130c53" }],
platforms: ["instagram"]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
{
"status": "success",
"delegations": [
{
"id": "Kx3v9QpL2mZ7tR1wYb4N",
"owner": { "refId": "140b8709bd6ade099b242d895e268fb886130c53", "title": "Agent One" },
"payer": { "refId": "9f1c3e7a2b4d", "title": "Agency" },
"platform": "instagram",
"permission": "unknown",
"status": "active"
}
]
}
{
"action": "ads",
"status": "error",
"code": 400,
"message": "These owner profiles are not found in this account: 140b8709bd6ade."
}
Boost on Behalf
创建推广授权
允许您账户中的一个 Profile(付款方)用其广告账户推广其他 Profile 的帖子。请使用 Primary Profile 的 API Key 发送请求。
POST
/
ads
/
delegations
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/delegations \
-d '{"owners": [{"refId": "140b8709bd6ade099b242d895e268fb886130c53"}], "platforms": ["instagram"]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/delegations", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
owners: [{ refId: "140b8709bd6ade099b242d895e268fb886130c53" }],
platforms: ["instagram"]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
{
"status": "success",
"delegations": [
{
"id": "Kx3v9QpL2mZ7tR1wYb4N",
"owner": { "refId": "140b8709bd6ade099b242d895e268fb886130c53", "title": "Agent One" },
"payer": { "refId": "9f1c3e7a2b4d", "title": "Agency" },
"platform": "instagram",
"permission": "unknown",
"status": "active"
}
]
}
{
"action": "ads",
"status": "error",
"code": 400,
"message": "These owner profiles are not found in this account: 140b8709bd6ade."
}
推广授权允许您账户中的一个 Profile(即付款方,payer)推广您账户中其他 Profile 发布的帖子。付款方是由其广告账户为广告付费的 Profile。
推广授权使用 Primary Profile(主 Profile)的 API Key 进行管理。发送请求时请勿附带
Profile 通过
Profile-Key。
请求头参数
请求体参数
付款方可以推广其帖子的 User Profile(用户 Profile)。可以是最多 1,000 个包含
refId 的对象列表,也可以是 "all",表示您账户中当前除付款方以外的所有 User Profile。Primary Profile 不能作为所有者(owner)。1,000 的上限同样适用于 "all":如果您的账户中除付款方以外有超过 1,000 个 User Profile,请求将被拒绝并返回 code 101,且不会创建任何内容。此时请改为分批发送 owners,每个请求最多包含 1,000 个 Profile 的列表。"all" 不包括您之后创建的 Profile。如需添加这些 Profile,请再次发送该请求。要授权的广告平台,例如
["instagram"]。仅接受支持代为推广的平台,其他平台会返回 101。每个所有者和平台的组合
各对应一条推广授权。refId 指定,该值会在您创建 Profile 或获取 Profile 时返回。
每个所有者和平台的组合都有各自的推广授权,并拥有各自的 id。再次发送请求只会创建缺失的推广授权,已有的推广授权将原样返回。唯一的例外是:如果所有者在社交网络上拒绝了该权限,推广授权的 permission 会重置为 unknown,以便下次推广时重新请求权限。请在所有者重新关联账户后再发送该请求。对于本次请求中所含所有者和平台的已撤销推广授权,将以相同的 id 重新生效;该所有者在其他平台上已撤销的推广授权仍保持撤销状态。
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/delegations \
-d '{"owners": [{"refId": "140b8709bd6ade099b242d895e268fb886130c53"}], "platforms": ["instagram"]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/delegations", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
owners: [{ refId: "140b8709bd6ade099b242d895e268fb886130c53" }],
platforms: ["instagram"]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
{
"status": "success",
"delegations": [
{
"id": "Kx3v9QpL2mZ7tR1wYb4N",
"owner": { "refId": "140b8709bd6ade099b242d895e268fb886130c53", "title": "Agent One" },
"payer": { "refId": "9f1c3e7a2b4d", "title": "Agency" },
"platform": "instagram",
"permission": "unknown",
"status": "active"
}
]
}
{
"action": "ads",
"status": "error",
"code": 400,
"message": "These owner profiles are not found in this account: 140b8709bd6ade."
}