Tutorials · TikTok

TikTok API tutorials

Every public TikTok route, from profiles and videos to comments, transcripts, followers, sounds, hashtags and search, with tested code in six languages and both SDKs.

Short answer. Every TikTok route is GET https://api.handlehaul.com/v1/tiktok/... with an X-Api-Key header. Name an account by handle, numeric id or secUid, and a video by id or link. Store sec_uid from the profile for list calls. Lists page with pagination.next_cursor.

Start with your language or tool

Language guide

Instagram and TikTok API in Python

Two ways to call HandleHaul from Python: a 60-line client on requests that you own, or the official handlehaul package (sync and async).

Language guide

Instagram and TikTok API in Node.js

Call HandleHaul from Node.js 18 or newer with the built-in fetch, or install the typed handlehaul package from npm, which also ships a CLI.

Language guide

Instagram and TikTok API in PHP

One class, PHP 8 and the curl extension: no Composer package needed.

Language guide

Instagram and TikTok API in Go

A standard-library Go client with generic Page[T] and One[T] types: decode the fields you need into structs, page with a callback, and get a typed APIError for anything else.

Language guide

Instagram and TikTok API in Ruby

A standard-library Ruby client: Net::HTTP, JSON and an Enumerator for cursor paging, so .first(100) or .take_while stops calling when you have enough.

Language guide

Instagram and TikTok API with cURL

Every route works from a terminal: one header, JSON back.

No code

Instagram and TikTok data in Google Sheets

Paste one Apps Script file, add your key as a script property, and a HandleHaul menu fills follower counts for a list of Instagram accounts and views, likes and saves for a list of TikTok videos.

No code

Instagram and TikTok data in n8n

n8n’s HTTP Request node can page through HandleHaul lists on its own: set one header credential, point it at a route, and tell it where the next cursor is.

No code

Instagram and TikTok data in Make

Make’s HTTP “Make a request” module calls any HandleHaul route.

No code

Instagram and TikTok data in Zapier

Two ways to call HandleHaul from a Zap: the Webhooks by Zapier GET action for a single request, or a Code by Zapier step when you want retries and only the fields you need.

Full scripts for common jobs

One complete program per job, from input list to CSV, in Python and in Node.js.

Every endpoint, in every language

One page per API route: why you would call it, the parameters, code in cURL, Python, Node.js, PHP, Go and Ruby (plus both SDKs), a sample response and what it costs.

Profiles

  • ProfileGET /v1/tiktok/users/{user}TikTok profile: bio, verified and private flags, follower, following, like and video counts
  • Suggested accountsGET /v1/tiktok/users/{user}/suggestedAccounts TikTok suggests alongside this one (one page)

Followers & following

  • FollowersGET /v1/tiktok/users/{user}/followersFollowers of a TikTok account
  • FollowingGET /v1/tiktok/users/{user}/followingAccounts a TikTok account follows

Videos

  • PostsGET /v1/tiktok/users/{user}/postsVideos and photo posts of a TikTok account, newest first
  • RepostsGET /v1/tiktok/users/{user}/repostsVideos a TikTok account reposted
  • Liked videosGET /v1/tiktok/users/{user}/likedVideos a TikTok account liked (when its liked list is public)
  • PlaylistsGET /v1/tiktok/users/{user}/playlistsPlaylists of a TikTok account
  • StoriesGET /v1/tiktok/users/{user}/storiesLive stories of a TikTok account
  • Video or photo postGET /v1/tiktok/posts/{post}One TikTok video or photo post by id or URL

Comments

  • CommentsGET /v1/tiktok/posts/{post}/commentsComments on a TikTok post
  • Comment repliesGET /v1/tiktok/comments/{comment}/repliesReplies to a TikTok comment

Transcripts

  • TranscriptGET /v1/tiktok/posts/{post}/transcriptTranscript of a TikTok video from its auto-captions

Music

  • SoundGET /v1/tiktok/music/{music}A TikTok sound: title, artist, duration and how many posts use it
  • Posts using a soundGET /v1/tiktok/music/{music}/postsPosts that use a TikTok sound

Hashtags

  • HashtagGET /v1/tiktok/hashtags/{tag}A TikTok hashtag with its post and view counts
  • Hashtag postsGET /v1/tiktok/hashtags/{tag}/postsPosts under a TikTok hashtag
  • SearchGET /v1/tiktok/searchSearch TikTok: top videos, users, videos, photo posts, live streams or sounds

TikTok API tutorials: questions

Is there a TikTok API for public data without the Research API?
Yes: HandleHaul returns public TikTok profiles, videos, comments, transcripts, followers, sounds, hashtags and search as JSON with one API key, with no application process. TikTok's own Research API is for approved academic researchers. Not affiliated with TikTok or ByteDance.
Handle, numeric id or secUid: which should I send?
Any of them works. A handle we have not looked up in the last 7 days adds 1 lookup credit on list routes; a sec_uid or numeric id never does, and handles can change while both ids stay. Every profile and list row returns id and sec_uid: store them.
Why is a TikTok page shorter than expected while has_more is true?
TikTok sometimes returns a short or empty page in the middle of a list. Follow pagination.next_cursor until it is null instead of stopping on a small page.

Full reference: API docs. The other platform: Instagram API tutorials.

Run them on real TikTok data

One key for Instagram and TikTok. $1.40 to $0.80 per 1,000 calls; failed calls and cache hits are free.

Want to test first? Sandbox keys are free and unlimited, with sample data in the live schema.