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 Go
go mod init example
Call TikTok comment API from Go
GET /v1/tiktok/videos/{id}/comments/{comment_id}. Save this as main.go and run go run main.go. It prints comment.text and comment.digg_count.
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
// The fields this program reads, as the recorded response has them.
type Page struct {
Comment struct {
Text string `json:"text"`
DiggCount float64 `json:"digg_count"`
} `json:"comment"`
}
var client = &http.Client{Timeout: 60 * time.Second}
func fetch() (*Page, error) {
req, err := http.NewRequest("GET", "https://api.groundsocial.dev/v1/tiktok/videos/7707446852798549279/comments/7707556469470167839", nil)
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("GROUNDSOCIAL_API_KEY"))
res, err := client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
var e struct {
Error struct {
Code string `json:"code"`
Hint string `json:"hint"`
Retryable bool `json:"retryable"`
} `json:"error"`
}
json.NewDecoder(res.Body).Decode(&e)
return nil, fmt.Errorf("%s: %s", e.Error.Code, e.Error.Hint)
}
var page Page
if err := json.NewDecoder(res.Body).Decode(&page); err != nil {
return nil, err
}
return &page, nil
}
func main() {
page, err := fetch()
if err != nil {
log.Fatal(err)
}
fmt.Println(page.Comment.Text, page.Comment.DiggCount)
}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.
// fetch returns the API error as "code: hint". To retry the retryable ones
// (rate_limited, upstream_timeout), wait for Retry-After and call again:
for attempt := 0; attempt < 3; attempt++ {
page, err = fetch()
if err == nil {
break
}
time.Sleep(2 * time.Second)
}| 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, JavaScript, TypeScript, PHP, cURL.
- TikTok comment API reference: every field and status code.
- TikTok tutorials and all Go tutorials.
- TikTok API: every endpoint and price.
- How to scrape TikTok comments with Go: Comments on a TikTok video, 20 a page.
- How to scrape TikTok Shop reviews with Go: A TikTok Shop product’s rating breakdown and its first reviews.
- How to scrape TikTok profile with Go: A public TikTok profile: bio, links, verification, follower, like and video counts.
- How to scrape TikTok user videos with Go: A TikTok account’s videos, latest, most popular or oldest first (about 35 a page).
- How to scrape TikTok followers with Go: Accounts that follow a TikTok account, 30 a page.
- How to scrape TikTok following with Go: 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.