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

Get TikTok video stats by ID or URL with the API

One TikTok video or photo post by id or URL. Complete code for GET /v1/tiktok/posts/{post} in six languages and both official SDKs, each tested against the documented response.

Short answer. GET /v1/tiktok/posts/{post} takes a post id or a tiktok.com link and returns one video or photo post: caption, date, duration, views, likes, comments, shares, saves, author, music and hashtags.

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

Why call it

  • Clipping platforms: verify a submitted video's view count from its link before paying per view.
  • Campaign tracking: re-check views, likes and shares on sponsored posts for client reports.
  • Link enrichment: turn a TikTok link a user pastes into author, sound and hashtag data in one call.

The request

GET https://api.handlehaul.com/v1/tiktok/posts/{post} with your key in the X-Api-Key header. One TikTok video or photo post by id or URL. One TikTok video or photo post by id or URL. 1 credit. Docs: https://api.handlehaul.com/docs/tiktok-post-api

Parameters for One TikTok video or photo post by id or URL
ParameterInDescription
post requiredpathTikTok post id, or a tiktok.com/@user/video/<id> URL (URL-encoded).
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-video.sh

# One TikTok video or photo post by id or URL. --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/posts/7300000000000000123" \
  -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": "7300000000000000123",
    "url": "https://www.tiktok.com/@river_wren29/video/7300000000000000123",
    "caption": "Sample post 124 by @river_wren29 #pixel #fyp",
    "created_at": "2026-07-30T00:53:20.000Z",
    "media_type": "video",
    "duration_seconds": 18,
    "cover_url": "https://p16-sign.tiktokcdn-us.com/…/cover/7300000000000000123.jpeg",
    "play_url": "https://v16-webapp-prime.tiktok.com/…/7300000000000000123.mp4",
    "images": null,
    "counts": {
      "views": 538234,
      "likes": 32294,
      "comments": 1076,
      "shares": 538,
      "saves": 1615
    },
    "author": {
      "id": "6804246811370395890",
      "sec_uid": "MS4wLjABAAAAsKNrxsBn-IUSma2viuD_ShtPMiRgkVWSjeDiJxNJZ2w",
      "handle": "river_wren29",
      "nickname": "River Wren",
      "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6804246811370395890~c5_1080x1080.jpeg",
      "is_verified": false,
      "is_private": false,
      "url": "https://www.tiktok.com/@river_wren29",
      "counts": {
        "followers": 579298,
        "following": 318,
        "likes": 17958238,
        "videos": 338
      }
    },
    "music": {
      "id": "7200000000000000000",
      "title": "original sound",
      "artist": "River Wren",
      "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": [
      "pixel",
      "fyp"
    ],
    "mentions": [],
    "language": "en",
    "location": "US",
    "has_captions": true,
    "is_ad": false
  },
  "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.
  • Private accounts. Public data only: a private account answers 403 private_account, and that call is free.
  • 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

  • Send a link URL-encoded in the path. Both /video/<id> and /photo/<id> links work.
  • A post that does not exist answers 404 user_not_found, free. On this route, read that code as a missing post.
  • has_captions tells you whether the transcript endpoint will find text, before you spend a call on it.
  • Photo posts return slides in images and no play_url. On videos, play_url is short-lived.

Next steps

TikTok video or photo post API: questions

Can I pass the TikTok link instead of the video id?
Yes. URL-encode it into the path: /v1/tiktok/posts/https%3A%2F%2Fwww.tiktok.com%2F%40user%2Fvideo%2F7300000000000000123.
How do I get the sound used in a TikTok video?
Read data.music: id, title, artist, is_original and duration. Its post_count is null here; send music.id to the sound endpoint to get it.

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.