Tutorial · TikTok · cURL, Python, Node.js, PHP, Go, Ruby

Fetch the posts under a TikTok hashtag with the API

Posts under a TikTok hashtag. Complete code for GET /v1/tiktok/hashtags/{tag}/posts in six languages and both official SDKs, each tested against the documented response.

Short answer. GET /v1/tiktok/hashtags/{tag}/posts returns posts under a hashtag, up to 30 a page, with caption, author, counts, music and hashtags. Pass the hashtag name or its numeric id.

Facts checked 2 December 2026. Prices change: follow the links before you decide.

Why call it

  • Branded hashtag campaigns: collect entries and their view counts for reporting or payouts.
  • Creator discovery: find active creators posting in a niche tag.
  • Social listening and AI apps: gather posts on a topic, then pull transcripts for the ones with has_captions: true.

The request

GET https://api.handlehaul.com/v1/tiktok/hashtags/{tag}/posts with your key in the X-Api-Key header. Posts under a TikTok hashtag. Posts under a TikTok hashtag. 1 credit a page. Page size up to 30. Docs: https://api.handlehaul.com/docs/tiktok-hashtag-api

Parameters for Posts under a TikTok hashtag
ParameterInDescription
tag requiredpathHashtag name (without #). For /posts also the numeric hashtag id from /v1/tiktok/hashtags/{tag}.
cursorquerynext_cursor from the previous page (opaque, sealed).
freshquerytrue skips the cache (full price).
rawquerytrue returns TikTok's raw JSON in data instead of our fields (same price).

Code in 6 languages

Each sample is a complete program: it reads the key from HANDLEHAUL_API_KEY, waits and retries when the API answers 429 (using Retry-After), stops with the error code on anything else, and follows pagination.next_cursor for up to 3 pages. The SDK versions do the retries for you.

tiktok-hashtag-posts.sh

# Posts under a TikTok hashtag. --retry waits out a 429 using its Retry-After header;
# --fail exits with code 22 on any other error (drop it to read the error JSON).
# Next page: add --data-urlencode "cursor=<pagination.next_cursor>" (stop when it is null).
curl -sS --fail --retry 3 "https://api.handlehaul.com/v1/tiktok/hashtags/booktok/posts" \
  -H "X-Api-Key: $HANDLEHAUL_API_KEY"
Generated from the OpenAPI spec (2026-12-02); every sample was syntax-checked and run against a local mock serving the response below. Language guides: Python, Node.js, PHP, Go, Ruby, cURL.

Response

A list in data, with pagination.next_cursor and has_more, and meta with what the call cost. Example values; same tiktokpost shape as posts, from the API docs. Lists are cut to two rows here.

200 · application/json
{
  "data": [
    {
      "id": "7300004256287789000",
      "url": "https://www.tiktok.com/@mila.studio/video/7300004256287789000",
      "caption": "Sample post 1 by @mila.studio #luna #fyp",
      "created_at": "2026-11-30T00:53:20.000Z",
      "media_type": "video",
      "duration_seconds": 15,
      "cover_url": "https://p16-sign.tiktokcdn-us.com/…/cover/7300004256287789000.jpeg",
      "play_url": "https://v16-webapp-prime.tiktok.com/…/7300004256287789000.mp4",
      "images": null,
      "counts": {
        "views": 499242,
        "likes": 29955,
        "comments": 998,
        "shares": 499,
        "saves": 1498
      },
      "author": {
        "id": "6800603536904605282",
        "sec_uid": "MS4wLjABAAAAFjCNJUq7pGOuS6YC8bTNAHRKWqIShz6s9C1EkRYtfRk",
        "handle": "mila.studio",
        "nickname": "Mila Studio",
        "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6800603536904605282~c5_1080x1080.jpeg",
        "is_verified": false,
        "is_private": false,
        "url": "https://www.tiktok.com/@mila.studio",
        "counts": {
          "followers": 340593,
          "following": 913,
          "likes": 10558383,
          "videos": 933
        }
      },
      "music": {
        "id": "7200000000000000000",
        "title": "original sound",
        "artist": "Mila Studio",
        "is_original": true,
        "duration_seconds": 30,
        "cover_url": "https://p16-sign.tiktokcdn-us.com/…/music/7200000000000000000~c5_720x720.jpeg",
        "play_url": "https://v16-webapp-prime.tiktok.com/…/music/7200000000000000000.mp3",
        "post_count": null,
        "url": "https://www.tiktok.com/music/original-sound-7200000000000000000"
      },
      "hashtags": [
        "luna",
        "fyp"
      ],
      "mentions": [],
      "language": "en",
      "location": null,
      "has_captions": true,
      "is_ad": false
    }
  ],
  "pagination": {
    "next_cursor": "eyJ2…sealed…",
    "has_more": true,
    "page_size": 16
  },
  "meta": {
    "request_id": "req_…",
    "cached": false,
    "cache_age_seconds": 0,
    "credits_charged": 1,
    "credits_remaining": 26943
  }
}

Cost, cache and limits

  • 1 credit per page. At $1.40 to $0.80 per 1,000 calls; the samples stop after 3 pages, so one run costs 3 credits at most. Cache hits, failed calls and 429 answers are free; meta.credits_charged says what each call cost.
  • Cache. Identical calls that arrive while an answer is cached are served from it. Add fresh=true to force a live call (billed).
  • Speed. Over your plan's requests-per-second limit the API answers 429 rate_limited with Retry-After; the samples wait that long and retry.
  • Testing. A kd_test_ key returns sample data in this exact shape at no cost, so you can run the code before you spend anything.

Things to know

  • tag takes the name or the numeric id from the hashtag call. A name is looked up for you, with no extra credit.
  • Each post carries its full hashtags list, so you can count which tags are used together.
  • Photo posts have images and no play_url; on videos, play_url is short-lived.

Next steps

TikTok hashtag posts API: questions

How do I get all videos for a TikTok hashtag?
Call /v1/tiktok/hashtags/{tag}/posts and pass pagination.next_cursor as cursor while has_more is true, up to 30 posts per page.
How do I find which creators post under a TikTok hashtag?
Read author on each post: handle, id, sec_uid and counts. Group by author.id to count posts per creator.

Run it on real 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.