TiKApi REST API (v1)

Download OpenAPI specification:Download

Introduction

The TikApi API is an unofficial API on top of TikTok application API. 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 for your programming language to use TikApi's API.
Check out this demo to see how it works https://youtu.be/JDupJKZ0Yy8

Errors

You can identify errors from the HTTP Status code or response body. As with our normal API responses, your client must be prepared to gracefully handle additional members of the response.

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": {
        "sec_user_id": "A valid TikTok user id is required."
    }
}

Forbidden (403)

These can occur for different reasons such as Unauthorized access, Invalid Credentials or API Key Rate Limit reached.

Example

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

Not Found (404)

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

Example

{
    "status": "error",
    "message": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again."
}

Method Not Allowed (405)

The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.

Example

{
    "status": "error",
    "message": "The method is not allowed for the requested URL."
}

Authentication

API Key

This is your TikApi API Key, must be included in header on every request. You can refresh this key from TikApi Developer Dashboard. When sending an API request you must include this key in Headers with header name X-API-KEY.

Security Scheme Type API Key
Header parameter name: X-API-KEY

Account Authorization Key

The system of obtaining an users authorization key is based in OAuth 2.0 specification, with some differences. Here are the steps for getting an authorization key:

1. Ask an User for Authorization

To get an access token, you need to ask an user to authorize your application. You can do this by sharing your OAuth link to the user or using the TikAPI Login Button.

Example OAuth Link: https://tikapi.io/account/authorize?client_id=c_1234567890&redirect_uri=https://tikapi.io/success&scope=view_profile%20search

  • client_id required

    • This is your application id, you can find this on TikApi Developer Dashboard.
  • redirect_uri required

    • The user will be redirect here after successful authorization and the params access_token,scope will be passed in query. You must set your application redirect links on TikApi Developer Dashboard.
  • scope optional

    • A list of permissions seperated with space. User can choose to not allow some of these permission.
  • state optional

    • A custom state data to pass on.

2. Using Authorization

After an user has authorized your application, a redirection will occur at your specified redirection link and the query url parameters will include:

  • access_token which is the user authorization key,
  • scope which is the list of allowed permissions, in case the user might have choosen to disallow some permissions.

Also, you can see your current authorized users from your TikApi Developer Dashboard.

The authorization key never expires, but user can choose to revoke access at anytime.

When sending an API request you must include this key in Headers with header name X-ACCOUNT-KEY.

Security Scheme Type User Authorization Key
Header parameter name X-ACCOUNT-KEY
Security Scheme Type OAuth2
implicit OAuth Flow
Authorization URL: https://tikapi.io/account/authorize
Scopes:
  • view_profile -

    To read a user's profile info and activity

  • media_actions -

    To like or comment videos on a user behalf

  • follow_actions -

    To follow or unfollow other users

  • search -

    To read any profile info and media

Profile

Get user basic profile information

Get basic profile information

Authorizations:

Responses

Request samples

curl --request GET \
  --url https://api.tikapi.io/user/info \
  --header 'X-ACCOUNT-KEY: {YOUR_KEY_VALUE}' \
  --header 'X-API-KEY: {YOUR_KEY_VALUE}' \
  --header 'accept: application/json'

Response samples

Content type
application/json
{}

Get an user feed posts

By default this will get the feed posts of the current logged in user. If secUid is specified this will get the feed post for that user.

Authorizations:
API KeyAccount Authorization Key (view_profilesearch)
query Parameters
count
required
integer <= 30

Number of items to be returned

cursor
integer
Default: 0

The starting number of items list.

secUid
string

A Secure TikTok user ID

Responses

Request samples

curl --request GET \
  --url 'https://api.tikapi.io/user/feed?count=5' \
  --header 'X-ACCOUNT-KEY: {YOUR_KEY_VALUE}' \
  --header 'X-API-KEY: {YOUR_KEY_VALUE}' \
  --header 'accept: application/json'

Response samples

Content type
application/json
{