Before you start
- Get an API keySign up for 100 free credits, no card. Keys start with
gs_live_. - Put it in the environmentEvery example reads it from
GROUNDSOCIAL_API_KEY:export GROUNDSOCIAL_API_KEY=gs_live_… - Set up JavaScript
node --version # 18 or newer: fetch is built in, nothing to install
Call TikTok comment API from JavaScript
GET /v1/tiktok/videos/{id}/comments/{comment_id}. Save this as main.mjs and run node main.mjs. It prints comment.text and comment.digg_count.
// main.mjs: Node.js 18+, no dependencies
const url = new URL('https://api.groundsocial.dev/v1/tiktok/videos/7707446852798549279/comments/7707556469470167839')
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}`,
},
signal: AbortSignal.timeout(60_000),
})
if (!res.ok) {
const { error } = await res.json()
throw new Error(`${error.code}: ${error.hint ?? error.message}`)
}
const data = await res.json()
console.log(data.comment?.text, data.comment?.digg_count)
console.log('credits charged:', res.headers.get('x-credits-charged'))The response
A real TikTok response to this call, recorded from the live source and shortened for display: arrays keep their first items and … marks every cut. Live calls return current data in the same shape.
{
"comment": {
"cid": "7707556469470167839",
"aweme_id": "7707446852798549279",
"text": "this with broccoli 😻",
"create_time": 1794555420,
"digg_count": 5269,
"reply_comment_total": 6,
"reply_id": "0",
"user": {
"uid": "6925204018239423494",
"unique_id": "neiaiko",
"nickname": "️",
"sec_uid": "MS4wLjABAAAAEo1OPo8CphE2eSfko8lzW0EfSFPmJBGkkYNI7RlwtaKZyZ0_luvXgJmxhYAGrfbM",
"account_labels": null,
"ad_cover_url": null,
"advance_feature_item_order": null,
"advanced_feature_info": null,
"avatar_thumb": {
"uri": "tos-useast8-avt-0068-tx2/ed7196c0669bb6debe0de857aec546ad",
"url_list": [
"https://p19-common-sign.tiktokcdn-us.com/tos-useast8-avt-0068-tx2/ed7196c0669bb6debe0de857aec546ad~tplv-tiktokx-cropcent…",
"https://p16-common-sign.tiktokcdn-us.com/tos-useast8-avt-0068-tx2/ed7196c0669bb6debe0de857aec546ad~tplv-tiktokx-cropcent…",
"… 1 more"
],
"url_prefix": null
},
"bold_fields": null,
"can_message_follow_status_list": null,
"can_set_geofencing": null,
"cha_list": null,
"cover_url": null,
"custom_verify": "",
"enterprise_verify_reason": "",
"events": null,
"followers_detail": null,
"geofencing": null,
"homepage_bottom_toast": null,
"item_list": null,
"mutual_relation_avatars": null,
"need_points": null,
"platform_sync_info": null,
"…": "8 more fields"
},
"comment_language": "en",
"is_author_digged": true,
"author_pin": false,
"allow_download_photo": true,
"collect_stat": 0,
"comment_post_item_ids": null,
"content_type": 1,
"fold_status": -1,
"image_list": null,
"is_comment_translatable": true,
"is_high_purchase_intent": false,
"label_list": [
{
"text": "Liked by creator",
"type": 20
}
],
"no_show": false,
"reply_comment": [
{
"allow_download_photo": true,
"author_pin": false,
"aweme_id": "7707446852798549279",
"cid": "7707639744872497951",
"collect_stat": 0,
"comment_language": "en",
"comment_post_item_ids": null,
"content_type": 1,
"create_time": 1794574801,
"digg_count": 1689,
"fold_status": 0,
"image_list": null,
"is_author_digged": false,
"is_comment_translatable": true,
"is_high_purchase_intent": false,
"label_list": [
{
"text": "Creator",
"type": 1
}
],
"label_text": "Creator",
"label_type": 1,
"no_show": false,
"reply_comment": null,
"reply_id": "7707556469470167839",
"reply_to_reply_id": "0",
"seeking_help_model_type": 0,
"service_id": "-1",
"…": "14 more fields"
}
],
"reply_to_reply_id": "0",
"seeking_help_model_type": 0,
"…": "15 more fields"
},
"pagesScanned": 1
}Top-level fields
| Field | Type | Description |
|---|---|---|
comment | TikTokComment | A comment, in the shape of TikTok’s comment API. |
pagesScanned | number | – |
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | A video (or photo post) id, or its URL (www.tiktok.com/@user/video/<id>). Example: 7707446852798549279. |
comment_id (required) | path | string | The comment’s cid. Example: 7707556469470167839. |
parent_comment_id | query | string | For a reply: the cid of the comment it replies to. |
Errors and retries
Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.
async function call(url, init = {}, attempt = 0) {
const res = await fetch(url, {
...init,
headers: { Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}`, ...init.headers },
signal: AbortSignal.timeout(60_000),
})
if (res.ok) return res.json()
const { error } = await res.json()
// Branch on error.code (stable); error.hint says what to do next.
if (error.retryable && attempt < 2) {
const wait = Number(res.headers.get('retry-after') ?? 2)
await new Promise((r) => setTimeout(r, wait * 1000))
return call(url, init, attempt + 1)
}
throw Object.assign(new Error(error.hint ?? error.message), { code: error.code })
}| Status | Meaning |
|---|---|
200 | The comment. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The account, video, comment, hashtag or sound does not exist on TikTok, or was removed. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | TikTok is temporarily unavailable. Retryable; nothing was charged. |
Every error code and what to do about it.
Pricing
| Cost | |
|---|---|
| Per call | 2 credits per call |
| 1,000 calls | $2.00 on the starter pack, $0.80 at volume |
| No key (MPP or x402) | $0.02 per call |
| Failed call | Refunded, never charged |
Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.
From an AI agent (MCP)
The same call is the tiktok_comment_get tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcpThen ask for it in words (“One TikTok comment by id, with its current likes and replies”), or call the tool directly:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "tiktok_comment_get",
"arguments": {
"id": "7707446852798549279",
"comment_id": "7707556469470167839"
}
}
}MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.
Track a comment
Re-read a pinned or viral comment to follow its likes.
Keep going
- This call in Python, TypeScript, Go, PHP, cURL.
- TikTok comment API reference: every field and status code.
- TikTok tutorials and all JavaScript tutorials.
- TikTok API: every endpoint and price.
- How to scrape TikTok comments with JavaScript: Comments on a TikTok video, 20 a page.
- How to scrape TikTok Shop reviews with JavaScript: A TikTok Shop product’s rating breakdown and its first reviews.
- How to scrape TikTok profile with JavaScript: A public TikTok profile: bio, links, verification, follower, like and video counts.
- How to scrape TikTok user videos with JavaScript: A TikTok account’s videos, latest, most popular or oldest first (about 35 a page).
- How to scrape TikTok followers with JavaScript: Accounts that follow a TikTok account, 30 a page.
- How to scrape TikTok following with JavaScript: Accounts a TikTok account follows, 30 a page (when the list is public).
Run it on your own data
One key for TikTok and 76 more platforms, over REST or MCP. Free credits on signup, no card.
TikTok is a trademark of ByteDance Ltd. We are not affiliated with or endorsed by TikTok or ByteDance.