SerpBase
Back to Blog

TikTok Hashtag API: Videos for a Hashtag as JSON

Send a hashtag to /tiktok/search to get videos with views, likes, saves and hashtags. Tested on #latteart and #booktok, with paging and related tags.

December 4, 2026
By SerpBase Team3 min read

Short answer: send the hashtag, with the #, as the query to /tiktok/search. The answer is a list of videos with caption, hashtags, views, likes, comments, shares, saves and author. On 4 December 2026 #latteart returned 16 videos, 15 of them tagged #latteart, and #booktok returned 16 of 16.

The request

curl -X POST 'https://api.serpbase.dev/tiktok/search' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -d '{"q":"#latteart"}'

What came back

request (4 December 2026)videoscarrying the hashtagnext cursor
{"q":"#latteart"}1615"16"
{"q":"#latteart","cursor":"16"}16 new ones11"32"
{"q":"#booktok"}1616"16"

One video, shortened:

{
  "id": "7078877428164267310",
  "text": "Start with a heart! #Goldenbrowncoffee #coffeetiktok #barista #learnontiktok #homecafe #foodietiktok #coffeeart #latteart #espresso #coffee",
  "hashtags": ["goldenbrowncoffee", "coffeetiktok", "barista", "learnontiktok", "homecafe", "foodietiktok", "coffeeart", "latteart", "espresso", "coffee"],
  "views_count": "5700000",
  "likes_count": "257900",
  "comments_count": "1432",
  "shares_count": "9488",
  "saves_count": "123315",
  "published_at": "2022-03-25T03:39:49Z",
  "link": "https://www.tiktok.com/@goldenbrown.coffee/video/7078877428164267310",
  "author": {
    "username": "goldenbrown.coffee",
    "name": "Golden Brown Coffee",
    "followers_count": "682500"
  }
}

Across the 32 #latteart videos the hashtags used most often next to it were #coffee (13 videos), #barista (7), #lattearttutorial (7), #fyp (6) and #coffeeart (5) — a quick way to find neighbouring tags.

Python: two pages, tagged videos only, related hashtags

import collections, time, requests

TAG = "latteart"

def page(cursor=None):
    body = {"q": "#" + TAG}
    if cursor:
        body["cursor"] = cursor
    r = requests.post(
        "https://api.serpbase.dev/tiktok/search",
        headers={"X-API-Key": "YOUR_API_KEY"},
        json=body,
        timeout=60,
    ).json()
    if r["status"] != 0:
        raise RuntimeError(r.get("error"))
    return r["posts"], r["pagination"]

videos, cursor = {}, None
for _ in range(2):
    posts, paging = page(cursor)
    for p in posts:
        videos[p["id"]] = p
    if not paging.get("has_more"):
        break
    cursor = paging["next_cursor"]
    time.sleep(1)

tagged = [v for v in videos.values() if TAG in [h.lower() for h in v.get("hashtags", [])]]
print(len(videos), "videos,", len(tagged), "tagged #" + TAG)

for v in sorted(tagged, key=lambda v: int(v["views_count"]), reverse=True)[:5]:
    print(f'{int(v["views_count"]):>10,}  @{v["author"]["username"]}  {v["link"]}')

related = collections.Counter(h.lower() for v in tagged for h in v.get("hashtags", []) if h.lower() != TAG)
print(related.most_common(8))

Things that trip people up

  • It is a search for the hashtag, not TikTok's hashtag page. Most results carry the tag, but not all: 26 of our 32 #latteart videos did. Filter on the hashtags list when you need only tagged videos.
  • hashtags come without the # and in the case the creator typed. Compare in lower case.
  • Counts are strings. "views_count": "5700000" — convert with int() before sorting or adding.
  • Results are not sorted by date. The top #latteart video was from 2022. Sort by published_at yourself if you want recent ones.
  • Paging uses a cursor. Send back pagination.next_cursor as cursor; the two pages we fetched had no video in common.
  • No total count. The endpoint does not return how many videos use a hashtag overall.

Related

Cost and docs

A TikTok search is 1 credit per page; credits cost $0.25–$0.50 per 1,000 depending on the pack. Failed requests are not charged, and new accounts get 500 free credits.