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