> ## Documentation Index
> Fetch the complete documentation index at: https://traceryn.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the TikTok SDK

> Install @traceryn/tiktok-sdk, create a client, and fetch your first TikTok video.

## Requirements

* Node.js 18 or later

## Install

> [tab] npm
>
> ```bash theme={null}
> npm install @traceryn/tiktok-sdk
> ```

> [tab] yarn
>
> ```bash theme={null}
> yarn add @traceryn/tiktok-sdk
> ```

> [tab] From GitHub
>
> ```bash theme={null}
> npm install git+https://github.com/traceryn/tiktok-sdk.git
> # or
> yarn add git+https://github.com/traceryn/tiktok-sdk.git
> ```

### Optional: Playwright

Playwright is only needed for browser-backed session requests. See [Playwright sessions](https://traceryn.online/tiktok-sdk/playwright-sessions.md).

```bash theme={null}
npm install playwright
npx playwright install chromium
```

> [!NOTE]
>
> The `playwright` package does not ship a browser by default. You must download a browser binary with `npx playwright install chromium`.

## Create a client

```ts ESM theme={null}
import { TikTokClient } from '@traceryn/tiktok-sdk';

const client = new TikTokClient();
```

```js CommonJS theme={null}
const { TikTokClient } = require('@traceryn/tiktok-sdk');

const client = new TikTokClient();
```

## Make your first request

```ts theme={null}
import { TikTokClient } from '@traceryn/tiktok-sdk';

const client = new TikTokClient();

const video = await client.getVideo('https://www.tiktok.com/@user/video/1234567890');
console.log(video.title);
```

A few more examples:

```ts theme={null}
const user = await client.getUser('tiktok');
console.log(user.nickname);

const comments = await client.getComments('https://www.tiktok.com/@user/video/1234567890');
console.log(comments.comments.length);

const hashtag = await client.getHashtag('fyp');
console.log(hashtag.stats.videoCount);

const trending = await client.getTrendingVideos();
console.log(trending.videos.length);
```

> [!TIP]
>
> Runnable example scripts live in the repository's [`docs/examples`](https://github.com/Traceryn/tiktok-sdk/tree/master/docs/examples) directory, and sample response data is in [`docs/responses`](https://github.com/Traceryn/tiktok-sdk/tree/master/docs/responses).

## Next steps

> [card] [Methods](https://traceryn.online/tiktok-sdk/methods.md)
>
> Every method the client exposes.

> [card] [Configuration](https://traceryn.online/tiktok-sdk/configuration.md)
>
> Timeouts, retries, rate limits, and caching.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.