> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 受眾

> 列出 Instagram 廣告帳戶的自訂受眾，包括每個受眾的類型、規模，以及推廣是否已可鎖定它。

列出 Instagram 廣告帳戶的自訂受眾：網站訪客、與粉絲專頁、Instagram 帳戶或影片互動過的人、類似受眾（lookalike），以及你自己的顧客名單。在[推廣貼文](https://www.ayrshare.com/docs/apis/ads/instagram/boost-post.md#audiences)時，將這些 ID 用於 `targeting.audiences` 或 `targeting.excludedAudiences`。

<ul>
  <li>在 Meta Ads Manager 中建立的受眾也會列出，而不只是透過 Ayrshare 建立的受眾。</li>
  <li>當 Meta 填充完受眾且推廣可以鎖定它時，`status.ready` 為 `true`。新受眾在 Meta 比對到至少 100 人之前不會就緒，網站或互動受眾可能需要幾個小時，顧客名單最多可能需要 48 小時。</li>
  <li>`size` 是 Meta 自己的估計值，以下限和上限表示。在 Meta 沒有估計值時為 `null`，例如受眾仍在填充時。</li>
  <li>結果不會快取：受眾在填充過程中，其規模和就緒狀態會變化。</li>
</ul>

## 請求頭參數

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## 查詢參數

**accountId** `string` *required*

要列出其受眾的廣告帳戶，來自[廣告帳戶](https://www.ayrshare.com/docs/apis/ads/instagram/get-ad-accounts.md)，帶或不帶 `act_` 前綴皆可。

**limit** `number`

每頁傳回的最大受眾數，1 到 1000。預設為 100；更大的數字會傳回 1000。

**next** `string`

當回應包含 `meta.pagination.hasMore: true` 時，將其 `meta.pagination.next` 值傳送到這裡以取得下一頁。其他參數保持不變：來自其他請求的 `next` 值會傳回 `code: 101`。

## 回應

每個受眾包含：

<ul>
  <li>`id`：推廣、新增人員或刪除時使用的受眾 ID。</li>
  <li>`name`：在 Ads Manager 中顯示的名稱。</li>
  <li>`type`：`website`、`engagement`、`lookalike`、`customerList`，或 Ayrshare 不建立的受眾類型為 `other`。</li>
  <li>`size`：`{ lower, upper }`，Meta 的估計值，或 `null`。</li>
  <li>`status`：`{ ready, code, description }`。當推廣現在可以鎖定該受眾時，`ready` 為 `true`；`code` 和 `description` 是 Meta 的投放狀態。</li>
  <li>`created`：受眾的建立時間，ISO 8601 格式，或 `null`。</li>
</ul>

如果還有更多受眾，`meta.pagination.hasMore` 為 `true`，並設定 `meta.pagination.next`。將 `next` 設為該值並再次傳送相同請求，即可取得下一頁。

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/instagram/audiences?accountId=1234567890"
```

```javascript JavaScript theme={"system"}
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);
```

```python Python theme={"system"}
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())
```

```json 200: Success theme={"system"}
{
  "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 } }
}
```

```json 400: Missing account theme={"system"}
{
  "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."
}
```

```json 400: Meta refused the request theme={"system"}
{
  "action": "ads",
  "status": "error",
  "code": 370,
  "message": "Error getting audiences. Please try again.",
  "details": "Meta's reason"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.