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

# Lịch sử

> Lấy chi tiêu và hiệu quả hằng ngày của các quảng cáo Snapchat bạn đã boost qua Ayrshare, kèm tổng theo tiền tệ và bộ lọc ngày.

Lấy bản ghi chi tiêu hằng ngày của các quảng cáo Snapchat bạn đã tạo bằng [Boost Bài đăng](https://www.ayrshare.com/docs/apis/ads/snapchat/boost-post.md). Mỗi mục trong `history` là một quảng cáo trong một ngày.

<ul>
  <li>Lịch sử là bản ghi chi tiêu hằng ngày do Ayrshare lưu, nên chi tiêu của hôm nay có thể chưa hiển thị. Để xem số liệu trực tiếp, dùng [Insights](https://www.ayrshare.com/docs/apis/ads/snapchat/get-ad-insights.md).</li>
  <li>Một quảng cáo xuất hiện vào mỗi ngày Snapchat báo cáo số liệu cho nó. Quảng cáo tạo trong Snapchat Ads Manager không được bao gồm.</li>
  <li>Khi không tìm thấy ngày nào trong khoảng ngày, phản hồi vẫn thành công: `history` trống và `warnings` chứa một mục có mã `401`.</li>
  <li>`spend` của mỗi ngày tính theo tiền tệ của tài khoản quảng cáo, hiển thị trong `currency`. `totalSpendByCurrency` cho tổng theo từng tiền tệ. Nếu các tài khoản quảng cáo của bạn dùng tiền tệ khác nhau, hãy lọc theo `accountId`.</li>
  <li>`clicks` đếm số lượt swipe-up. Snapchat không báo cáo phạm vi tiếp cận hằng ngày, nên `reach`, `frequency` và `cpp` là `0`.</li>
  <li>`spendUsd` là `spend` của ngày khi tiền tệ là USD, và `null` nếu không. `totalSpend` luôn là `null`: hãy dùng `totalSpendByCurrency`.</li>
  <li>`byGoalType` và `goalPerformance` nhóm số liệu theo mục tiêu của lượt boost: `brand_awareness`, `video_views` hoặc `traffic`.</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

Gửi tối đa một trong `adId`, `postId`, `accountId` và `socialPostId`. Nếu gửi nhiều hơn một, tham số đầu tiên theo thứ tự đó được dùng. Bỏ qua tất cả để nhận mọi quảng cáo Snapchat.

**adId** `string`

Chỉ quảng cáo Snapchat này.

**postId** `string`

Chỉ các quảng cáo được boost từ [ID bài đăng](https://www.ayrshare.com/docs/apis/overview.md#ayrshare-post-id) Ayrshare này.

**accountId** `string`

Chỉ các quảng cáo trong tài khoản quảng cáo Snapchat này.

**socialPostId** `string`

Chỉ các quảng cáo được boost từ Snap này: `mediaId` trong kết quả Snapchat của bài đăng. `snapchatSnapId` được chấp nhận như cùng một tham số.

**startDate** `string` (default: 30 days before endDate)

Ngày bắt đầu của khoảng ngày, theo định dạng ISO 8601, ví dụ `2026-11-01`.

**endDate** `string` (default: now)

Ngày kết thúc của khoảng ngày, theo định dạng ISO 8601.

**limit** `number` (default: 25)

Số mục hằng ngày tối đa trả về, mới nhất trước. Tối đa là 300; giá trị lớn hơn bị giới hạn ở 300.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-X GET "https://api.ayrshare.com/api/ads/snapchat/history?adId=c3a1e2d4-0000-4000-8000-0000000000ad&startDate=2026-11-20&endDate=2026-11-22"
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "history": [
    {
      "accountId": "5a0d0000-0000-4000-8000-000000000003",
      "adId": "c3a1e2d4-0000-4000-8000-0000000000ad",
      "adName": "Acme - Snap - 2026-11-20T15:04",
      "budgetDaily": 20,
      "budgetType": "",
      "currency": "USD",
      "deliveryStatus": null,
      "goal": { "type": "brand_awareness" },
      "isActive": true,
      "isComplete": false,
      "metrics": {
        "clicks": 42,
        "cpc": 0.43,
        "cpp": 0,
        "cpm": 4.5,
        "ctr": 1.05,
        "frequency": 0,
        "impressions": 4000,
        "reach": 0
      },
      "network": "snapchat",
      "postId": "DE6gpw8kxlonHy6eb7L1",
      "snapchatSnapId": "6f1c2d3e-0000-4000-8000-00000000000a",
      "socialPostId": "6f1c2d3e-0000-4000-8000-00000000000a",
      "spend": 18,
      "spendDate": "2026-11-21T00:00:00.000Z",
      "spendUsd": 18,
      "status": "ACTIVE"
    }
  ],
  "dateRange": {
    "start": "2026-11-20T00:00:00.000Z",
    "end": "2026-11-22T00:00:00.000Z",
    "adId": "c3a1e2d4-0000-4000-8000-0000000000ad"
  },
  "metrics": {
    "totalSpend": null,
    "totalSpendByCurrency": { "USD": 18 },
    "totalClicks": 42,
    "totalImpressions": 4000,
    "totalReach": 0,
    "averageCTR": 1.05,
    "averageFrequency": 0,
    "cpm": 4.5,
    "cpp": 0,
    "cpc": 0.43,
    "costPerResult": 0.43,
    "byGoalType": {
      "brand_awareness": {
        "spend": 18,
        "impressions": 4000,
        "clicks": 42,
        "reach": 0,
        "count": 1,
        "ctr": 1.05,
        "cpm": 4.5,
        "cpp": 0,
        "cpc": 0.42857142857142855
      }
    },
    "byGoalTitle": {},
    "goalPerformance": {
      "bestPerformingGoalType": { "type": "brand_awareness", "clicks": 42, "spend": 18, "ctr": 1.05 },
      "mostEfficientGoalType": { "type": "brand_awareness", "cpc": 0.43, "spend": 18 }
    },
    "count": 1,
    "firstDay": "2026-11-21T00:00:00.000Z",
    "lastDay": "2026-11-21T00:00:00.000Z"
  }
}
```

```json 400: Bad date 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": "Invalid date format. Please use ISO 8601 format (YYYY-MM-DD)."
}
```


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