TikAPI REST API (v3.1.4)

Download OpenAPI specification:Download

Introduction

TikAPI is an unofficial API platform on top of TikTok. Our API is RESTful. It has predictable resource URLs. It uses HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. You can use your favorite HTTP/REST library to work with TikAPI.

TikAPI endpoints fall into two categories:

  • Public Data

    Which are endpoints for getting any TikTok Public information, such as profile information, feed posts, videos, hashtags, etc. You don't need any TikTok account authentication to use the Public Data endpoints.

  • Authenticated Users

    These Endpoints are for getting information or performing interactions on authorized TikTok accounts that have been authenticated through our OAuth platform.

Getting Started

To make things easier for you we have already implemented TikAPI in Javascript (Typescript) and Python.

Installation

Install for Javascript

npm i tikapi@latest

Install for Python

pip3 install tikapi --upgrade

If you are using another programming language you can just call the API directly with any HTTP client. The HTTP request formation is quite simple and well documented.

Authentication

API Key

Now to start using TikAPI you will need an API Key. If you don't already have one, you can sign up for a free trial subscription and get your API Key.

If you just want to do some testings first, then you can just use our Sandbox server.

Account Key

For using the authenticated user endpoints you will need to get an Account Key by asking users for authorization. Or you can authenticate your own account(s) from the Developer Dashboard with a click of a button.

Learn more about authenticating users

Usage

The API is meant to be used on server-side only, because it would be a security issue to directly expose your API Key in the front-end.

Usage in Javascript

import TikAPI from 'tikapi';

const api = TikAPI('DemoAPIKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39Asd4s');

ES6 Import syntax is recommended

Common JS

const TikAPI = require('tikapi').default;

const api = TikAPI('DemoAPIKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39Asd4s');

Usage in Python

from tikapi import TikAPI

api = TikAPI('DemoAPIKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39Asd4s');

Sandbox

Enabling sandbox in Javascript:

api.set({
    $sandbox: true
});

Enabling sandbox server in Python:

api.set(
    __sandbox__=True
)

Sandbox API Key:

DemoAPIKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39Asd4s

Sandbox Account Key:

DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A

Scroll down the documentation for more specific usage examples on all endpoints 🙃

Postman

You can easily start testing our API with Postman. Make sure you set apiKey & accountKey as environment variables.

Run in Postman

Errors

You can identify errors from the HTTP Status code or response body.

Bad Request (400)

The request could not be understood by the server due to malformed syntax or parameters. The client should not repeat the request without modifications.

Example

{
    "status": "error",
    "message": "Missing fields.", 
    "fields": {
        "secUid": "A valid TikTok secUid is required."
    }
}

Unauthorized (401)

The API Key is not valid, make sure you have typed it correctly and you haven't refreshed it recently.

Example

{
    "message": "A valid API Key is required.",
    "status": "error"
}

Forbidden (403)

This error can occur for different reasons. Usually the message includes more information about the error, and might also include a TikTok statusCode paramater.

Example

{	
    "status": "error",
    "message":"Something went wrong."
}

Scroll down below for more 403 error examples

Account Key Session Expiry (428)

The Account Key is no longer valid and a re-authorization is required.

When this error occurs you should notify the user and send a new authorization link.

Example

{	
    "status": "error",
    "message": "Account session expired, please ask user to re-login and re-authorize.",
    "statusCode": 8
}

Learn more about session expiry

Rate-Limit (429)

This means that you have reached your subscription daily request limit or bandwidth limit. You should upgrade your subscription or just wait a few hours until the limit rests.

Learn more about the rate-limit reset

Example

{	
    "status": "error",
    "message":"API Key Rate-Limit reached."
}

Other TikTok Errors (403)

Like we mentioned above, the 403 Errors can occur for different reasons.

For example this error happens when you are trying to get a profile information for a TikTok account that doesn't exist:

{
    "status": "error",
    "message": "User doesn't exist",
    "statusCode": 10202
}

Here is the description of some of the error codes:

    2054: "Video is unavailable or deleted.",
    2752: "Ad video is unavailable.",
    10000: "TikTok Captcha Error",
    10101: "TikTok Server Error",
    10102: "User not logged-in",
    10111: "TikTok Network Error",
    10113: "TikTok blocked resource",
    10114: "TikTok blocked resource",
    10119: "User not logged-in for Live",
    10202: "User doesn't exist",
    10203: "Music doesn't exist",
    10204: "Video doesn't exist",
    10205: "Hashtag doesn't exist",
    10208: "Effect doesn't exist",
    10209: "Hashtag is blacklisted",
    10210: "Live doesn't exist",
    10211: "Hashtag is sensitive",
    10212: "Hashtag error",
    10215: "Video is currently unavailable",
    10216: "Video is private",
    10217: "Video is currently unavailable",
    10218: "Music error",
    10219: "Music copyright error",
    10220: "Video music error",
    10221: "User is banned",
    10223: "User error",
    10224: "Entity doesn't exist",
    10225: "User unique sensitivity",
    10227: "Video is under review",
    10228: "Video is under risk control",
    10229: "Video is hidden",
    10230: "Video is under risk control",
    10231: "Video is not visible on your country",
    10241: "Video is deleted.",
    10242: "This video has restricted access",
    10404: "List limit reached"

Public

Endpoints that do not require a logged in user.

Get a user's profile information

Get profile information and statistics from a username.

Authorizations:
API Key
query Parameters
username
string
Example: username=lilyachty

The TikTok user username

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.check({
            username: "lilyachty"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get a user's feed posts

Authorizations:
API Key
query Parameters
secUid
required
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.posts({
            secUid: "MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get a user's liked posts

Authorizations:
API Key
query Parameters
secUid
required
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.likes({
            secUid: "MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "$other": {},
  • "cursor": "1696827055000",
  • "extra": {
    },
  • "hasMore": true,
  • "log_pb": {
    },
  • "message": "",
  • "status": "success",
  • "statusCode": 0,
  • "status_code": 0
}

Get a user's followers list

Get followers list of any public profile.

Authorizations:
API Key
query Parameters
secUid
required
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

nextCursor
string

A iteration parameter returned in each response, should be included in the next requests to get the next items.

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.followersList({
            secUid: "MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud"
        });

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get a user's following list

Get following list of any public profile.

Authorizations:
API Key
query Parameters
secUid
required
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

nextCursor
string

A iteration parameter returned in each response, should be included in the next requests to get the next items.

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.followingList({
            secUid: "MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud"
        });

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get trending posts

Get a list of recommended posts from the For You section.
Learn more about downloading videos

Authorizations:
API Key
query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.explore({
            session_id: 0,
            country: 'us'
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get video information

Authorizations:
API Key
query Parameters
id
required
string
Example: id=7003402629929913605

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.video({
            id: "7003402629929913605"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get related posts New

Authorizations:
API Key
query Parameters
video_id
required
string
Example: video_id=7109178205151464746

The video ID from which to get related posts. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.relatedPosts({
            video_id: "7109178205151464746"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get a user's playlists New

Authorizations:
API Key
query Parameters
secUid
required
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.playlists({
            secUid: "MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get a playlist items New

Authorizations:
API Key
query Parameters
playlist_id
required
any
Example: playlist_id=6948562344666532614

The playlist ID.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.playlistItems({
            playlist_id: "6948562344666532614"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get hashtag posts

Your first request should be using the hashtag name parameter, then the following requests should be using the id parameter which you have stored from the first request (returned in response challengeInfo > challenge > id).
Learn more about downloading videos

Authorizations:
API Key
query Parameters
id
string
Example: id=4655293

The hashtag ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

name
string

The hashtag name

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.hashtag({
            name: "lilyachty"
        });

        let hashtagId = response.json.challengeInfo.challenge.id;

        let response = await api.public.hashtag({
            id: hashtagId
        });

        console.log(response?.json);

        while(response){
            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get music posts

Get a list of posts that are using this music.
Learn more about downloading videos

Authorizations:
API Key
query Parameters
id
required
string
Example: id=28459463

The music ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.music({
            id: "28459463"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get music information

Authorizations:
API Key
query Parameters
id
required
string
Example: id=28459463

The music ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.musicInfo({
            id: "28459463"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Discover users, music, hashtags

Get popular users, music or hashtag. You can also include Account Key to show personalized results for the user.

Authorizations:
API Key
path Parameters
category
required
string
Enum: "users" "music" "hashtag"
Example: users

The discover category

query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

offset
number

The starting offset of items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.discover({
            category: "users"
        });

        console.log(response?.json);

        while(response){

            let offset = response?.json?.offset;
            console.log("Getting next items ", offset);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Discover by keyword

Get popular posts, users, music or hashtags from a keyword.

Limited to only a few items. If you want more, try using the Search endpoint instead.

Authorizations:
API Key
query Parameters
keyword
required
string
Example: keyword=lilyachty
country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.discoverKeyword({
            keyword: "lilyachty"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Search

Search anything, users, videos, or get keyword autocomplete suggestions.
Learn more about downloading videos

Authorizations:
API Key
path Parameters
category
required
string
Enum: "general" "users" "videos" "autocomplete"
Example: general

The search category

query Parameters
query
required
string
Example: query=lilyachty

The search keyword

nextCursor
string

A iteration parameter returned in each response, should be included in the next requests to get the next items.

country
string
Example: country=us

You can optionally choose the proxy country from where the request is being sent by providing an ISO Code (e.g us, ca, gb) — 200+ countries supported

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.public.search({
            category: "general",
            query: "lilyachty"
        });

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "$other": {},
  • "ad_info": { },
  • "data": [
    ],
  • "extra": {
    },
  • "has_more": 1,
  • "log_pb": {
    },
  • "message": "",
  • "nextCursor": "MTItLS1zcGxpdF9jdXNyb3ItLS0yMDIzMTAxMzE3NDI1OTBBNTExMzY3NkU4ODBEMjEzQzVE",
  • "status": "success",
  • "status_code": 0
}

Profile

Authenticated user profile endpoints.

Get profile information

Get current user profile information, or another user's by specifying the username.

Authorizations:
(API KeyAccount Key)
query Parameters
username
string

The TikTok user username

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.info();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Edit profile

Premium
Update the current user profile fields.

Authorizations:
(API KeyAccount Key)
path Parameters
field
required
string
Enum: "nickname" "username" "bio" "private"
Example: bio

The profile field.

Request Body schema: application/json
value
required
string

The new field value

Responses

Request samples

Content type
application/json
{
  • "value": "My new bio"
}

Response samples

Content type
application/json
{}

Get notifications

Get current user recent notifications.

Note: Some notifications are limited by TikTok.

Authorizations:
(API KeyAccount Key)
query Parameters
filter
string
Default: "all"
Enum: "all" "likes" "comments" "mentions" "followers"

Filter notifications by type

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

max_time
any

Returned in every response, should be included in the next request for iteration.

min_time
any

Returned in every response, should be included in the next request for iteration.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.notifications();

        console.log(response?.json);

        while(response){

            let min_time = response?.json?.min_time;
            console.log("Getting next items ", min_time);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "extra": {
    },
  • "log_pb": {
    },
  • "message": "",
  • "notice_lists": [
    ],
  • "status": "success",
  • "status_code": 0,
  • "status_msg": ""
}

Get analytics

Get analytics for business or creator accounts

Authorizations:
(API KeyAccount Key)
path Parameters
type
required
string
Enum: "overview" "content" "video" "followers" "live"
Example: overview

The analytics type

query Parameters
days
number
Default: 7

The days time frame for the analytics data

media_id
any

Required only for video type analytics, otherwise don't include.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.analytics({
            type: "overview"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "comment_history": [
    ],
  • "extra": {
    },
  • "follower_active_history_days": null,
  • "follower_active_history_hours": null,
  • "follower_num": {
    },
  • "follower_num_history": [
    ],
  • "like_history": [
    ],
  • "log_pb": {
    },
  • "message": "",
  • "pv_history": [
    ],
  • "share_history": [
    ],
  • "status": "success",
  • "status_code": 0,
  • "user_info": {
    },
  • "user_live_cnt_history": null,
  • "user_live_diamonds_history": null,
  • "user_live_duration_time_history": null,
  • "user_live_follower_diamonds_history": null,
  • "user_live_gift_unique_viewers_history": null,
  • "user_live_new_followers_history": null,
  • "user_live_top_viewers_history": null,
  • "user_live_unique_viewers_history": null,
  • "user_live_views_history": null,
  • "video_comment_history_7d": null,
  • "video_favorites_history_7d": null,
  • "video_finish_rate_history_7d": null,
  • "video_like_history_7d": null,
  • "video_new_followers_history_7d": null,
  • "video_shares_history_7d": null,
  • "video_vv_history_7d": null,
  • "vv_history": [
    ]
}

Check session

Check if the current user's session is valid. Auto-removes the user if it's invalid.

Note: The session is automatically checked, though you can still manually call this endpoint if you are having issues with a user.

Authorizations:
(API KeyAccount Key)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.verify();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "success",
  • "status": "success"
}

Followers

View & interact with followers.

Get following list

Get current user following list (or a friends by specifying the secUid).

Authorizations:
(API KeyAccount Key)
query Parameters
secUid
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

nextCursor
string

A iteration parameter returned in each response, should be included in the next requests to get the next items.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.following();

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "message": "",
  • "status": "success"
}

Get followers list

Get current user followers list (or a friends by specifying the secUid).

Authorizations:
(API KeyAccount Key)
query Parameters
secUid
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

nextCursor
string

A iteration parameter returned in each response, should be included in the next requests to get the next items.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.followers();

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "message": "",
  • "status": "success"
}

Posts

View & react to videos and comments.

Get feed posts

Get current user feed posts, or someone elses by providing the secUid parameter.

Authorizations:
(API KeyAccount Key)
query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

secUid
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.feed();

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get liked posts

Get current user liked posts, or someone elses by providing the secUid parameter.

Authorizations:
(API KeyAccount Key)
query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

secUid
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.likes();

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get following posts New

Authorizations:
(API KeyAccount Key)
query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.followingPosts();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get related posts New

Authorizations:
(API KeyAccount Key)
query Parameters
video_id
required
string
Example: video_id=7109178205151464746

The video ID from which to get related posts. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.relatedPosts({
            video_id: "7109178205151464746"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get saved posts New

Authorizations:
(API KeyAccount Key)
query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.savedPosts();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get user playlists New

Authorizations:
(API KeyAccount Key)
query Parameters
secUid
string
Example: secUid=MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud

The TikTok user secUid. You can get this from the Get profile information endpoint using the username.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.playlists();

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get a playlist items New

Authorizations:
(API KeyAccount Key)
query Parameters
playlist_id
required
any
Example: playlist_id=6948562344666532614

The playlist ID.

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.playlistItems({
            playlist_id: "6948562344666532614"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get trending posts

Get current user recommended posts from the For You section.

Authorizations:
(API KeyAccount Key)
query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.explore();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Search

Search anything, users, videos, or get keyword autocomplete suggestions. Using this instead of the Public Search endpoint will give you more personalized and consistent results.
Learn more about downloading videos

Authorizations:
(API KeyAccount Key)
path Parameters
category
required
string
Enum: "general" "users" "videos" "autocomplete"
Example: general

The search category

query Parameters
query
required
string
Example: query=lilyachty

The search keyword

nextCursor
string

A iteration parameter returned in each response, should be included in the next requests to get the next items.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.search({
            category: "general",
            query: "lilyachty"
        });

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "message": "",
  • "status": "success"
}

Get video information

Authorizations:
(API KeyAccount Key)
query Parameters
id
required
string
Example: id=7003402629929913605

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.video({
            id: "7003402629929913605"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Like a video

This endpoint is only available to trusted customers. Learn more about special endpoints

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
media_id
required
string

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

Responses

Request samples

Content type
application/json
{
  • "media_id": "7109178205151464746"
}

Response samples

Content type
application/json
{
  • "extra": {
    },
  • "is_digg": 1,
  • "log_pb": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Unlike a video

This endpoint is only available to trusted customers. Learn more about special endpoints

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
media_id
required
string

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

Responses

Request samples

Content type
application/json
{
  • "media_id": "7109178205151464746"
}

Response samples

Content type
application/json
{
  • "extra": {
    },
  • "is_digg": 1,
  • "log_pb": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get a video comments list

Authorizations:
(API KeyAccount Key)
query Parameters
media_id
required
string
Example: media_id=7109178205151464746

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
number

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.comments.list({
            media_id: "7109178205151464746"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "alias_comment_deleted": false,
  • "comments": [],
  • "cursor": 20,
  • "extra": {
    },
  • "has_more": 1,
  • "log_pb": {
    },
  • "message": "",
  • "reply_style": 2,
  • "status": "success",
  • "status_code": 0,
  • "top_gifts": [
    ],
  • "total": 11112
}

Get a comment reply list

Authorizations:
(API KeyAccount Key)
query Parameters
media_id
required
string
Example: media_id=7109178205151464746

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

comment_id
required
string
Example: comment_id=7109185042560680750

The comment ID

count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

cursor
number

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.posts.comments.replies({
            media_id: "7109178205151464746",
            comment_id: "7109185042560680750"
        });

        console.log(response?.json);

        while(response){

            let cursor = response?.json?.cursor;
            console.log("Getting next items ", cursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "comments": [],
  • "cursor": 20,
  • "extra": {
    },
  • "has_more": 1,
  • "log_pb": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0,
  • "total": 178
}

Post a new comment

This endpoint is only available to trusted customers. Learn more about special endpoints

Make a comment or reply to a comment.

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
media_id
required
string

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

text
required
string

The comment text

reply_comment_id
string

You can reply to a comment by including a comment ID

has_tags
boolean
Default: false

You should set this to true if you are mentioning someone.

Responses

Request samples

Content type
application/json
{
  • "media_id": "7109178205151464746",
  • "text": "Italian food is the best",
  • "reply_comment_id": "string",
  • "has_tags": false
}

Response samples

Content type
application/json
{}

Like a comment

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
media_id
required
string

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

comment_id
required
string

The comment ID

Responses

Request samples

Content type
application/json
{
  • "media_id": "7109178205151464746",
  • "comment_id": "7109185042560680750"
}

Response samples

Content type
application/json
{
  • "extra": {
    },
  • "log_pb": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0,
  • "status_msg": ""
}

Unlike a comment

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
media_id
required
string

The video ID. Can also be a short TikTok link (e.g. vm.tiktok.com/UwU)

comment_id
required
string

The comment ID

Responses

Request samples

Content type
application/json
{
  • "media_id": "7109178205151464746",
  • "comment_id": "7109185042560680750"
}

Response samples

Content type
application/json
{
  • "extra": {
    },
  • "log_pb": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0,
  • "status_msg": ""
}

Delete a comment

This endpoint is only available to trusted customers. Learn more about special endpoints

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
comment_id
required
string

The comment ID

Responses

Request samples

Content type
application/json
{
  • "comment_id": "7109185042560680750"
}

Response samples

Content type
application/json
{
  • "extra": {
    },
  • "log_pb": {
    },
  • "message": "",
  • "msg": "success",
  • "status": "success",
  • "status_code": 0
}

Messages

User messages endpoints.

Get user conversations

Premium
Get a list of current user conversations including the latest messages

Authorizations:
(API KeyAccount Key)
query Parameters
nextCursor
number

The starting offset of items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.conversations();

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "conversations": [
    ],
  • "error_desc": "OK",
  • "hasMore": true,
  • "inbox_type": 0,
  • "log_id": "202104141321460106584968",
  • "message": null,
  • "nextCursor": 1,
  • "perUserCursor": 1618342989073013,
  • "sequence_id": 0,
  • "status": "success",
  • "status_code": 0
}

Get user messages

Premium
Get full messages list of a conversation

Authorizations:
(API KeyAccount Key)
query Parameters
conversation_id
required
any
Example: conversation_id=0:1:684574219823284956:69402435203845897564

The conversation ID

conversation_short_id
required
any
Example: conversation_short_id=6940245147502654884

The additional conversation short ID (TikTok uses two different ID's for some reason)

nextCursor
string

The starting point of the items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

limit
any

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.messages({
            conversation_id: "0:1:684574219823284956:69402435203845897564",
            conversation_short_id: "6940245147502654884"
        });

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "error_desc": "OK",
  • "hasMore": true,
  • "inbox_type": 0,
  • "log_id": "202104141322656548",
  • "message": null,
  • "messages": [
    ],
  • "nextCursor": 1615902725060022,
  • "sequence_id": 10005,
  • "status": "success",
  • "status_code": 0
}

Send a message

Premium
This endpoint is only available to trusted customers. Learn more about special endpoints

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
text
required
string

The message text

conversation_id
required
string

The conversation ID

conversation_short_id
required
string

The additional conversation short ID (TikTok uses two different ID's for some reason)

ticket
required
string

The conversation ticket

Responses

Request samples

Content type
application/json
{
  • "text": "Hey! How you doing?",
  • "conversation_id": "0:1:684574219823284956:69402435203845897564",
  • "conversation_short_id": "6940245147502654884",
  • "ticket": "3M8IlBpABq00h2aNB1B5JJ2ne0DTnGLLAFjGQQGMf4BKWJxEYxf7RAE0KaD2EjkQkWiJalT4xj36JGWa1ZmQg7SgQfHLoXffNFYLkIJhe1HVyiPXitoxWFyuzlX1xvBCYhZxkQALHE4gx9AaXBPEZjks7jC"
}

Response samples

Content type
application/json
{
  • "body": {
    },
  • "cmd": 100,
  • "error_desc": "OK",
  • "inbox_type": 0,
  • "log_id": "202206241829080101890490991BDF1A6E",
  • "message": "",
  • "request_arrived_time": 1656095348713,
  • "sequence_id": 10010,
  • "server_execution_end_time": 1656095348925,
  • "status": "success",
  • "status_code": 0
}

Get user conversation requests New

Premium
Get a list of current user conversations requests including the latest message.

Authorizations:
(API KeyAccount Key)
query Parameters
nextCursor
number

The starting offset of items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.conversationRequests.conversations();

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "conversation_requests": [
    ],
  • "error_desc": "OK",
  • "hasMore": false,
  • "inbox_type": 0,
  • "log_id": "20230727112101932CD4BFC3BAED2BDB9F",
  • "message": "",
  • "nextCursor": "1",
  • "status": "success",
  • "status_code": 0
}

Get a conversation request messages New

Premium
Get the messages of a conversation in the requests tab (generally there is a 3 message limit).

Authorizations:
(API KeyAccount Key)
query Parameters
conversation_id
required
any
Example: conversation_id=0:1:684574219823284956:69402435203845897564

The conversation ID

conversation_short_id
required
any
Example: conversation_short_id=6940245147502654884

The additional conversation short ID

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.conversationRequests.messages({
            conversation_id: "0:1:684574219823284956:69402435203845897564",
            conversation_short_id: "6940245147502654884"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "error_desc": "OK",
  • "inbox_type": 0,
  • "log_id": "20230727110811C472D0F798857E277CAF",
  • "message": "",
  • "messages": [
    ],
  • "status": "success",
  • "status_code": 0
}

Delete a conversation request New

Premium

Authorizations:
(API KeyAccount Key)
query Parameters
conversation_id
required
any
Example: conversation_id=0:1:684574219823284956:69402435203845897564

The conversation ID

conversation_short_id
required
any
Example: conversation_short_id=6940245147502654884

The additional conversation short ID

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.conversationRequests.delete({
            conversation_id: "0:1:684574219823284956:69402435203845897564",
            conversation_short_id: "6940245147502654884"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "error_desc": "OK",
  • "inbox_type": 0,
  • "log_id": "20230727111926932CD4BFC3BAED2B7D4F",
  • "message": "Conversation request has been deleted successfully.",
  • "status": "success",
  • "status_code": 0
}

Accept a conversation request New

Premium

Authorizations:
(API KeyAccount Key)
query Parameters
conversation_id
required
any
Example: conversation_id=0:1:684574219823284956:69402435203845897564

The conversation ID

conversation_short_id
required
any
Example: conversation_short_id=6940245147502654884

The additional conversation short ID

user_id
required
string
Example: user_id=6569595380449902597

The sender ID.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.conversationRequests.accept({
            conversation_id: "0:1:684574219823284956:69402435203845897564",
            conversation_short_id: "6940245147502654884",
            user_id: "6569595380449902597"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "message": "Conversation request has been accepted successfully.",
  • "status": "success",
  • "status_code": 0,
  • "status_msg": ""
}

Live

Live endpoints.

Check live permissions

Check current user live permissions. You can use this to check if the user has third_party streaming enabled.

Authorizations:
(API KeyAccount Key)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.permissions();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {
    },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Start live video

Premium
Start a live video, if the user has live enabled. The live is closed automatically after stream ends.

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
title
required
any

The live room header title

third_party
any
Default: true

TikTok has a special gateway for invite only users. Only if this is enabled you can do third party streaming.

hashtag_id
number

(Optional) The topic ID. You can find this by using the Get topics list endpoint.

game_tag_id
number

(Optional) The sub-topic ID for gaming topics.

Responses

Request samples

Content type
application/json
{
  • "title": "Check out my live!",
  • "third_party": true,
  • "hashtag_id": 0,
  • "game_tag_id": 0
}

Response samples

Content type
application/json
{}

Stop live video

Premium

Authorizations:
(API KeyAccount Key)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.stop();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": { },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get live information

Get information about a live video.
You can use this for any user that has an open live video. There is a roomId parameter included when fetching profile information about users.

Authorizations:
(API KeyAccount Key)
query Parameters
room_id
required
string
Example: room_id=7112492061034646278

The Live room ID. You can find this using the Get profile information endpoint.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.info({
            room_id: "7112492061034646278"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {
    },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get recommended live videos

Get a list of recommended live videos, related with a live video.

Authorizations:
(API KeyAccount Key)
query Parameters
room_id
required
string
Example: room_id=7112492061034646278

The Live room ID. You can find this using the Get profile information endpoint.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.recommend({
            room_id: "7112492061034646278"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get live statistics

Get statistics for the current user live video, after it has ended.

Authorizations:
(API KeyAccount Key)
query Parameters
room_id
required
string
Example: room_id=7112492061034646278

The Live room ID. You can find this using the Get profile information endpoint.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.stats({
            room_id: "7112492061034646278"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {
    },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get live chat and gifts

Premium
Get real-time live chat, gifts, and other events for any live video.

Authorizations:
(API KeyAccount Key)
query Parameters
room_id
required
string
Example: room_id=7112492061034646278

The Live room ID. You can find this using the Get profile information endpoint.

nextCursor
string

Returned in each response, should be included in the next requests to get the next chat events.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.chat({
            room_id: "7112492061034646278"
        });

        console.log(response?.json);

        while(response){

            let nextCursor = response?.json?.nextCursor;
            console.log("Getting next items ", nextCursor);

            response = await Promise.resolve(
                response?.nextItems()
            );
        }
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "message": "",
  • "messagesList": [
    ],
  • "nextCursor": "MTY1NjI0NDU5MTk5MV83MTEzNTE2MzUyNTIxODk3NzcyXzFfMS0tLXNwbGl0X2N1c3Jvci0tLWZldGNoX3RpbWU6MTY1NjI0NDU5MTk5MXxzdGFydF90aW1lOjE2NTYyNDQ0OTg1NjJ8YWNrX2lkczo3MTEzNTE1OTQ5OTIzNjUyNjEzX2ViOCw3MTEzNTE1OTU1NzQ5MzU4MzQyX2ViOCw3MTEzNTE1OTczMDQzNjIwNjEzX2VjMCw3MTEzNTE1OTg4NzU5NTk1NzgxX2VjOCw3MTEzNTE1OTkyMzYxMzU4MzQxX2VjYSw3MTEzNTE2MDAxMjgzMDE3NDc3X2VjZSw3MTEzNTE2MDAzMDM1NzQ1MDMwX2VjZSw3MTEzNTE2MDE4NTAwNzAwOTM0X2VkNCw3MTEzNTE2MDQ0NTM0NzQ4MTY2X2VlMiw3MTEzNTE2MDYwOTU2NjkzNTEwX2VlYSw3MTEzNTE2MDU3MTkyNzQ1Nzc0X2VlNiw3MTEzNTE2MDc4NzMwNjYwNjEzX2VmMCw3MTEzNTE2MDc5ODAwMjczNjY5X2VmMCw3MTEzNTE2MTAzODM3NTg2NDM4X2VmYyw3MTEzNTE2MTEzMzg5MDc5MzAyX2YwMCw3MTEzNTE2MTEzNjgxODQ3MzAxX2YwMiw3MTEzNTE2MTYzOTQyNjE4MTE4X2YxOCw3MTEzNTE2MTY3NjkyMDEyMjkzX2YxOCw3MTEzNTE2MjI4MjQ1MTQ2MzczX2YzNCw3MTEzNTE2MjMzMzc4NzMxMDE0X2YzOCw3MTEzNTE2MjQ5OTY3MTUxOTE4X2YzZSw3MTEzNTE2MjU4NDkwNzQ3NjU0X2Y0Miw3MTEzNTE2MjY4Mzc5OTgyNTk3X2Y0Niw3MTEzNTE2MjY5MzY2MDg2NDA1X2Y0Niw3MTEzNTE2MjY5MTg1Mjc0ODg1X2Y0OCw3MTEzNTE2Mjg4NzE0NDI3MTQyX2Y1MCw3MTEzNTE2MjkyNjY5NDc3ODk0X2Y1Miw3MTEzNTE2MzA5NDAwNzE4MDg2X2Y1YSw3MTEzNTE2MzQyMDQwMzgyMjEzX2Y2OCw3MTEzNTE2MjA5NTQyNjQ2NTM0X2Y2OHxmbGFnOjF8c2VxOjF8bmV4dF9jdXJzb3I6MTY1NjI0NDU5MTk5MV83MTEzNTE2MzUyNTIxODk3NzcyXzFfMXx3c3NfaW5mbzowLTE2NTYyNDQ1OTE5OTEtMC0w",
  • "now": "1656244591991",
  • "pushServer": "wss://webcast16-ws-useast1a.tiktok.com/webcast/im/push/",
  • "status": "success"
}

Send a message to a live chat

Premium
This endpoint is only available to trusted customers. Learn more about special endpoints

Send a chat message to any live video

Authorizations:
(API KeyAccount Key)
Request Body schema: application/json
room_id
required
string

The Live room ID. You can find this using the Get profile information endpoint.

text
required
string

The chat text message

Responses

Request samples

Content type
application/json
{
  • "room_id": "7112492061034646278",
  • "text": "A mí me gusta"
}

Response samples

Content type
application/json
{
  • "data": {
    },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get live topics list

Authorizations:
(API KeyAccount Key)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.topics();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {},
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get coin transactions history

Authorizations:
(API KeyAccount Key)
query Parameters
page
any
Example: page=1

The list page number

count
any
Example: count=12

The items limit per page

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.transactionHistory();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {
    },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Search live videos New

Authorizations:
(API KeyAccount Key)
query Parameters
query
required
string
Example: query=lilyachty

The search keyword

cursor
number

The starting offset of items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.search({
            query: "lilyachty"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "backtrace": "",
  • "cursor": 12,
  • "data": [],
  • "extra": {
    },
  • "has_more": 1,
  • "log_pb": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get live analytics New

Authorizations:
(API KeyAccount Key)
query Parameters
days
number
Default: 7

The days time frame for the analytics data

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.analytics();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {
    },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Get live videos list New

Authorizations:
(API KeyAccount Key)
query Parameters
count
number <= 30
Default: 30
Example: count=30

Maximum amount of items for one request

offset
number

The starting offset of items list. Returned in every response, should be included in the next request for iteration.

(A simple iteration method is already implemented in the Javascript & Python libraries as seen in the request samples)

sort
number
Default: 0
Enum: 0 1
Example: sort=1

Sort results by ascending (1) or descending (0). Default is descending (0).

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.list();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{}

Get a live video details New

Authorizations:
(API KeyAccount Key)
query Parameters
room_id
required
string
Example: room_id=7112492061034646278

The Live room ID.

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");
const User = new api.user({
    accountKey: "DemoAccountKeyTokenSeHYGXDfd4SFD320Sc39Asd0Sc39A"
});

(async function(){
    try{
        let response = await User.live.details({
            room_id: "7112492061034646278"
        });
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "data": {
    },
  • "extra": {
    },
  • "message": "",
  • "status": "success",
  • "status_code": 0
}

Key

Information about your API Key.

Get information about your API Key

Authorizations:
API Key

Responses

Request samples

import TikAPI from 'tikapi';

const api = TikAPI("myAPIKey");

(async function(){
    try{
        let response = await api.key();
        console.log(response.json);
    }
    catch(err){
        console.log(err?.statusCode, err?.message, err?.json)
    }	
})();

Response samples

Content type
application/json
{
  • "accounts": [
    ],
  • "active": 1,
  • "app": {},
  • "bandwidth": {
    },
  • "credits": 779,
  • "dark_mode": 0,
  • "date_expiry": 1659088800,
  • "email": "[email protected]",
  • "has_expired": false,
  • "id": 1,
  • "logs": [
    ],
  • "logs_count": 4,
  • "message": "",
  • "plan_id": 3,
  • "status": "success",
  • "sub_id": 5,
  • "subscription_active": 1
}