> ## 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.