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 it works https://youtu.be/JDupJKZ0Yy8
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:
|
view_profile
) 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'
{- "status": "success",
- "message": "string",
- "statusCode": 0,
- "userInfo": {
- "user": {
- "id": 6845742198232106000,
- "uniqueId": "demoapi",
- "nickname": "sharingan",
- "signature": null,
- "verified": true,
- "secUid": "MS4wLjABAAAA77cXhkB15fV7rqAAMI0zGK_R1OaW8NjnVoO8ZIg8qfUm0d_XUs31QqEql3WVsDc8",
- "secret": true,
- "ftc": true,
- "relation": 0,
- "openFavorite": true,
- "commentSetting": 0,
- "duetSetting": 0,
- "stitchSetting": 0,
- "privateAccount": true
}, - "stats": {
- "followingCount": 0,
- "followerCount": 0,
- "heartCount": 0,
- "videoCount": 0,
- "diggCount": 0,
- "heart": 0
}, - "shareMeta": {
- "title": "sharingan on TikTok",
- "desc": "@demoapi 0 Followers 0 Following 0 Likes - Watch awesome short videos created by sharingan"
}
}
}
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.
view_profile
search
) 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 |
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'
{- "status": "success",
- "message": "string",
- "statusCode": 0,
- "items": [
- {
- "id": 6896382758155865000,
- "desc": "#duet with @notnoahroks I swear rapping should have an age limit lmao",
- "createTime": 1605689507,
- "video": {
- "id": "awesome",
- "height": 540,
- "width": 608,
- "duration": 10,
- "ratio": "720p",
- "shareCover": [
- null
],
}, - "author": {
- "id": 6569595380449903000,
- "uniqueId": "lilyachty",
- "nickname": "lilyachty",
- "signature": "TikTok legendy tickets to my live stream show here ⬇️",
- "verified": true,
- "secUid": "MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy-9htpnUi0sOYSr0kGGD1Loud",
- "secret": true,
- "ftc": true,
- "relation": 1,
- "openFavorite": true,
- "commentSetting": 0,
- "duetSetting": 0,
- "stitchSetting": 0,
- "privateAccount": true
}, - "music": {
- "id": 6895086068639534000,
- "title": "Yachty.live Coffin Freestyle Competition",
- "authorName": "lilyachty",
- "original": true
}, - "challenges": [
- {
- "id": 30496,
- "title": "duet",
- "desc": "Use our Duet feature because two is always better than one.",
}
], - "stats": {
- "diggCount": 365600,
- "shareCount": 2857,
- "commentCount": 6107,
- "playCount": 1900000
}, - "originalItem": true,
- "officalItem": true,
- "textExtra": [
- {
- "awemeId": 6895108440713072000,
- "start": 11,
- "end": 23,
- "hashtagName": null,
- "hashtagId": null,
- "type": 0,
- "userId": 6871022696886748000,
- "isCommerce": true,
- "userUniqueId": "notnoahroks",
- "secUid": "MS4wLjABAAAAZtIxpAWLrXtnMTfBrV1cAj4S8mWpYKIH45pTMXkUQT7klySzKCVNxPpQNGrdhb49"
}
], - "secret": true,
- "forFriend": true,
- "digged": true,
- "itemCommentStatus": 0,
- "showNotPass": true,
- "vl1": true,