Get videos for a hashtag
curl --request POST \
--url https://api.stophy.dev/v1/tiktok/hashtag \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hashtag": "booktok",
"limit": 15
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({hashtag: 'booktok', limit: 15})
};
fetch('https://api.stophy.dev/v1/tiktok/hashtag', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/tiktok/hashtag"
payload = {
"hashtag": "booktok",
"limit": 15
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"videos": [
{
"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 hashtag API
Call the TikTok hashtag 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
/
hashtag
Get videos for a hashtag
curl --request POST \
--url https://api.stophy.dev/v1/tiktok/hashtag \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hashtag": "booktok",
"limit": 15
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({hashtag: 'booktok', limit: 15})
};
fetch('https://api.stophy.dev/v1/tiktok/hashtag', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/tiktok/hashtag"
payload = {
"hashtag": "booktok",
"limit": 15
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"videos": [
{
"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.hashtag - Returns:
datahasvideos. - 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.hashtag({ hashtag: "booktok", limit: 15 });
console.log(result.data.videos);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.tiktok.hashtag(hashtag="booktok", limit=15)
print(result["data"]["videos"])
curl -X POST https://api.stophy.dev/v1/tiktok/hashtag \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"hashtag":"booktok","limit":15}'
stophy tiktok hashtag booktok --limit 15
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json