# TikTok 热门广告 API (tiktok.top_ads)

- Canonical page: [https://everyinfra.com/tiktok-api/top_ads](https://everyinfra.com/tiktok-api/top_ads?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "tiktok", "action": "top_ads", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, one page of up to 20 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=tiktok&action=top_ads

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| country | not declared | no | not declared | 国家代码，默认 US。有列表的：AE AR AU BR CA CO DE ES FR GB ID IT JP KR MX MY NL PH PK RO SA SE SG TH TR US VN ZA；别的国家会在扣费前被拒（422，不扣费）。 |
| page_token | not declared | no | not declared | 翻页令牌：把上一次响应里的 next_page_token 原样传回，country、time_window 不变，拿下一页；不传从第一页开始。请从第一页起一页接一页连续翻，不要隔很久再接着翻。令牌 24 小时有效，每页约 20 条，算一次调用；limit 不起作用。后面的页 TikTok 有时不给，这时返回 503、不扣费，可稍后用同一个 page_token 重试。没有 next_page_token 才是最后一页。 |
| time_window | enum: 180d / 30d / 7d | no | not declared | 统计时段：7d、30d（默认）、180d。别的值会在扣费前被拒（422，不扣费）。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| next_page_token | 翻页令牌（hashtag_search / music_search / user_search / sound_videos / comment_replies / shop_category_products / following / shop_products / shop_product_reviews / user_playlists / playlist_videos / user_reposts）：作为下一次请求的 page_token 原样传回取下一页；同一页每行的值相同；24 小时有效。没有这个字段才是最后一页。 |
| rank | 名次，从 1 起（music_chart / shop_hot_products）；search_suggest 里是这个词在搜索页「相关搜索」里的次序。top_ads 里是这条广告在这一页里的位置，每一页都从 1 起，即 TikTok 给的顺序。 |
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| url | 该记录在原平台上的可访问链接。 |
| brand_name | 商品的品牌名（shop_search、shop_category_products、shop_products）；商品没标品牌时没有这个字段。top_ads 里是广告主的品牌名；TikTok 没显示品牌时没有这个字段。 |
| industry | 广告所属行业，创意中心页面上的英文写法，如 Sports & Outdoor（top_ads）。 |
| industry_key | 行业的编号，如 label_28000000000（top_ads）。 |
| objective | 广告的投放目标，页面上的英文写法，如 Conversions、Reach、Traffic、Lead Generation、Video Views（top_ads）。 |
| objective_key | 投放目标的编号，如 campaign_objective_conversion（top_ads）。 |
| budget_level | 花费档：low、medium、high 三档（top_ads）；TikTok 只给档位，不给金额。 |
| ctr_top_percent | 点击率排名档（top_ads）：创意中心页面上写成「Top n% CTR」的那个 n，数越小，点击率排得越靠前；不是点击率本身。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| video_id | 评论所在视频的 ID（comment_replies）。top_ads 里是广告视频文件的编号，不是 TikTok 作品的视频 ID，不能拿去调 video。 |
| duration_sec | 时长，单位秒，与 duration_seconds 同值（两个名字都返回）：视频行是视频时长，music_search、music_chart、music_detail 是声音的时长。top_ads 里是广告视频的时长，带小数。 |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| width | 无水印视频文件的宽度，单位像素（video_download）；图文作品没有。playlist_videos、user_reposts、user_stories 里是视频画面的宽度。top_ads 里是广告视频画面的宽度。 |
| height | 无水印视频文件的高度，单位像素（video_download）；图文作品没有。playlist_videos、user_reposts、user_stories 里是视频画面的高度。top_ads 里是广告视频画面的高度。 |
| cover_url | 作品封面图地址（photos）。top_ads 里是广告视频的封面图地址，带签名、会过期，要存请尽快下载。 |
| video_url | 无水印视频文件地址（video_download，mp4）。不用 Cookie、不限 IP，到 expires_at 失效；图文作品没有。top_ads 里是广告视频文件地址（720p 那一档），带签名、会过期，要存请尽快下载。 |
| video_urls | 各档清晰度的广告视频文件地址（top_ads）：[{quality, url}]，quality 如 720p、540p；地址带签名、会过期，要存请尽快下载。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "tiktok",
  "action": "top_ads",
  "params": {}
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "tiktok",
        "action": "top_ads",
        "params": {},
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "tiktok",
  "action": "top_ads",
  "results": [
    {
      "next_page_token": …,
      "rank": …,
      "id": …,
      "title": …,
      "url": …,
      "brand_name": …,
      "industry": …,
      "industry_key": …,
      "objective": …,
      "objective_key": …,
      "budget_level": …,
      "ctr_top_percent": …,
      "like_count": …,
      "video_id": …,
      "duration_sec": …,
      "duration_seconds": …,
      "width": …,
      "height": …,
      "cover_url": …,
      "video_url": …,
      "video_urls": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=tiktok
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
