curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/instagram/audiences?accountId=1234567890"
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/audiences?accountId=1234567890", {
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/instagram/audiences?accountId=1234567890', headers=headers)
print(r.json())
{
"status": "success",
"audiences": [
{
"id": "23851234567890123",
"name": "Site visitors 30d",
"type": "website",
"size": { "lower": 12000, "upper": 14100 },
"status": { "ready": true, "code": 200, "description": "This audience is ready for use." },
"created": "2026-10-20T09:12:00.000Z"
},
{
"id": "23851234567890456",
"name": "Like site visitors",
"type": "lookalike",
"size": null,
"status": { "ready": false, "code": 300, "description": "This audience is still being populated." },
"created": "2026-10-28T16: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": "Meta's reason"
}
Instagram Ads
受众
列出 Instagram 广告账户的自定义受众,包括每个受众的类型、规模以及推广是否已可定位它。
GET
/
ads
/
instagram
/
audiences
curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/instagram/audiences?accountId=1234567890"
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/audiences?accountId=1234567890", {
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/instagram/audiences?accountId=1234567890', headers=headers)
print(r.json())
{
"status": "success",
"audiences": [
{
"id": "23851234567890123",
"name": "Site visitors 30d",
"type": "website",
"size": { "lower": 12000, "upper": 14100 },
"status": { "ready": true, "code": 200, "description": "This audience is ready for use." },
"created": "2026-10-20T09:12:00.000Z"
},
{
"id": "23851234567890456",
"name": "Like site visitors",
"type": "lookalike",
"size": null,
"status": { "ready": false, "code": 300, "description": "This audience is still being populated." },
"created": "2026-10-28T16: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": "Meta's reason"
}
列出 Instagram 广告账户的自定义受众:网站访客、与主页、Instagram 账户或视频互动过的人、类似受众(lookalike)以及你自己的客户名单。在推广帖子时,将这些 ID 用于
targeting.audiences 或 targeting.excludedAudiences。
- 在 Meta Ads Manager 中创建的受众也会列出,而不仅仅是通过 Ayrshare 创建的受众。
- 当 Meta 填充完受众且推广可以定位它时,
status.ready为true。新受众在 Meta 匹配到至少 100 人之前不会就绪,网站或互动受众可能需要几个小时,客户名单最多可能需要 48 小时。 size是 Meta 自己的估算值,以下限和上限表示。在 Meta 没有估算值时为null,例如受众仍在填充时。- 结果不会缓存:受众在填充过程中,其规模和就绪状态会变化。
请求头参数
查询参数
要列出其受众的广告账户,来自广告账户,带或不带
act_ 前缀均可。当响应包含
meta.pagination.hasMore: true 时,将其 meta.pagination.next 值发送到这里以获取下一页。其他参数保持不变:来自其他请求的 next 值会返回 code: 101。响应
每个受众包含:id:推广、添加人员或删除时使用的受众 ID。name:在 Ads Manager 中显示的名称。type:website、engagement、lookalike、customerList,或者 Ayrshare 不创建的受众类型为other。size:{ lower, upper },Meta 的估算值,或null。status:{ ready, code, description }。当推广现在可以定位该受众时,ready为true;code和description是 Meta 的投放状态。created:受众的创建时间,ISO 8601 格式,或null。
meta.pagination.hasMore 为 true,并设置 meta.pagination.next。将 next 设为该值并再次发送相同请求,即可获取下一页。
curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/instagram/audiences?accountId=1234567890"
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/audiences?accountId=1234567890", {
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/instagram/audiences?accountId=1234567890', headers=headers)
print(r.json())
{
"status": "success",
"audiences": [
{
"id": "23851234567890123",
"name": "Site visitors 30d",
"type": "website",
"size": { "lower": 12000, "upper": 14100 },
"status": { "ready": true, "code": 200, "description": "This audience is ready for use." },
"created": "2026-10-20T09:12:00.000Z"
},
{
"id": "23851234567890456",
"name": "Like site visitors",
"type": "lookalike",
"size": null,
"status": { "ready": false, "code": 300, "description": "This audience is still being populated." },
"created": "2026-10-28T16: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": "Meta's reason"
}