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

# Đối tượng

> Liệt kê các phân khúc đối tượng trên tài khoản quảng cáo Snapchat, kèm loại, quy mô và việc một lượt boost đã có thể nhắm tới từng phân khúc hay chưa.

Liệt kê các phân khúc đối tượng trên tài khoản quảng cáo Snapchat: danh sách khách hàng của bạn, khách truy cập trang web mà Snap Pixel ghi nhận, và lookalike. Dùng các id trong `targeting.audiences` hoặc `targeting.excludedAudiences` khi bạn [boost một Snap](https://www.ayrshare.com/docs/apis/ads/snapchat/boost-post.md#audiences).

<ul>
  <li>Các phân khúc được tạo trong Snapchat Ads Manager cũng được liệt kê, không chỉ những phân khúc được tạo qua Ayrshare.</li>
  <li>`status.ready` là `true` khi Snapchat cho biết một lượt boost có thể nhắm tới phân khúc. Phân khúc có quá ít người được khớp thì chưa sẵn sàng (`TOO_FEW_USERS`).</li>
  <li>`size` là số người được khớp do chính Snapchat đếm, được gửi dưới dạng cả `lower` và `upper`.</li>
  <li>Kết quả không được lưu cache: quy mô và trạng thái sẵn sàng của phân khúc thay đổi trong khi nó được lấp đầy.</li>
  <li>Snapchat tự đặt kích thước trang, nên `limit` không có tác dụng ở đây.</li>
</ul>

## Tham số Header

**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`

## Tham số truy vấn

**accountId** `string` *required*

ID tài khoản quảng cáo Snapchat của bạn có các phân khúc cần liệt kê, ví dụ `5a0d0000-0000-4000-8000-000000000003`.

**next** `string`

Khi phản hồi có `meta.pagination.hasMore: true`, gửi giá trị `meta.pagination.next` của nó vào đây để lấy trang tiếp theo. Giữ nguyên các tham số khác: giá trị `next` từ một yêu cầu khác sẽ trả về `code: 101`.

## Phản hồi

Mỗi đối tượng có:

<ul>
  <li>`id`: id phân khúc dùng khi boost, thêm người hoặc xóa.</li>
  <li>`name`: tên hiển thị trong Ads Manager.</li>
  <li>`type`: `customerList`, `website`, `lookalike`, hoặc `other` cho loại phân khúc mà Ayrshare không tạo.</li>
  <li>`size`: `{ lower, upper }`, cả hai đều là số đếm của Snapchat, hoặc `null` khi Snapchat không báo số nào.</li>
  <li>`status`: `{ ready, code, description }`. `ready` là `true` khi một lượt boost có thể nhắm tới phân khúc ngay bây giờ. `code` luôn là `null`. `description` là trạng thái của Snapchat: `READY`, `NOT_READY` hoặc `TOO_FEW_USERS`.</li>
  <li>`created`: thời điểm phân khúc được tạo, theo ISO 8601, hoặc `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.