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"
}