# For agents

> Hand the whole API to an LLM or agent in one line.

Everything an agent needs is a URL away. Pick the one that fits the client.

| Need | URL |
|---|---|
| Docs, short index | `https://tikdataapi.com/llms.txt` |
| Docs, everything in one file | `https://tikdataapi.com/llms-full.txt` |
| One docs page as Markdown | add `.md` to its URL, for example `https://tikdataapi.com/docs/coverage.md` |
| Contract, OpenAPI 3.1 | `https://api.tikdataapi.com/openapi.yaml`, or `https://tikdataapi.com/openapi.json` |
| Tools, MCP server | `https://api.tikdataapi.com/mcp` (signs itself in, or header `x-api-key`) |
| Live health, JSON | `https://api.tikdataapi.com/status` |
| Directory of all of the above | `https://api.tikdataapi.com/` |

Every docs page also answers a request with `Accept: text/markdown` in Markdown.

## Prompt to paste [#prompt-to-paste]

```text
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 in one line [#mcp-in-one-line]

```bash
claude mcp add --transport http tikdataapi https://api.tikdataapi.com/mcp
```

No key in it: the server signs the client in through a browser and it gets its own credential. Other
clients, and the header form for a machine with no browser: see [MCP server](/docs/mcp). The 27 tools are
read-only and annotated as such, so clients that auto-approve read-only tools do not prompt on every call.

## Why the API is easy for agents [#why-the-api-is-easy-for-agents]

- **Flat objects.** A `User`, a `Video`, a `Comment` and a `Hashtag` are the same shape on every endpoint. No
  wrappers to dig through.
- **Stable error codes.** `no_credits`, `not_found`, `rate_limited`, `busy`, `upstream_rate_limited`. The
  [errors page](/docs/errors) says what to do for each. Failed requests cost nothing.
- **Costs in the response.** `credits_charged` and `balance_remaining` on every call, so an agent can budget without
  a second request.
- **Time on every object.** `collected_at` says when we read it from TikTok, so an agent knows how old a count is.
- **Cursors, not page numbers.** `next_cursor` is opaque; pass it back as `cursor`. No cursor means the end.
- **Batch.** Up to 100 usernames or video ids in one call, one charge, errors per item. See [batch](/docs/batch).
- **Idempotent reads.** Everything is a read. Retrying is always safe; a repeat inside the cache window costs half.
- **A key per agent.** Make one key per agent in the [dashboard](https://tikdataapi.com/dashboard) so one can be revoked alone.
