# 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 by step

### 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. ([TikTok video search](https://dataxapi.com/apis/tiktok/videos/search/), $0.0020 / a call)

cURL

```bash
curl -G "https://api.dataxapi.com/v1/tiktok/videos/search" \
  --data-urlencode "query=space station" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
```

Python

```python
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.tiktok.videos.search(query="space station")
print(result["data"]["items"])
```

TypeScript

```typescript
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);
```

CLI

```bash
dataxapi call tiktok.videos.search 'query=space station'
```

Recorded response: 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.

```jsonc
{
  "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"
    }
  }
}
```

### 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. ([TikTok video comments](https://dataxapi.com/apis/tiktok/videos/comments/list/), $0.0020 / a call)

cURL

```bash
curl -G "https://api.dataxapi.com/v1/tiktok/videos/comments/list" \
  --data-urlencode "id=7665840565958872333" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
```

Python

```python
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.tiktok.videos.comments.list(id="7665840565958872333")
print(result["data"]["items"])
```

TypeScript

```typescript
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);
```

CLI

```bash
dataxapi call tiktok.videos.comments.list id=7665840565958872333
```

Recorded response: 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.

```jsonc
{
  "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"
    }
  }
}
```

## What the example costs

one page of search results, then two pages of comments under each of the first 5 videos

| Endpoint | Calls | Price | Subtotal |
| --- | --- | --- | --- |
| [TikTok video search](https://dataxapi.com/apis/tiktok/videos/search/) | 1 | $0.0020 | $0.0020 |
| [TikTok video comments](https://dataxapi.com/apis/tiktok/videos/comments/list/) | 10 | $0.0020 | $0.0200 |
| Total | 11 |  | $0.0220 |

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.

Say: Use DataXAPI to search TikTok for “space station”, get two pages of comments under each of the top 5 videos, and put them in one table.

What the agent sends to the call tool: 

```json
{
  "capability": "tiktok.videos.search",
  "query": "space station",
  "idempotency_key": "<a new UUID>"
}
```

[About the MCP server](https://dataxapi.com/mcp/)

## With a Skill

The Comments and word of mouth Skill does this job as a ready-made task, under a spending cap. “What are people praising and complaining about under this post?” Its example run: 3 calls, at most $0.0060. [Comments and word of mouth](https://dataxapi.com/skills/comments/)

## 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.comments` is 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: `url` is 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.

## Endpoints

- [TikTok video search](https://dataxapi.com/apis/tiktok/videos/search/)
- [TikTok video comments](https://dataxapi.com/apis/tiktok/videos/comments/list/)

## More about TikTok

- [TikTok API](https://dataxapi.com/apis/tiktok/)
- [How to get a TikTok video transcript](https://dataxapi.com/guides/tiktok-video-transcript/)
- [How to search TikTok Shop products and read their reviews](https://dataxapi.com/guides/tiktok-shop-product-reviews/)
- [Can ChatGPT read TikTok?](https://dataxapi.com/answers/can-chatgpt-read-tiktok/)

---

Catalog revision c48ce454ae6c4c65. [HTML version](https://dataxapi.com/guides/tiktok-comments-python/)
