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

# 受众

> 列出 Snapchat 广告账户的受众细分，包括每个细分的类型、规模以及推广是否已可定位它。

列出 Snapchat 广告账户的受众细分：你的客户名单、Snap Pixel 记录到的网站访客，以及类似受众。[推广 Snap](https://www.ayrshare.com/docs/apis/ads/snapchat/boost-post.md#audiences)时，在 `targeting.audiences` 或 `targeting.excludedAudiences` 中使用这些 ID。

<ul>
  <li>在 Snapchat Ads Manager 中创建的细分也会列出，而不仅仅是通过 Ayrshare 创建的细分。</li>
  <li>当 Snapchat 表示推广可以定位该细分时，`status.ready` 为 `true`。已匹配人数过少的细分尚未就绪（`TOO_FEW_USERS`）。</li>
  <li>`size` 是 Snapchat 自己统计的已匹配人数，同时作为 `lower` 和 `upper` 发送。</li>
  <li>结果不会缓存：细分在填充过程中，其规模和就绪状态会不断变化。</li>
  <li>Snapchat 自行设定每页大小，因此 `limit` 在此无效。</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*

要列出其细分的 Snapchat 广告账户 ID，例如 `5a0d0000-0000-4000-8000-000000000003`。

**next** `string`

当响应包含 `meta.pagination.hasMore: true` 时，将其 `meta.pagination.next` 值发送到这里以获取下一页。其他参数保持不变：来自其他请求的 `next` 值会返回 `code: 101`。

## 响应

每个受众包含：

<ul>
  <li>`id`：推广、添加人员或删除时使用的细分 ID。</li>
  <li>`name`：在 Ads Manager 中显示的名称。</li>
  <li>`type`：`customerList`、`website`、`lookalike`，或对于 Ayrshare 不创建的细分类型为 `other`。</li>
  <li>`size`：`{ lower, upper }`，两者均为 Snapchat 的计数；Snapchat 未报告时为 `null`。</li>
  <li>`status`：`{ ready, code, description }`。当推广现在即可定位该细分时，`ready` 为 `true`。`code` 始终为 `null`。`description` 是 Snapchat 的状态：`READY`、`NOT_READY` 或 `TOO_FEW_USERS`。</li>
  <li>`created`：细分的创建时间，采用 ISO 8601 格式，或 `null`。</li>
</ul>

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003"
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";

fetch("https://api.ayrshare.com/api/ads/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003", {
      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/snapchat/audiences?accountId=5a0d1b2c-0000-4000-8000-000000000003', headers=headers)

print(r.json())
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "audiences": [
    {
      "id": "8c1e2f3a-0000-4000-8000-000000000101",
      "name": "Newsletter subscribers",
      "type": "customerList",
      "size": { "lower": 12000, "upper": 12000 },
      "status": { "ready": true, "code": null, "description": "READY" },
      "created": "2026-11-20T09:12:00.000Z"
    },
    {
      "id": "8c1e2f3a-0000-4000-8000-000000000102",
      "name": "Like my subscribers",
      "type": "lookalike",
      "size": { "lower": 0, "upper": 0 },
      "status": { "ready": false, "code": null, "description": "NOT_READY" },
      "created": "2026-12-01T16: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: Snapchat refused the request theme={"system"}
{
  "action": "ads",
  "status": "error",
  "code": 370,
  "message": "Error getting audiences. Please try again.",
  "details": "Snapchat's reason"
}
```


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