TikTok Trending Videos
Structured TikTok data: send country_code. Cursor-paginated, 1 credit per successful call.
Overview
Section titled “Overview”Call GET /api/v2/tiktok-trending-videos/ with country_code. The results are in data.videos; send data.next_cursor back as cursor to get the next page. 7 optional parameters refine the call (see Parameters).
Request
Section titled “Request”curl -G "https://api.scrapier.io/api/v2/tiktok-trending-videos/" \ -H "X-API-Key: YOUR_API_KEY" \ --data-urlencode "country_code=US" \ --max-time 210const params = new URLSearchParams({ country_code: "US" });
const res = await fetch(`https://api.scrapier.io/api/v2/tiktok-trending-videos/?${params}`, { headers: { "X-API-Key": "YOUR_API_KEY" }, signal: AbortSignal.timeout(210_000),});const body = await res.json();if (!res.ok) throw new Error(body.error ?? body.detail ?? `HTTP ${res.status}`);
console.log(body.data.videos);import requests
resp = requests.get( "https://api.scrapier.io/api/v2/tiktok-trending-videos/", headers={"X-API-Key": "YOUR_API_KEY"}, params={"country_code": "US"}, timeout=210,)body = resp.json()if not resp.ok: raise RuntimeError(body.get("error") or body.get("detail"))
print(body["data"]["videos"])curl -X POST "https://api.scrapier.io/api/v2/tiktok-trending-videos/" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"country_code":"US"}' \ --max-time 210Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
X-API-Key header | string | yes | — | Your API key from the dashboard. |
country_code | string | yes | e.g. US | Country: US, JP, VN, TH or ID (the countries TikTok Creative Center ranks videos for). Required on first call; ignored when cursor is supplied.USJPVNTHID |
cursor | string | no | — | Pagination cursor returned in the previous response's next_cursor. Pass it back unchanged to fetch the next page. When next_cursor is null, you have reached the last page. |
sort_by | string | no | hot | Ranking metric: hot/views (video views), engagement (alias like/share/comment), six_second_views. Locked into the cursor. hotviewsengagementsix_second_viewsviewlikesharecomment |
period | string | no | 7 | 7 (videos created in last 7 days), 30 (last 30 days), weekly, monthly. Deeper pages walk older ranking windows. Locked into the cursor. 730weeklymonthly |
content_tag | string | no | — | Optional content filter (comma-separated): beauty, fashion, food, lifestyle, tech. Empty = all. Locked into the cursor. |
organic_only | boolean | no | false | Only organic (non-promoted) videos. Locked into the cursor. |
page_size | integer | no | 25 | Videos per page (1-100). Locked into the cursor. |
include_details | boolean | no | false | true = add tiktok.com stats (likes, shares, comments, saves, plays, duration) per video, fetched in parallel within the call ~24 s budget; a video whose stats miss the budget is still returned with stats null and stats_pending=true (Creative Center views/engagement always present). false = listing only (~3-5 s). Locked into the cursor. |
Advanced
| Name | Type | Default | Description |
|---|---|---|---|
use_proxy | boolean | true | Route the request through Scrapier's residential proxy pool. Default: true. Leave as is unless support tells you otherwise. |
raw_data | boolean | false | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under raw_responses, in place of the formatted items. When false (default) you get the formatted output. Pagination (cursor / next_cursor) works the same in both modes. |
Response
Section titled “Response”{ "success": true, "data": { "country_code": "US", "period": "7", "sort_by": "views", "page": 1, "page_size": 25, "videos": [ { "country_code": "US", "cover": "https://p16-common-sign.tiktokcdn-us.com/tos-useast5-p-0068-tx/o81vAiZAY0BgmWspOa5ZIkVEAiWDCTBErj4A2~tplv-tiktokx-origin.image", "duration": 66, "id": "7680342145466780941", "item_id": "7680342145466780941", "item_url": "https://www.tiktok.com/@renz.sadiwa/video/7680342145466780941", "region": "United States", "title": "3 NEW Gemini Live Features That Should Not Be This Good", "diggCount": 23700, "shareCount": 844, "commentCount": 212, "playCount": 66100000, "collectCount": 3356, "videoUrl": "https://v16-webapp-prime.tiktok.com/video/tos/alisg/...", "video_id": "7680342145466780941", "url": "https://www.tiktok.com/@renz.sadiwa/video/7680342145466780941", "description": "3 NEW Gemini Live Features That Should Not Be This Good", "author_username": "renz.sadiwa", "author_nickname": "Renz Sadiwa", "author_id": "6757836093687514118", "author_followers": 208907, "author_avatar": "https://p16-common-sign.tiktokcdn-us.com/tos-useast5-avt-0068-tx/fd28960c3222a012607ffe91574d4134~tplv-tiktokx-cropcenter:300:300.jpeg", "author_bio": "Tech | Lifestyle", "create_time": "2026-08-31T23:30:28Z", "play_count": 66100000, "like_count": 23700, "video_views": 39218761, "video_views_lifetime": 52968271, "organic_video_views": 489679, "organic_video_views_lifetime": 1166715, "engagement_rate": 0.000392, "engagement_rate_lifetime": 0.000382, "six_seconds_vtr": 0.012569, "six_seconds_vtr_lifetime": 0.012242, "cover_avif": "https://p16-common-sign.tiktokcdn-us.com/tos-useast5-p-0068-tx/o81vAiZAY0BgmWspOa5ZIkVEAiWDCTBErj4A2~tplv-photomode-zoomcover-tcm:720:720.avif", "rank": 1, "period": "7", "sort_by": "views", "content_tag": "all", "organic_only": false, "ranking_window_end": "2026-09-28T00:00:00Z", "ranking_window_index": 0, "scraped_at": "2026-10-01T12:00:00.000Z", "input_country": "US", "stats_pending": false } ], "next_cursor": "tv1.eNpVjk0KgzAQhe8y6yzM1L8DdNdlj1B0YhtQoyamFfHuJlHaLoZh3ve-YZ5QaYdQFKUWbbOlhh8CLeEBwj2nr3G7kTAJcE5TZOlo5dPxH0pNFE0mnA8MiPAy4j0SwMn9VQ5mlkDq3Zx0zLVz52Y8WjiUL" }}Bad input. The exact message varies by endpoint.
{ "success": false, "error": "…"}Balance below the endpoint’s price.
{ "error": "Insufficient credits. Buy more to scrape more.", "balance": 1, "required": 2}Invalid or unknown API key.
{ "detail": "Authentication service unavailable or invalid API key."}Throttled — wait for Retry-After.
{ "detail": "Request was throttled. Expected available in N seconds."}Sample from the live catalog; arrays trimmed to 3 items. Results are in data.videos.
Response fields
Section titled “Response fields”| Field | Type | Example | Description |
|---|---|---|---|
country_code | string | US | — |
period | string | 7 | — |
sort_by | string | views | — |
page | integer | 1 | — |
page_size | integer | 25 | — |
videos | array | [1 item] | The results. |
next_cursor | string | tv1.eNpVjk0KgzAQhe8y6yzM1L8DdNdlj1B0YhtQoyamF… | Pass back as cursor for the next page. null on the last page. |
videos[].country_code | string | US | — |
videos[].cover | string | https://p16-common-sign.tiktokcdn-us.com/tos-… | — |
videos[].duration | integer | 66 | — |
videos[].id | string | 7680342145466780941 | — |
videos[].item_id | string | 7680342145466780941 | — |
videos[].item_url | string | https://www.tiktok.com/@renz.sadiwa/video/768… | — |
videos[].region | string | United States | — |
videos[].title | string | 3 NEW Gemini Live Features That Should Not Be… | — |
videos[].diggCount | integer | 23700 | — |
videos[].shareCount | integer | 844 | — |
videos[].commentCount | integer | 212 | — |
videos[].playCount | integer | 66100000 | — |
videos[].collectCount | integer | 3356 | — |
videos[].videoUrl | string | https://v16-webapp-prime.tiktok.com/video/tos… | — |
videos[].video_id | string | 7680342145466780941 | — |
videos[].url | string | https://www.tiktok.com/@renz.sadiwa/video/768… | — |
videos[].description | string | 3 NEW Gemini Live Features That Should Not Be… | — |
videos[].author_username | string | renz.sadiwa | — |
videos[].author_nickname | string | Renz Sadiwa | — |
videos[].author_id | string | 6757836093687514118 | — |
videos[].author_followers | integer | 208907 | — |
videos[].author_avatar | string | https://p16-common-sign.tiktokcdn-us.com/tos-… | — |
videos[].author_bio | string | Tech | Lifestyle | — |
videos[].create_time | string | 2026-08-31T23:30:28Z | — |
videos[].play_count | integer | 66100000 | — |
videos[].like_count | integer | 23700 | — |
videos[].video_views | integer | 39218761 | — |
videos[].video_views_lifetime | integer | 52968271 | — |
videos[].organic_video_views | integer | 489679 | — |
videos[].organic_video_views_lifetime | integer | 1166715 | — |
videos[].engagement_rate | number | 0.000392 | — |
videos[].engagement_rate_lifetime | number | 0.000382 | — |
videos[].six_seconds_vtr | number | 0.012569 | — |
videos[].six_seconds_vtr_lifetime | number | 0.012242 | — |
videos[].cover_avif | string | https://p16-common-sign.tiktokcdn-us.com/tos-… | — |
videos[].rank | integer | 1 | — |
videos[].period | string | 7 | — |
videos[].sort_by | string | views | — |
videos[].content_tag | string | all | — |
videos[].organic_only | boolean | false | — |
videos[].ranking_window_end | string | 2026-09-28T00:00:00Z | — |
videos[].ranking_window_index | integer | 0 | — |
videos[].scraped_at | string | 2026-10-01T12:00:00.000Z | — |
videos[].input_country | string | US | — |
videos[].stats_pending | boolean | false | — |
Pagination
Section titled “Pagination”Pass data.next_cursor back as cursor until it is null. Required inputs are ignored once a cursor is sent. Each page is one billed call. More in Pagination.
const url = "https://api.scrapier.io/api/v2/tiktok-trending-videos/";let params = { country_code: "US" };const items = [];
for (let page = 0; page < 10; page++) { // each page is one billed call const res = await fetch(`${url}?${new URLSearchParams(params)}`, { headers: { "X-API-Key": "YOUR_API_KEY" }, signal: AbortSignal.timeout(210_000), }); const body = await res.json(); if (!res.ok) throw new Error(body.error ?? body.detail ?? `HTTP ${res.status}`); const data = body.data; items.push(...(data.videos ?? [])); if (!data.next_cursor) break; // null = last page params = { cursor: data.next_cursor };}import requests
URL = "https://api.scrapier.io/api/v2/tiktok-trending-videos/"HEADERS = {"X-API-Key": "YOUR_API_KEY"}params = {"country_code": "US"}items = []
for _ in range(10): # each page is one billed call resp = requests.get(URL, headers=HEADERS, params=params, timeout=210) resp.raise_for_status() data = resp.json()["data"] items.extend(data.get("videos") or []) if not data.get("next_cursor"): # None = last page break params = {"cursor": data["next_cursor"]}Errors
Section titled “Errors”Failed calls are free. Branch on the HTTP status and read the message from error (or detail). Full details in Errors.
| Status | Meaning | Retry? | Charged? |
|---|---|---|---|
400 | Bad or missing input. | No — fix the params | No |
401 / 403 | Missing, invalid or revoked API key. | No — fix the key | No |
402 | Out of credits (body has balance). | No — top up | No |
404 | Unknown endpoint slug. | No — check the slug | No |
429 / 503 | Busy or throttled. | Yes — after Retry-After | No |
5xx | Target site or upstream failure, or timeout. | Yes — with backoff | No |
- Nothing special: send the inputs, read the result.
Related
Section titled “Related”- TikTok Ad Library Leads — Structured TikTok data: every input is optional. Single lookup, 3 credits per successful call.
- TikTok Ad Library — Structured TikTok data: send
urls. Cursor-paginated, 1 credit per successful call. - TikTok Ads Top — Structured TikTok data: every input is optional. Cursor-paginated, 1 credit per successful call.
- TikTok Collection Videos — Structured TikTok data: send
urls. Cursor-paginated, 1 credit per successful call.