Get a profile's videos
curl --request POST \
--url https://api.stophy.dev/v1/tiktok/posts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user": "khaby.lame"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({user: 'khaby.lame'})
};
fetch('https://api.stophy.dev/v1/tiktok/posts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/tiktok/posts"
payload = { "user": "khaby.lame" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"posts": [
{
"url": "<string>",
"type": "video",
"isAd": true,
"isAiGenerated": true,
"id": "<string>",
"text": "<string>",
"hashtags": [
"<string>"
],
"mentions": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"durationSeconds": 123,
"width": 0,
"height": 0,
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"views": 0,
"likes": 0,
"comments": 0,
"shares": 0,
"saves": 0,
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"audio": {
"isOriginal": true,
"id": "<string>",
"title": "<string>",
"artist": "<string>"
}
}
],
"cursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}TikTok
TikTok posts API
Call the TikTok posts API to get text, hashtags, mentions, created at and duration seconds, as JSON or markdown. 1 credit per 30 items, at least 1 credit.
POST
/
v1
/
tiktok
/
posts
Get a profile's videos
curl --request POST \
--url https://api.stophy.dev/v1/tiktok/posts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user": "khaby.lame"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({user: 'khaby.lame'})
};
fetch('https://api.stophy.dev/v1/tiktok/posts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/tiktok/posts"
payload = { "user": "khaby.lame" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"posts": [
{
"url": "<string>",
"type": "video",
"isAd": true,
"isAiGenerated": true,
"id": "<string>",
"text": "<string>",
"hashtags": [
"<string>"
],
"mentions": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"durationSeconds": 123,
"width": 0,
"height": 0,
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"views": 0,
"likes": 0,
"comments": 0,
"shares": 0,
"saves": 0,
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"audio": {
"isOriginal": true,
"id": "<string>",
"title": "<string>",
"artist": "<string>"
}
}
],
"cursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}- Endpoint:
tiktok.posts - Returns:
datahasposts. - Cost: 1 credit per 30 items, at least 1 credit. Failed calls cost nothing.
- Paging: Yes. Send the
cursorfrom the response to get the next page. See Paging.
Example
import { Stophy } from "stophy";
const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
const result = await stophy.tiktok.posts({ user: "khaby.lame" });
console.log(result.data.posts);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.tiktok.posts(user="khaby.lame")
print(result["data"]["posts"])
curl -X POST https://api.stophy.dev/v1/tiktok/posts \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"user":"khaby.lame"}'
stophy tiktok posts khaby.lame
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json