Apidog

All-in-one Collaborative API Development Platform

API Design

API Documentation

API Debugging

API Mock

API Automated Testing

Sign up for free
Home / Tutorials / A Quick Guide to Using the TikTok Display API

A Quick Guide to Using the TikTok Display API

In today's digital age, social media integration has become increasingly important for developers and businesses looking to engage with their audience. With its ever-growing popularity, TikTok has emerged as a powerful platform for sharing short-form videos.

Introduction

In today's digital age, social media integration has become increasingly important for developers and businesses looking to engage with their audience. With its ever-growing popularity, TikTok has emerged as a powerful platform for sharing short-form videos. To facilitate the seamless integration of TikTok content into websites and applications, TikTok has provided developers with the TikTok Display API. This API enables developers to embed TikTok videos, display user profiles, and search for videos based on hashtags directly within their platforms.

In this article, we will guide you through the process of using the TikTok Display API. We will begin with obtaining your API key, and then move on to demonstrating how to use that key to retrieve videos and profiles. By the end of this guide, you'll be equipped with the knowledge needed to integrate TikTok content into your website or application, enhancing user engagement and interaction. Let's get started!

Getting Started

The TikTok Display API enables developers to seamlessly integrate TikTok content into their websites and applications. With this API, developers can embed TikTok videos, display user profiles, and search for videos based on hashtags directly within their platforms. In this article, we'll review the TikTok Display API and see how we can use it to get users' profile & extend it to get user's videos.

To get started with the TikTok Display API, you need to register your application with the TikTok Developer Platform and obtain an access token. Below is a step-by-step guide on how to get your API key:

Create a Developer Account:

Go to the TikTok Developer Platform website. Click on the "Login/Register" button and create a new developer account if you don't already have one.

Register New Application:

For this step, the TikTok team will review your application and either approve or decline if you don't meet their requirements.

Once you're logged in, click on your username and select "Manage Apps" from the dropdown menu. Click on the "Create" button to register a new application.

You'll be asked to enter your app details:

  1. App icon,
  2. App name,
  3. Category,
  4. Description,
  5. Terms of Service & Privacy Policy &
  6. Platform.

Once you're done, click on the save button on the top right corner of the page to request for review.

Tiktok page to request application review

When you request for review, you'll be notified if your submission was approved or not. If it's approved, you'll be prompted to start using your app - by creating an API key!

Getting an Authorization Code:

As per the official TikTok article, we'll need an authorization code and an access token to utilize the Display APIs.

You can request your authorization code from here to continue with the next step. Once you've collected the authorization code, the next step is to use it to get your access token

There are a couple of ways to get your access token - and we recommend checking the official guide to review the ones most suitable for you.

If everything goes as expected, you should see a successful response as follows;

{
    "data": {
        "access_token": "act.example12345Example12345Example",
        "captcha": "",
        "desc_url": "",
        "description": "",
        "error_code": 0,
        "expires_in": 86400,
        "log_id": "20220714041044010002007735002037040BAF34",
        "open_id": "abcdefgh-1a2b-123c4-ab12-abc123abc1234",
        "refresh_expires_in": 31536000,
        "refresh_token": "rft.example12345Example12345Example",
        "scope": "user.info.basic"
    },
    "message": "success"
}

From the response above, you can see your access_token, your refresh_tokens, and when they expires.

TikTok Display API

Now that your access_token is retrieved, the next thing is to use the TikTok display endpoint to retrieve the user's profile or videos - whatever you'd like to pull.

TikTok User's Display Endpoint

If you already have a nice UI, you can simply integrate the endpoint into your project.

https://open.tiktokapis.com/v2/user/info/?fields=open_id,union_id,avatar_url,display_name

For this guide though, I don't have a UI so I'm going to use Apidog to test the APIs.

Apidog provides a user-friendly interface for testing APIs, similar to popular tools like Postman. With its intuitive design and comprehensive feature set, Apidog simplifies the process of API testing and debugging, allowing developers to streamline their testing workflows and identify potential issues with ease.

What is Apidog | Apidog
This article introduces a brief user roadmap for using Apidog.

If you don't already have an account, please create an account to test the TikTok API endpoint.

button

The next thing is to log into your account and tap on "New Request".

Alt text

Once you tap on that link, you'll be redirected to a page to test the APIs.

Paste the request URL in the first input as shown above. For the auth type, choose the bearer token and paste the token in the token field under it.
Once you have all of that in place, click on the Submit button, and you'll be able to see your response in the response tab.

The response would be something similar to the below example;

{
   "data":{
      "user":{
         "avatar_url":"https://p19-sign.tiktokcdn-us.com/tos-useast5-avt-0068-tx/b17f0e4b3a4f4a50993cf72cda8b88b8~c5_168x168.jpeg",
         "open_id":"723f24d7-e717-40f8-a2b6-cb8464cd23b4",
         "union_id":"c9c60f44-a68e-4f5d-84dd-ce22faeb0ba1",
         "display_name": "Tik Toker"
      }
   },
   "error":{
      "code":"ok",
      "message":"",
      "log_id":"20220829194722CBE87ED59D524E727021"
   }
}

If you're using a custom UI, you can extract the user's data from that response to build your project.

They're other display endpoints that you can use, and you can check them here in the official docs.

Conclusion

In today's digital age, social media integration has become increasingly important for developers and businesses looking to engage with their audience. With its ever-growing popularity, TikTok has emerged as a powerful platform for sharing short-form videos. To facilitate the seamless integration of TikTok content into websites and applications, TikTok has provided developers with the TikTok Display API.

Throughout this guide, we have explored how to utilize the TikTok Display API to embed TikTok videos and display user profiles, and you can extend it to search for videos based on hashtags directly within your platform. By following these steps, you can enhance user engagement and interaction, allowing your audience to interact with TikTok content without leaving your website or application.

By obtaining your API key and following the provided instructions, you can seamlessly integrate TikTok content into your platform. We hope this guide has provided you with the necessary knowledge to get started with the TikTok Display API.

Happy coding, and we look forward to seeing how you implement the TikTok Display API into your projects.

Join Apidog's Newsletter

Subscribe to stay updated and receive the latest viewpoints anytime.