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

# 歷史記錄

> 取得透過 Ayrshare 推廣的 Snapchat 廣告每日花費與成效，含各貨幣合計和日期篩選。

取得你透過[推廣貼文](https://www.ayrshare.com/docs/apis/ads/snapchat/boost-post.md)建立的 Snapchat 廣告的每日花費記錄。`history` 中的每個項目代表一個廣告在一天內的資料。

<ul>
  <li>歷史記錄是 Ayrshare 對你花費的每日記錄，因此今天的花費可能尚未顯示。如需即時數據，請使用[洞察](https://www.ayrshare.com/docs/apis/ads/snapchat/get-ad-insights.md)。</li>
  <li>廣告會出現在 Snapchat 回報其統計資料的每一天。在 Snapchat Ads Manager 中建立的廣告不包含在內。</li>
  <li>如果日期範圍內未找到任何日期，回應仍然成功：`history` 為空，`warnings` 中包含一個代碼為 `401` 的項目。</li>
  <li>每天的 `spend` 以廣告帳戶的貨幣計，顯示在 `currency` 中。`totalSpendByCurrency` 提供每種貨幣的合計。如果你的廣告帳戶使用不同貨幣，請依 `accountId` 篩選。</li>
  <li>`clicks` 統計上滑（swipe-up）次數。Snapchat 不回報每日觸及人數，因此 `reach`、`frequency` 和 `cpp` 為 `0`。</li>
  <li>當貨幣為 USD 時，`spendUsd` 為當天的 `spend`，否則為 `null`。`totalSpend` 一律為 `null`：請使用 `totalSpendByCurrency`。</li>
  <li>`byGoalType` 和 `goalPerformance` 依推廣目標將數據分組：`brand_awareness`、`video_views` 或 `traffic`。</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`

## 查詢參數

`adId`、`postId`、`accountId` 和 `socialPostId` 最多傳送一個。如果傳送多個，依此順序使用第一個。全部省略可取得所有 Snapchat 廣告。

**adId** `string`

僅此 Snapchat 廣告。

**postId** `string`

僅從此 Ayrshare [貼文 ID](https://www.ayrshare.com/docs/apis/overview.md#ayrshare-post-id) 推廣的廣告。

**accountId** `string`

僅此 Snapchat 廣告帳戶中的廣告。

**socialPostId** `string`

僅從此 Snap 推廣的廣告：貼文的 Snapchat 結果中的 `mediaId`。`snapchatSnapId` 也可作為同一參數。

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

日期範圍的開始，採用 ISO 8601 格式，例如 `2026-11-01`。

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

日期範圍的結束，採用 ISO 8601 格式。

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

回傳的最大每日項目數，由新到舊排列。最大值為 300；更大的值會被限制為 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.