Download OpenAPI specification:Download
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 OAuth works https://youtu.be/JDupJKZ0Yy8
Check out our Javascript SDK at https://github.com/tikapi-io/tiktok-api
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.
The request could not be understood by the server due to malformed syntax or parameters. The client should not repeat the request without modifications.
{
"status": "error",
"message": "Missing fields.",
"fields": {
"sec_user_id": "A valid TikTok user id is required."
}
}
These can occur for different reasons such as Unauthorized access, Invalid Credentials or API Key Rate Limit reached.
{
"status": "error",
"message":"Something went wrong."
}
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
{
"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."
}
The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.
{
"status": "error",
"message": "The method is not allowed for the requested URL."
}
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:
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
redirect_uri required
access_token
,scope
will be passed in query. You must set your application redirect links on TikApi Developer Dashboard.scope optional
state optional
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:
|
Get profile information from username.
username required | string This can also be a profile short link e.g |
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). |
curl --request GET \ --url 'https://api.tikapi.io/public/check?username=lilyachty' \ --header 'X-API-KEY: {YOUR_KEY_VALUE}' \ --header 'accept: application/json'
{- "status": "success",
- "message": "string",
- "seoProps": {
- "predictedLanguage": "en",
- "pageId": 6569595380449903000,
- "pageType": 1,
- "metaParams": {
- "title": "lilyachty (@lilyachty) Official TikTok | Watch lilyachty's Newest TikTok Videos",
- "keywords": "lilyachtylilyachtyTikTok ティックトック tik tok tick tock tic tok tic toc tictok тик ток ticktock",
- "description": "lilyachty (@lilyachty) on TikTok | 156.5M Likes. 7M Fans. i have all of the answers inside of my head",
- "robotsContent": "index follow",
- "applicableDevice": "pc mobile"
}, - "itemList": { },
- "jsonldList": [
- [
- "ItemList"
]
]
}, - "$language": "en",
- "statusCode": 0,
- "statusMsg": null,
- "userInfo": {
- "user": {
- "id": 6569595380449903000,
- "shortId": 0,
- "uniqueId": "lilyachty",
- "nickname": "lilyachty",
- "signature": "i have all of the answers inside of my head",
- "createTime": 1548906000,
- "verified": true,
- "secUid": "MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud",
- "ftc": true,
- "relation": 0,
- "openFavorite": true,
- "bioLink": {
- "link": "Crete.co",
- "risk": 3
}, - "commentSetting": 0,
- "duetSetting": 0,
- "stitchSetting": 0,
- "privateAccount": true,
- "secret": true,
- "isADVirtual": true,
- "roomId": null
}, - "stats": {
- "followerCount": 7000000,
- "followingCount": 51,
- "heart": 156500000,
- "heartCount": 156500000,
- "videoCount": 177,
- "diggCount": 0
}, - "itemList": [ ]
}
}
id required | integer Example: id=6933300025103633000 The TikTok video ID. |
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). |
curl --request GET \ --url 'https://api.tikapi.io/public/video?id=6933300025103633669&username=lilyachty' \ --header 'X-API-KEY: {YOUR_KEY_VALUE}' \ --header 'accept: application/json'
{- "status": "success",
- "message": null,
- "itemInfo": {
- "itemStruct": {
- "author": {