Search TikTok videos and users
curl --request POST \
--url https://api.stophy.dev/v1/tiktok/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "street food"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'street food'})
};
fetch('https://api.stophy.dev/v1/tiktok/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/tiktok/search"
payload = { "query": "street food" }
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>"
}
}
],
"users": [
{
"url": "<string>",
"isVerified": true,
"id": "<string>",
"secUid": "<string>",
"username": "<string>",
"name": "<string>",
"bio": "<string>",
"avatar": "<string>",
"followers": 0,
"likes": 0
}
],
"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 search API
Call the TikTok search API to get videos and users, as JSON or markdown. 1 credit per 12 items, at least 1 credit.
POST
/
v1
/
tiktok
/
search
Search TikTok videos and users
curl --request POST \
--url https://api.stophy.dev/v1/tiktok/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "street food"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'street food'})
};
fetch('https://api.stophy.dev/v1/tiktok/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/tiktok/search"
payload = { "query": "street food" }
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>"
}
}
],
"users": [
{
"url": "<string>",
"isVerified": true,
"id": "<string>",
"secUid": "<string>",
"username": "<string>",
"name": "<string>",
"bio": "<string>",
"avatar": "<string>",
"followers": 0,
"likes": 0
}
],
"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.search - Returns:
datahasvideos,users. - Cost: 1 credit per 12 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.search({ query: "street food" });
console.log(result.data.videos);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.tiktok.search(query="street food")
print(result["data"]["videos"])
curl -X POST https://api.stophy.dev/v1/tiktok/search \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"query":"street food"}'
stophy tiktok search "street food"
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json