For AI

Answers

Can you tell when a TikTok video was posted from its ID?

Short answer

Yes, roughly: shift the 64-bit video ID right by 32 bits and the result is a Unix timestamp in seconds, usually within seconds of the posting time. It works offline, even for deleted videos. When you need the exact time, okdata TikTok video detail returns it as published_at, with the stats, for $0.002.

A TikTok video ID such as 7685272005228685423 is not a random number. It is a 64-bit integer, and its highest 32 bits are the Unix time, in seconds, when TikTok created the ID. Read those bits and you know roughly when the video went up, without opening TikTok and even after the video is gone.

The bit layout

Bits Holds
63 to 32 Unix timestamp in seconds
31 to 0 Milliseconds, a sequence number, an object type and a machine number, as decoded by forensic tools

The same scheme numbers other TikTok objects too, user and music IDs among them, so the trick dates those as well. Treat the lower 32 bits as opaque unless you have a reason to dig in; the timestamp is the useful part.

Worked example

Take 7685272005228685423.

  1. Shift right by 32 bits (the same as integer division by 4,294,967,296): 7685272005228685423 >> 32 = 1789366827.
  2. Read that as Unix seconds: 1789366827 is 14 September 2026, 06:20:27 UTC, which is 14:20:27 in Beijing.

Treat the string as a number: shifting the characters of the ID gives nonsense. In JavaScript use BigInt, because the ID is larger than a regular number can hold exactly.

How close is it?

The ID is minted just before the post is saved, so the decoded time is usually a little earlier than the posting time TikTok shows. Ryan Benson, whose write-up the Bellingcat tool is based on, found most within 5 seconds and none more than 18 seconds apart. In our own check of a dozen videos from search results, most were within half a minute, but one was almost a day apart, so use the ID for ordering and rough dating, not as evidence of the exact minute.

When to ask the API instead

TikTok video detail takes the ID or link and returns published_at in UTC, plus the caption, author and plays, likes, comments and shares.

You need Do Cost
Rough dates for a list of IDs Decode locally free
Exact posting time and current stats One detail call per video $0.002
500 videos from a campaign sheet 500 calls $1.00

Example

import os, requests
from datetime import datetime, timezone

def id_time(video_id: str) -> datetime:
    return datetime.fromtimestamp(int(video_id) >> 32, tz=timezone.utc)

vid = "7685272005228685423"
print("from the ID:", id_time(vid).isoformat())

body = requests.get("https://api.okdata.online/v1/tiktok/videos/get", timeout=60,
    headers={"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"},
    params={"id": vid, "fields": "id,published_at,metrics.views"}).json()
if body["code"] == "ok":
    print("published_at:", body["data"]["item"]["published_at"])
else:
    print(body["code"])  # not_found for a deleted video, still charged

Limits

  • The ID tells you when, not who or what. For the caption and author of a deleted video there is nothing to fetch; detail returns not_found, which is still charged as one call.
  • Video detail also accepts photo-post links (/photo/ instead of /video/).
  • Short links like vm.tiktok.com hide the ID until resolved; see getting the video ID from a TikTok short link.

Sources

  1. Tinkering with TikTok Timestamps (Ryan Benson)hindsig.ht · read
  2. unfurl: TikTok ID parser and bit layoutgithub.com · read
  3. bellingcat/tiktok-timestampgithub.com · read
  4. Just Another Hour on TikTok: ID sampling to obtain a complete slice of TikTok (arXiv 2504.13279)arxiv.org · read

Where people asked this (read 2026-11-12)

Updated

Connect once, then just ask.

Every new key comes with $0.10 to try it. One sentence connects your agent.

Start free
Connect your AI

Paste this into your agent

Read https://okdata.online/agents.md and set up okdata for me; my key is in the OKDATA_API_KEY environment variable.

Claude Code, Cursor, Codex and other agents that can open a link set themselves up from it.

MCP serverhttps://api.okdata.online/mcp