How to get TikTok video comments with Python
Find a video with one search call, then page through its comments 20 at a time. In our test 10 pages returned 200 comments; with the search that is 11 calls and $0.022.
Updated 2026-11-22·This page as Markdown
Step 1: find the video
Search TikTok by keyword. Each item's id is the video ID that the comments endpoint takes. If you already have a video link, skip this step: the ID is the number after /video/ in the link.
TikTok video search API·GET /v1/tiktok/videos/search·$0.002 a call
curl "https://xtikapi.com/v1/tiktok/videos/search?keyword=camping+coffee" \
-H "Authorization: Bearer YOUR_API_KEY"import requests
response = requests.get("https://xtikapi.com/v1/tiktok/videos/search", params={"keyword": "camping coffee"}, headers={"Authorization": "Bearer YOUR_API_KEY"}, timeout=60)
response.raise_for_status()
print(response.json()["data"])const URL = "https://xtikapi.com/v1/tiktok/videos/search";
const HEADERS = { Authorization: "Bearer YOUR_API_KEY" };
const response = await fetch(`${URL}?${new URLSearchParams({"keyword":"camping coffee"})}`, { headers: HEADERS });
const { data } = await response.json();
console.log(data);Recorded response (lists keep the first two items)
{
"data": {
"items": [
{
"id": "0779509297655120597",
"url": "https://example.com/link",
"text": "Example text",
"author": {
"id": "xx1xxxxxxxxxxx-xxxxxxxxxxxx5xxxx37x9x6xxx_xxxxxx76xxxxxxxxxxx0xxx30x02xxxxx2",
"username": "example_user",
"name": "Example name",
"avatar": "https://example.com/image.jpg",
"followers": 118728
},
"createdAt": "2026-11-07T13:41:13.000Z",
"likeCount": 257030,
"commentCount": 385,
"shareCount": 24319,
"viewCount": 2152698,
"cover": "https://example.com/image.jpg"
},
{
"id": "0776986179814197990",
"url": "https://example.com/link",
"text": "Example text",
"author": {
"id": "xx1xxxxxxxxx5xxxxxxxxxxx7xxx0xxxxxxx4-xxxxxxxxxxxxxxxx55xxxxx5x0xxxxxxxx9xxx",
"username": "example_user",
"name": "Example name",
"avatar": "https://example.com/image.jpg",
"followers": 53345
},
"createdAt": "2026-10-31T12:06:19.000Z",
"likeCount": 625844,
"commentCount": 1046,
"shareCount": 63850,
"viewCount": 8935392,
"cover": "https://example.com/image.jpg"
}
],
"has_more": true,
"next": {
"cursor": 20
}
},
"meta": {
"request_id": "example",
"endpoint": "tiktok.videos.search",
"normalized": true,
"unavailable": [],
"billing": {
"charged": true,
"amount": 0.002,
"balance": 4.98
}
}
}Step 2: read every page of comments
Pass the video ID as id. Each page returns about 20 comments; the loop adds data.next to the parameters until it is null. Each page is one call.
TikTok comments API·GET /v1/tiktok/comments/list·$0.002 a call
curl "https://xtikapi.com/v1/tiktok/comments/list?id=7708408003065580831" \
-H "Authorization: Bearer YOUR_API_KEY"import requests
URL = "https://xtikapi.com/v1/tiktok/comments/list"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"id": "7708408003065580831"}
items = []
for _ in range(10): # one call per page
for attempt in range(3): # 5xx errors are not charged: retry
response = requests.get(URL, params=params, headers=HEADERS, timeout=60)
if response.status_code < 500:
break
response.raise_for_status()
data = response.json()["data"]
items += data["items"]
if not data.get("next"): # null on the last page
break
params.update(data["next"])
print(len(items), "items")const URL = "https://xtikapi.com/v1/tiktok/comments/list";
const HEADERS = { Authorization: "Bearer YOUR_API_KEY" };
let params = {"id":"7708408003065580831"};
const items = [];
for (let page = 0; page < 10; page++) {
let response;
for (let attempt = 0; attempt < 3; attempt++) {
// 5xx errors are not charged: retry
response = await fetch(`${URL}?${new URLSearchParams(params)}`, { headers: HEADERS });
if (response.status < 500) break;
}
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { data } = await response.json();
items.push(...data.items);
if (!data.next) break; // null on the last page
params = { ...params, ...data.next };
}
console.log(items.length, "items");Recorded response (lists keep the first two items)
{
"data": {
"items": [
{
"id": "0772508255858426293",
"text": "Example text",
"author": {
"id": "xx1xxxxxxxxx8xxx1xxxxxxxxxxxxxxxxxxxxx_xxxx7xx4xxxx3xxxxxxxxxxxxxxxxxxxxxx0x",
"username": "example_user",
"name": "Example name",
"avatar": "https://example.com/image.jpg",
"followers": 0,
"description": "Example text"
},
"createdAt": "2026-11-15T15:38:44.000Z",
"likeCount": 349,
"replyCount": 5
},
{
"id": "0773410572235817260",
"text": "Example text",
"author": {
"id": "xx1xxxxxxxxxxx5xxxxxxxxx653x-1x2xx2xx8xxxx4xxx_xxxxxx1xx4xxxxxx5xxx7xxxxxx1x",
"username": "example_user",
"name": "Example name",
"avatar": "https://example.com/image.jpg",
"followers": 0,
"description": "Example text"
},
"createdAt": "2026-11-18T02:39:24.000Z",
"likeCount": 2,
"replyCount": 0
}
],
"has_more": true,
"next": {
"cursor": 20
}
},
"meta": {
"request_id": "example",
"endpoint": "tiktok.comments.list",
"normalized": true,
"unavailable": [],
"billing": {
"charged": true,
"amount": 0.002,
"balance": 4.98
}
}
}What the example costs
Failed calls and timeouts are not charged. A new account with a verified email gets $0.50 of trial balance, enough to run this example.
Good to know
- A page held 20 comments in our test on 2026-11-22.
- Replies are not included. Read them with
tiktok.comment_replies.list, passing the videoidand the comment'sidascomment_id. - Comments can arrive between two calls, so dedupe by
idwhen you merge pages.
Endpoints
- TikTok video search API · $0.002 a call
- TikTok comments API · $0.002 a call
More about TikTok
- TikTok-Api errors (EmptyResponseException, 200 empty body, Captcha, statusCode): how do I fix them?
- The TikTok comments endpoint in Douyin_TikTok_Download_API stopped working: what now?
- How do I get all videos under a TikTok hashtag?
- Can the TikTok Display API read other users' videos?
- Can I use the TikTok Research API for commercial work?
Questions
How much does this cost with XTikAPI?
The example here is 11 calls, $0.022 in total. Failed calls and timeouts are free, and a new account with a verified email gets $0.50 of trial balance.
Do I need the TikTok Research API?
No. The calls read public comments with an API key from this site; there is no application or approval step.