TikTok for Developers

Developer Docs

Last updated October 22, 2026

Get Started

TikTok Minis SDK allows authentication from your web app to TikTok.

To use TikTok Minis SDK, include a piece of JavaScript code in your HTML to asynchronously load the SDK into your pages. This will not block other elements from loading on your page. TikTok Minis SDK does not require standalone files or downloads.

Insert the following code snippet directly after the opening <body> tag on each page where you want to load the basic version of the SDK with default options.

<script src="https://connect.tiktok-minis.com/drama/sdk.js"></script>
<script>  
   TTMinis.init({
     clientKey: '{app-client-key}',
   });
</script>

This code will load and initialize the SDK. You must replace the app-client-key value with your app's client key, found in the Credentials section of your app page on Developer Portal.

Set up TikTok Minis SDK

init(params)

The method TTMinis.init() is used to initialize and set up the SDK. All other SDK methods must be called after this one, because they won't exist until you do.

Parameters

/**
 * Init JSSDK
 * @param {Object} params - Init params
 * @param {string} params.clientKey - clientKey from https://developers.tiktok.com/apps/
 */
TTMinis.init(params)

Example

TTMinis.init({
  clientKey: '{app-client-key}'
});

After initializing and setting up the SDK, you can call any of the JavaScript APIs for TikTok Minis.

Error structure

If your receive an error, most asynchronous callbacks return an error field on failure with the following structure:

Field

Type

Description

error_code

number

The error code.

error_msg

string

The error message.

sub_error_code

number

The sub error code. Optional.

error_extra

unknown

Additional error information. Optional.

{
  error_code: number;
  error_msg: string;
  sub_error_code?: number;
  error_extra?: unknown;
}
TikTok for Developers