面向智能体
一行即可把整个 API 交给 LLM 或智能体。
智能体所需的一切,只需一个 URL 即可获得。请选择适合您的客户端的那一个。
| 需求 | URL |
|---|---|
| 文档,简短索引 | https://tikdataapi.com/llms.txt |
| 文档,全部内容合为一个文件 | https://tikdataapi.com/llms-full.txt |
| 以 Markdown 获取单个文档页面 | 在其 URL 后加上 .md,例如 https://tikdataapi.com/docs/coverage.md |
| 接口规范,OpenAPI 3.1 | https://api.tikdataapi.com/openapi.yaml,或 https://tikdataapi.com/openapi.json |
| 工具,MCP 服务器 | https://api.tikdataapi.com/mcp(自动登录,或使用请求头 x-api-key) |
| 实时健康状态,JSON | https://api.tikdataapi.com/status |
| 以上所有内容的目录 | https://api.tikdataapi.com/ |
每个文档页面在收到带有 Accept: text/markdown 的请求时,也会以 Markdown 返回。
可直接粘贴的提示词
Use the tikdataapi.com API to read public TikTok data: profiles, videos, comments, replies, hashtags, sounds,
video, account, sound, live and hashtag search, follower and following lists, reposts, playlists, related and
trending videos, whether an account is live, and video transcripts.
Docs: https://tikdataapi.com/llms-full.txt. Base URL https://api.tikdataapi.com, header x-api-key: tt_live_...
Every response has credits_charged and balance_remaining; stop when balance_remaining is 0. Errors are JSON
with a stable "code" field. Pages return next_cursor; pass it back as cursor. Find accounts with account search
(short profiles; read the full profile with /v1/users/{user}). Hashtag search ranks the hashtags of the videos of
the general search: its counts are of those videos, not the totals of TikTok (read /v1/hashtags/{name} for those).一行接入 MCP
claude mcp add --transport http tikdataapi https://api.tikdataapi.com/mcp命令中不含密钥:服务器会通过浏览器让客户端登录,客户端会获得自己的凭据。其他客户端,以及适用于没有浏览器的机器的请求头方式,请参见 MCP 服务器。这 27 个工具都是只读的,并带有相应的标注,因此会自动批准只读工具的客户端不会在每次调用时都弹出确认。
为什么这个 API 便于智能体使用
- 扁平对象。
User、Video、Comment和Hashtag在每个接口上的结构都相同。没有需要层层深入的包装层。 - 稳定的错误代码。
no_credits、not_found、rate_limited、busy、upstream_rate_limited。错误页面说明了每种错误的处理方法。失败的请求不收费。 - 响应中包含费用。 每次调用都返回
credits_charged和balance_remaining,智能体无需额外请求即可管理预算。 - 每个对象都带有时间。
collected_at说明我们是何时从 TikTok 读取它的,因此智能体知道某个计数有多旧。 - 使用游标,而非页码。
next_cursor是不透明的值;将其作为cursor传回即可。没有游标表示已到末尾。 - 批量。 一次调用最多可处理 100 个用户名或视频 id,只计费一次,错误按条目返回。参见批量。
- 幂等读取。 所有操作都是读取。重试始终是安全的;在缓存时间窗口内重复请求只需一半费用。
- 每个智能体一个密钥。 在控制台中为每个智能体创建一个密钥,这样可以单独吊销其中一个。