TikTok/SQL Query

SQL Query

POST
https://api.shofo.ai/tiktok/sql

Query our complete TikTok video database using SQL. Access millions of indexed videos with full metadata.

Pricing

Base cost: $0.0001 per row returned

Parameters

ParameterTypeRequiredDescription
querystring
Required
SQL query to execute against the TikTok index
limitinteger
Optional
Maximum rows to returnDefault: 100

Available Fields

The TikTok index contains the following fields that you can query:

FieldTypeDescription
video_idSTRINGUnique video identifier
author_unique_idSTRINGCreator username
author_sec_uidSTRINGCreator secure user ID
author_follower_countINTEGERCreator follower count at time of scrape
create_timeINTEGERVideo creation timestamp (Unix)
video_descSTRINGVideo caption/description
hashtagsARRAY<STRING>List of hashtags used
play_countINTEGERTotal view count
digg_countINTEGERTotal likes
comment_countINTEGERTotal comments
share_countINTEGERTotal shares
video_durationINTEGERVideo duration in seconds
music_titleSTRINGSound/music title
music_author_nameSTRINGSound/music author

Example Queries

Get top videos by likes

SELECT video_id, author_unique_id, video_desc, digg_count
FROM videos
ORDER BY digg_count DESC
LIMIT 100

Find videos with specific hashtag

SELECT video_id, author_unique_id, play_count
FROM videos
WHERE 'fyp' IN UNNEST(hashtags)
ORDER BY play_count DESC
LIMIT 50

Get creator stats

SELECT
  author_unique_id,
  COUNT(*) as video_count,
  SUM(play_count) as total_views,
  AVG(digg_count) as avg_likes
FROM videos
GROUP BY author_unique_id
ORDER BY total_views DESC
LIMIT 20

Try It

POST
https://api.shofo.ai/tiktok/sql
$0.0001

Send a request to see the response