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