Answers

How do I get the video ID and data from a vm.tiktok.com short link?

Short answer

Pass the short link as url to TikTok video detail (/v1/tiktok/videos/get). vm.tiktok.com and vt.tiktok.com links are resolved for you, and the response carries the numeric video ID, the full URL, the caption, the author and the stats for $0.002 a link. 500 links cost $1.00.

Creators fill in your campaign form from their phones, so most of the links you get look like https://vm.tiktok.com/ZMhvqjqjq/. Your reporting needs the video ID, and that needs to be in a database, not behind a redirect. The obvious fix is to follow the redirect yourself. From a laptop that usually works. From a server, TikTok often answers the redirect request with a login wall, a region page or a bot check, and your regex finds nothing.

One call instead

TikTok video detail accepts the short link as url and does the resolving:

curl -s -G "https://api.okdata.online/v1/tiktok/videos/get" \
  -H "Authorization: Bearer $OKDATA_API_KEY" \
  --data-urlencode "url=https://vm.tiktok.com/ZMhvqjqjq/" \
  -d fields=id,url,text,published_at,author.username,metrics

The response's data.item.id is the video ID, and data.item.url is the canonical tiktok.com/@handle/video/… address. You also get plays, likes, comments, shares and saves, so the same call fills your report.

Link Example
Short link from the share button https://vm.tiktok.com/… or https://vt.tiktok.com/…
Full video link https://www.tiktok.com/@user/video/7305085486984858894
Photo post https://www.tiktok.com/@user/photo/…
Mobile web https://m.tiktok.com/…/video/…

Full links are parsed locally, so tracking parameters such as ?is_from_webapp=1 do no harm.

Cost

Links Calls Cost
1 1 $0.002
500 500 $1.00

A link that points to a deleted or hidden video returns not_found, and a malformed link returns invalid_params. Neither is charged. If your loop may retry, send an Idempotency-Key per link; a repeat within 24 hours replays the stored answer for free.

Keep the ID as text

TikTok video IDs are 19 digits. JavaScript numbers lose precision past 16 digits, and Excel shows them in scientific notation and drops the end. Store them as strings everywhere, and the ID you saved today will still work with TikTok video comments next month.

When you do not need this

  • If you only need the ID and your redirect-following works where you run it, that costs nothing. Keep it, and fall back to the API when it fails.
  • TikTok's public oEmbed endpoint returns embed HTML, title, author and thumbnail for a video URL, which is enough to show a preview, though not stats.
  • For a handful of links, opening each in a browser and copying the address bar is fine.

Every error code, and which ones are worth a retry, is on errors. To keep tracking the same videos over time, see competitor monitoring.

Updated