# TikTok Top ads API (tiktok.top_ads)

- Canonical page: [https://everyinfra.com/en/tiktok-api/top_ads](https://everyinfra.com/en/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 | The country whose Top Ads you want, default 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 or ZA. Other countries have no list and are declined before you are charged (422, no charge). |
| page_token | not declared | no | not declared | Page token. Leave it out for the first page, then pass back the previous response's `next_page_token` exactly as received, with `country` and `time_window` unchanged. Start at page 1 and fetch the pages one after another, without long gaps. Each page holds about 20 ads and is one call; `limit` has no effect. TikTok sometimes does not provide later pages; that call returns 503 and is not charged, so retry later with the same `page_token`. Tokens last 24 hours; the last page has no `next_page_token`. |
| time_window | enum: 180d / 30d / 7d | no | not declared | The period `top_ads` ranks over: `7d`, `30d` (default) or `180d`. Other values are declined before you are charged (422, no charge). |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| next_page_token | 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): pass it back unchanged as page_token on the next request to get the next page; every row of a page carries the same value; valid for 24 hours. Only a page without this field is the last page. |
| rank | Rank, starting from 1 (music_chart / shop_hot_products); in search_suggest, the order of the term among the page's related searches. In top_ads, the ad's position on its page, starting from 1 on every page, which is the order TikTok gives. |
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| title | Title. null when the platform has no titles (for example text-only posts). |
| url | Link to the record on the platform. |
| brand_name | Brand name of the product (shop_search, shop_category_products, shop_products); absent when no brand is listed for the product. In top_ads, the advertiser's brand name; absent when TikTok shows no brand for the ad. |
| industry | Industry of the ad, as written on the Creative Center page, for example Sports & Outdoor (top_ads). |
| industry_key | ID of the industry, for example label_28000000000 (top_ads). |
| objective | Campaign objective of the ad, as written on the page, for example Conversions, Reach, Traffic, Lead Generation or Video Views (top_ads). |
| objective_key | ID of the campaign objective, for example campaign_objective_conversion (top_ads). |
| budget_level | Spend level: low, medium or high (top_ads); TikTok gives the level only, not an amount. |
| ctr_top_percent | CTR rank band (top_ads): the n in "Top n% CTR" on the Creative Center page; the smaller the number, the higher the ad ranks on click-through rate. It is not the click-through rate itself. |
| like_count | Likes. null means the platform or this capability does not disclose it; it is not 0. |
| video_id | ID of the video the comment belongs to (comment_replies). In top_ads, the ID of the ad's video file; it is not the ID of a TikTok post and cannot be used to call video. |
| duration_sec | Duration in seconds, the same value as duration_seconds (both names are returned): the video's length on video rows, the sound's length on music_search, music_chart and music_detail. In top_ads, the length of the ad video, with decimals. |
| duration_seconds | Duration in seconds. null for content that is not video or audio. |
| width | Width of the watermark-free video file in pixels (video_download); absent for photo posts. In playlist_videos, user_reposts and user_stories, the width of the video frame. In top_ads, the width of the ad video's frame. |
| height | Height of the watermark-free video file in pixels (video_download); absent for photo posts. In playlist_videos, user_reposts and user_stories, the height of the video frame. In top_ads, the height of the ad video's frame. |
| cover_url | Link to the post's cover image (photos). In top_ads, the link to the ad video's cover image; it is signed and expires, so download soon if you want to keep it. |
| video_url | Watermark-free video file URL (video_download, mp4). No cookie needed and no IP restriction; expires at expires_at; absent for photo posts. In top_ads, the URL of the ad's video file at 720p; it is signed and expires, so download soon if you want to keep it. |
| video_urls | File URLs of the ad video at each quality (top_ads): [{quality, url}], with quality such as 720p or 540p. The links are signed and expire, so download soon if you want to keep them. |
| platform | Source platform identifier, the same as platform in the request (for example 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
