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

Get TikTok hashtag views and post counts with the API

A TikTok hashtag with its post and view counts. Complete code for GET /v1/tiktok/hashtags/{tag} in six languages and both official SDKs, each tested against the documented response.

Short answer. GET /v1/tiktok/hashtags/{tag} returns a hashtag's id, name, description, post_count and view_count. Send the name without #.

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

Why call it

  • Trend dashboards: record view_count and post_count for niche hashtags on a schedule.
  • Campaign reporting: measure the size of a branded hashtag.
  • Hashtag research for creators and agencies choosing tags in a niche.

The request

GET https://api.handlehaul.com/v1/tiktok/hashtags/{tag} with your key in the X-Api-Key header. A TikTok hashtag with its post and view counts. A TikTok hashtag with its post and view counts. 1 credit. Docs: https://api.handlehaul.com/docs/tiktok-hashtag-api

Parameters for A TikTok hashtag with its post and view counts
ParameterInDescription
tag requiredpathHashtag name (without #). For /posts also the numeric hashtag id from /v1/tiktok/hashtags/{tag}.
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. The SDK versions do the retries for you.

tiktok-hashtag.sh

# A TikTok hashtag with its post and view counts. --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).
curl -sS --fail --retry 3 "https://api.handlehaul.com/v1/tiktok/hashtags/booktok" \
  -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

One object in data and meta with what the call cost. Example values, from the API docs. Lists are cut to two rows here.

200 · application/json
{
  "data": {
    "id": "5557519",
    "name": "booktok",
    "description": "",
    "post_count": 73117,
    "view_count": 1995200378,
    "url": "https://www.tiktok.com/tag/booktok"
  },
  "meta": {
    "request_id": "req_…",
    "cached": false,
    "cache_age_seconds": 0,
    "credits_charged": 1,
    "credits_remaining": 26943
  }
}

Cost, cache and limits

  • 1 credit per call. At $1.40 to $0.80 per 1,000 calls. 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

  • Keep the numeric id: the hashtag posts endpoint accepts it as well as the name.
  • description can be an empty string.
  • An unknown hashtag answers 404 and is free.

Next steps

TikTok hashtag API: questions

How do I get TikTok hashtag views?
GET /v1/tiktok/hashtags/{name} returns view_count and post_count.
Do I include the # in the hashtag?
No. Send the bare name, for example /v1/tiktok/hashtags/booktok.

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.