# Integrate HasData TikTok Comments API
## Task
Add the requested public-video comments or selected-comment replies workflow to this project using HasData TikTok Comments API.
Inspect project instructions, the server-side runtime, existing HTTP client, and tests first.
Follow the project's conventions and preserve unrelated code. No new SDK is required.
Implement only the requested workflow. If the workflow is unclear, ask which public video to use and whether the application needs top-level comments or replies to a selected comment.
Keep the integration as REST API calls; do not replace it with an MCP connection or a custom TikTok scraper.
## References
Read the endpoint documentation before implementing:
- Video comments, replies, and pagination: https://docs.hasdata.com/apis/tiktok/comments.md
- Error handling: https://docs.hasdata.com/api-codes.md
- Documentation index: https://docs.hasdata.com/llms.txt
- Full documentation (fallback): https://docs.hasdata.com/llms-full.txt
Start with the endpoint reference. Use `llms.txt` to find additional pages.
Use `llms-full.txt` only when needed; extract relevant sections instead of loading everything into context.
If a `.md` reference is unavailable, try its HTML URL without `.md`.
If it is still unavailable, ask for the missing documentation rather than guessing.
## Optional agent skill
If the official `hasdata` skill is already available, use its relevant guidance.
Otherwise, if this agent supports skills, ask before installing it in this project:
```sh
npx skills add hasdata/agent-skills --skill hasdata
```
Run from the project directory and select the coding agent in use.
The `hasdata-cli` skill is not required. If installation is declined or unsupported, continue with the docs.
Flag conflicts between skill guidance and current API docs rather than guessing.
## Implementation
- Use `GET https://api.hasdata.com/scrape/tiktok/comments` with required `videoId`. Extract the numeric identifier after `/video/` when accepting a TikTok URL; do not send the full URL as `videoId`.
- Preserve `videoId`, `commentId`, author IDs, and returned comment IDs as strings to avoid numeric precision loss.
- For replies, send the same `videoId` with `commentId` from a comment on that video. This returns the selected comment’s replies in the `comments` array. Retain the requested parent ID in application context.
- For requested pagination, pass `pagination.nextPageToken` as `nextPageToken` when `pagination.hasMore` is true, retaining the video and selected comment context. Tokens are opaque strings; do not calculate offsets.
- Read `comments` and `pagination` separately. Comment `text`, `replyCount`, and optional inline `replies` may be absent. Dedicated reply records need not include `replyCount`.
- Deduplicate records by comment ID. Neither `pagination.total`, a reply count, nor an inline reply selection guarantees a complete discussion or historical archive.
- Do not invent page-size, sorting, language, country, or date-filter parameters. Apply requested sorting or analysis to the collected data in application code.
- Topic grouping, sentiment scores, review priorities, summaries, scheduling, and alerts belong to the application. Preserve original text and allow ambiguous or unclassified results in any requested analysis.
- Embedded authors are limited public attributes. Profile and posts links require separate API requests; do not treat full bios or follower counts as included, and do not expand links automatically.
- Handle empty results and unavailable public videos. Do not infer why a comment lacks text or claim recovery of deleted or private content.
- Handle timeouts and documented errors before reading data. Keep requests server-side. If no suitable runtime exists, discuss options before changing the architecture.
## Credentials
- Implement the integration and mocked tests without requiring a live API key.
- Read `HASDATA_API_KEY` from the project's existing environment or secret store and send it as `x-api-key`.
- If the key is missing before live verification, ask the user to configure it from https://app.hasdata.com/api-keys.
- Never ask the user to paste the key into chat. Check only that it is configured, without printing its value.
- Never put the key in browser code, logs, or version control. Add only a placeholder to the project's example configuration.
- If using a local `.env` file, make sure it is gitignored.
- Send the key only to `https://api.hasdata.com`. Never forward it to documentation, TikTok, media links, bio links, or redirects to another origin.
## Verification
- Add mocked tests for video and comment ID validation, string precision, reply-parent context, pagination, duplicate IDs, missing text, replies without replyCount, empty results, timeouts, and errors. Include a usage example and run local checks.
- With a configured key and explicit user approval, including approval already given for this task, make one live verification request with agreed inputs. A successful TikTok request consumes 10 credits.
- Verify only the requested comments or replies query.
- Validate the HTTP status, documented API status, and response structure. An empty result set can be valid.
- Do not automatically repeat paid requests to obtain a nonempty response or follow pagination during this check.
- Report changed files, setup commands, and test results. State separately whether live verification passed, failed, or was skipped.
- Ask before deploying.TikTok Comments Scraper API
for audience research
Collect comment text, likes and author details as JSON. Analyze audience reactions without maintaining TikTok scrapers or parsers.
of requests succeed
median response
95% finish faster
per 1k requests at volume
TikTok changes its pages. Your code shouldn't care.
- Browser sessions and blocked requests
- Comments loaded behind interactive panels
- Nested author data to extract
- Reply endpoints and cursors to maintain
- Broken parsers after page changes
From video to structured comments
Bring a page of public video comments into your application with one HTTP request.
TikTok Comments Scraper API
curl -G 'https://api.hasdata.com/scrape/tiktok/comments' \
--data-urlencode 'videoId=7667749432279977230' \
--header 'x-api-key: <YOUR_API_KEY>' \
--header 'Content-Type: application/json'videoId * Video IDcommentId Comment IDnextPageToken Next Page TokenAdd TikTok Comments API with your AI agent
Paste a ready-to-use integration prompt into your coding agent. It includes API references, setup requirements, and testing instructions.
What you can build with TikTok Comments API
Build audience research and discussion review tools with public comment text, replies and engagement counts.
Turn audience questions into content ideas
Use comment text to identify recurring questions and prioritize topics for follow-up videos or FAQs.
- Video: 7667749432279977230
- Pls tell me this comes to Netflix 😭😭 @reginaldejiofor
- when is it coming out? @nickelelisa
- API data
comments[].idcomments[].textcomments[].likes- Your app
- Group related questions in your own analysis and count repetitions across the comments you collect.
Understand reactions to a public video
Feed comment text into your own sentiment analysis to compare audience reactions to content or campaign messages.
- Video: 7667749432279977230
| Comment | Published at (UTC) |
|---|---|
| excited but I need Alex and Bethany to be endgame | 2026-07-29T13:42:17.000Z |
| you’re telling me i have to wait until christmas… | 2026-07-29T02:36:24.000Z |
- API data
comments[].idcomments[].textcomments[].createTime- Your app
- Classify tone with your chosen model or review process, retain source text and inspect ambiguous or sarcastic comments.
Follow the discussion behind a comment
Retrieve replies to a selected comment to understand responses and follow-up questions in context.
- Video: 7667749432279977230
- Parent comment: 7667752263792673558
| Author | Reply |
|---|---|
| youngnyquilpluhhh | Even better bro in theaters |
| lilly.x762 | When!!!! |
- API data
comments[].idcomments[].textcomments[].author.username- Your app
- Request the selected comment’s replies and attach them to the parent using the video and comment IDs you supplied.
Prioritize comments that attract discussion
Use likes and reply counts to build a review queue for comments attracting audience attention.
- Video: 7667749432279977230
- Selected comments
| Comment | Likes | Replies |
|---|---|---|
| Pls tell me this comes to Netflix 😭😭 | 9,865 | 15 |
| excited but I need Alex and Bethany to be endgame | 353 | 8 |
| you’re telling me i have to wait until christmas… | 62 | 1 |
- API data
comments[].idcomments[].textcomments[].likescomments[].replyCount- Your app
- Rank collected comments by your review criteria and open relevant threads before deciding on a response.
Comment data, ready for analysis
Work with comment text, audience reactions and author details in structured fields for your research pipeline.
Comments & reactions
TikTok comments response excerpt.
{
"comments": [
{
"id": "7667752263792673558",
"text": "Pls tell me this comes to Netflix 😭😭",
"createTime": "2026-07-29T01:16:19.000Z",
"likes": 9853,
"replyCount": 15
},
{
"id": "7668401372559983368",
"text": "when is it coming out?",
"createTime": "2026-07-30T19:19:33.000Z",
"likes": 26,
"replyCount": 2
}
]
}comments[].id stringComment identifier for matching records across captures and requesting replies.
comments[].text stringComment text when available, preserving emoji and the original language.
comments[].createTime stringComment publication time in the returned ISO date-time format.
comments[].likes numberLike count for the comment, separate from likes on the video.
comments[].replyCount numberReported reply count. Request replies for a selected comment separately, even when some appear inline.
Comment replies
Replies to comment 7667752263792673558 from a separate commentId request. Excerpt shows two of the returned replies.
{
"comments": [
{
"id": "7667757315463021343",
"text": "Even better bro in theaters",
"createTime": "2026-07-29T01:35:22.000Z",
"likes": 594,
"author": {
"username": "youngnyquilpluhhh"
}
},
{
"id": "7667986950746342146",
"text": "When!!!!",
"createTime": "2026-07-29T16:25:56.000Z",
"likes": 3,
"author": {
"username": "lilly.x762"
}
}
]
}comments[].id stringReply identifier. In a commentId request, comments contains replies to the selected comment.
comments[].text stringReply text when available, useful for examining a response in its parent comment's context.
comments[].createTime stringReply publication time in ISO date-time format.
comments[].likes numberLikes on this reply, not on the parent comment.
comments[].author.username stringHandle of the author who posted the reply.
Comment authors
Author details from the same comments response.
{
"comments": [
{
"id": "7667752263792673558",
"author": {
"id": "7647954316968461345",
"username": "reginaldejiofor",
"nickname": "Reggie",
"hasdataLink": "https://api.hasdata.com/scrape/tiktok/profile?handle=reginaldejiofor",
"hasdataPostsLink": "https://api.hasdata.com/scrape/tiktok/posts?handle=reginaldejiofor"
}
}
]
}comments[].id stringLinks the author record to its comment.
comments[].author.id stringTikTok author identifier, preserved as a string.
comments[].author.username stringAuthor handle for matching comments to an account.
comments[].author.nickname stringDisplay name returned for the author, which can differ from the handle.
comments[].author.hasdataLink / comments[].author.hasdataPostsLink stringLinks to separate HasData profile and posts requests. Those datasets are not embedded in the comments response.
Pagination
Pagination metadata for the complete source response, not the shortened excerpts.
{
"pagination": {
"count": 23,
"total": 16607,
"hasMore": true,
"nextPageToken": "30"
}
}pagination.count numberNumber of comments in this response page, not the full conversation.
pagination.total numberTotal reported for this query. It is not a guarantee that every historical comment can be retrieved.
pagination.hasMore booleanIndicates whether the response offers another page.
pagination.nextPageToken stringContinuation token to pass into the next request. Use it as returned rather than calculating an offset.
See what your audience is saying
Use comments to find recurring questions, compare reactions and understand the discussions around public videos.
Find recurring questions
Collect comment text to identify repeated questions, product feedback and content ideas in your own analysis.
Compare audience reactions
Combine comment text with likes and reply counts to compare which discussions attract attention across videos.
Follow the conversation
Retrieve replies to selected comments and keep author handles alongside the text to examine the discussion in context.
An all-in-one scraping service
Connect comment data with TikTok videos and profile information through the same API platform.
Discover similar
scrapers and APIs
to expand your projects.
TikTok Scraper API
Videos Data • $0.83 / 1k Request
TikTok Profile Scraper API
Social Media Intelligence • $0.83 / 1k Request
Fits right into your stack.
Works with the tools you already use.
View Documentation ->What developers say about HasData
Feedback from HasData customers.
HasData delivers exactly what we need: speed and comprehensive search features. It's the fastest API we've used in this space. Plus, their customer support is fantastic.
We rely on HasData for search performance data and broader scraping needs. Their APIs deliver highly structured data that integrates directly into our platforms.
Great web scraping API which is incredibly easy to use. It requires minimal effort to get up and running, and the documentation is very clear and helpful.
I needed to scrape some information they didn't already support, and they wrote the code for me right away, which was super nice of them.
We were particularly impressed with how easily we could integrate HasData into our existing workflow.
Plans that get cheaper at scale
Choose your request volume and concurrency. Pay for successful requests, with no metered overage.
Free
Startup
Basic
RecommendedGrowth
Monthly request volume
Custom price based on required volume
Past 20M credits a month, or terms the self-serve plans do not cover. We shape the contract around your workload. Past 20M credits a month, or need terms the self-serve plans do not cover? We shape the contract, concurrency, and support around your workload.
HasData accesses publicly available data only. TikTok's terms may restrict automated access; you are responsible for compliance. Where data includes personal information, ensure a lawful basis under GDPR/CCPA.
Questions, answered
Use the numeric video ID from the part after /video/ in a TikTok URL. Requests use a HasData API key and work with public data. This is an independent scraper, not an official TikTok API.
Yes. Send the video ID together with commentId to request that comment's replies instead of the video's top-level comments. Some replies may also appear inline in a comments response, but replyCount alone is only a count. Pagination applies to the selected query.
When pagination.hasMore is true, pass pagination.nextPageToken into the next request for the same video and comment query. Page sizes can vary. Use the returned token rather than inventing an offset, and deduplicate records by comment ID.
The API returns the comments TikTok makes available for the requested query. Some records may omit text. Deleted comments, private content and unavailable results cannot be recovered. The reported total is not a guarantee of a complete historical archive.
Comments contain author details such as the account ID, handle and display name. Profile and posts links point to separate HasData requests. Full biographies, follower counts and video datasets are not part of this comments response.
Yes. Use the returned text as input to your own sentiment or topic-analysis workflow. The endpoint supplies comment data and counts, not sentiment scores, summaries or moderation decisions.
Per successful request, not per comment. A TikTok Comments request costs 10 credits. Fetching another page or a reply thread is a separate request. The free plan includes 1,000 credits every month, covering up to 100 requests, with no credit card required. Failed requests consume no credits.
Check the API response and confirm that the video is public and its ID is correct. For replies, use a comment ID from that video. Handle errors before reading comments, and allow for empty results when a discussion is unavailable.
On September 14, 2026, 18 first-page requests across five public videos returned valid responses. Median client-observed time was 3.2 seconds and P95 was 5.1 seconds, with up to two concurrent requests and no automatic retries. The separate pagination and reply checks are not included in those timing figures. Videos were reused and cache state was unknown. This small sample is not an uptime SLA or a guarantee of future latency.
Your first TikTok comments response
is minutes away
100 requests free · no credit card