How to get TikTok comments with Python
2 endpoints do it: TikTok video search → TikTok video comments. The worked example below is 11 calls and costs $0.0220 in all; a failed call is not charged.
You get the comments under the TikTok videos on a topic: text, commenter, likes, reply count and time, 50 to a page. Every step below has its Python beside cURL, TypeScript and the command line.
Step 1: TikTok video search
Search TikTok videos for your keyword. Each result has its id and its comment count in metrics.comments; the next step takes the id. Already have the video's link? Skip this step: the next one takes a link as url too.
curl -G "https://api.dataxapi.com/v1/tiktok/videos/search" \ --data-urlencode "query=space station" \ -H "Authorization: Bearer $DATAXAPI_API_KEY"
from dataxapi import DataXAPI dx = DataXAPI() # reads DATAXAPI_API_KEY result = dx.tiktok.videos.search(query="space station") print(result["data"]["items"])
import { DataXAPI } from "@dataxapi/sdk";
const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.tiktok.videos.search({ query: "space station" });
console.log(result.data.items);dataxapi call tiktok.videos.search 'query=space station'{
"code": "ok",
"request_id": "eecdbf3f-64ce-4b11-b396-ee190d7ff728",
"data": {
"items": [
{
"id": "7566364515678793552",
"url": "https://www.tiktok.com/@trail_and_lens/video/7566364515678793552",
"type": "video",
"text": "My honest take on space station, a month in.",
"lang": "en",
"published_at": "2026-10-11T23:17:34.000Z",
"author": {
"id": "6279025233109159764",
"username": "trail_and_lens",
"name": "Maya Chen",
"avatar_url": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/fff322a0d982cccf1e82~c5_100x100.jpeg",
"followers": 92601
},
"metrics": {
"likes": 353,
"comments": 11,
"shares": 19,
"favorites": 40,
"views": 7561
},
"hashtags": [
"weekendvibes",
"gearreview",
// … 2 more
],
"mentions": []
},
// … 29 more
]
},
"page": {
"next_cursor": "c1.bGY_kn5Dxsgl6MN3VXHyMcLAdlxPxQw-FwjswIlE",
"cursor_expires_at": "2026-10-12T20:17:24.000Z",
"has_more": true,
"returned": 30
},
"warnings": [],
"meta": {
"capability": "tiktok.videos.search",
"result_status": "complete",
"fetched_at": "2026-10-12T19:17:24.000Z",
"cached": false,
"replayed": false,
"unavailable": {
"title": "platform",
"images": "capability",
"author.verified": "capability",
"metrics.reposts": "capability",
"mentions.username": "capability",
"mentions.name": "capability",
"post_id": "platform",
"parent_id": "platform",
"root_id": "platform",
"is_pinned": "capability"
},
"billing": {
"amount": "0.002",
"currency": "USD",
"balance_after": "9.998"
}
}
}From a response recorded 2026-10-12 19:17 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.
TikTok video search · $0.0020 / a call · Parameters, fields and errors on the endpoint's page →
Step 2: TikTok video comments
Get the comments of each video by its id. In Python, loop: pass page.next_cursor as cursor until page.has_more is false, and add data.items to your table on each pass.
curl -G "https://api.dataxapi.com/v1/tiktok/videos/comments/list" \ --data-urlencode "id=7665840565958872333" \ -H "Authorization: Bearer $DATAXAPI_API_KEY"
from dataxapi import DataXAPI dx = DataXAPI() # reads DATAXAPI_API_KEY result = dx.tiktok.videos.comments.list(id="7665840565958872333") print(result["data"]["items"])
import { DataXAPI } from "@dataxapi/sdk";
const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.tiktok.videos.comments.list({ id: "7665840565958872333" });
console.log(result.data.items);dataxapi call tiktok.videos.comments.list id=7665840565958872333
{
"code": "ok",
"request_id": "49a9388e-860b-401b-9189-91392b4dbe4c",
"data": {
"items": [
{
"id": "7249404573671997643",
"text": "Finally someone explains it properly.",
"published_at": "2026-10-08T14:20:19.000Z",
"author": {
"id": "6405221235864634600",
"username": "northside_coffee",
"name": "Leo Park",
"avatar_url": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/b53b29284ec746c5795e~c5_100x100.jpeg"
},
"metrics": { "likes": 1430, "comments": 37 },
"post_id": "7314577132464284710",
"parent_id": null,
"root_id": null
},
// … 49 more
]
},
"page": {
"next_cursor": "c1.ILIjF_oJ0LYoN_N-5Pz5rAlsEbq5IITvnA7EL4Hr",
"cursor_expires_at": "2026-10-12T19:45:47.000Z",
"has_more": true,
"returned": 50
},
"warnings": [],
"meta": {
"capability": "tiktok.videos.comments.list",
"result_status": "complete",
"fetched_at": "2026-10-12T18:45:47.000Z",
"cached": false,
"replayed": false,
"unavailable": { "url": "platform" },
"billing": {
"amount": "0.002",
"currency": "USD",
"balance_after": "9.998"
}
}
}From a response recorded 2026-10-12 18:45 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.
TikTok video comments · $0.0020 / a call · Parameters, fields and errors on the endpoint's page →
What the example costs
one page of search results, then two pages of comments under each of the first 5 videos
Prices are the prices in force when this page was built. A failed call, and an object that does not exist, cost nothing.
In your AI (MCP)
Connect DataXAPI to your AI client once. Then say what you want; the agent finds these endpoints, checks the price and calls them on your balance.
{
"capability": "tiktok.videos.search",
"query": "space station",
"idempotency_key": "<a new UUID>"
}Sign in to copy the setup prompt with your keyAbout the MCP server →
With a Skill
Good to know
- Comments come 50 a page and the search 30 a page; a cursor works for an hour.
- Replies to a comment are not in this list. A comment's
metrics.commentsis its reply count, and the comment replies endpoint gets the replies by the comment's ID and its video's ID. - A comment has no link of its own:
urlis not returned. - A video that does not exist cannot be told from a video without comments: both come back as an empty page, which is charged.