Skip to main content
Every object in the X API—posts, users, lists, DMs, spaces—has a unique ID. Understanding how these IDs work helps you build reliable integrations.

ID format

X IDs are 64-bit unsigned integers generated using a system called “Snowflake.” Each ID encodes:
  • Timestamp — When the object was created
  • Worker number — Which server generated the ID
  • Sequence number — Order within that millisecond
This means IDs are roughly time-ordered: higher IDs generally represent newer objects.
IDs are globally unique across all of X, not just within a single object type.

String vs. integer representation

Always use string IDs in your code. Some programming languages (like JavaScript) can’t accurately represent 64-bit integers.
In JavaScript, integers are limited to 53 bits. This causes precision loss with large IDs:

API versions


Working with IDs

Storing IDs

Store IDs as strings or 64-bit integers in your database:

Comparing IDs

When comparing IDs for chronological ordering:

Common ID types


Data Dictionary

See ID fields for each object type.

Post Lookup

Retrieve posts by ID.