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.Documentation Index
Fetch the complete documentation index at: https://docs.x.com/llms.txt
Use this file to discover all available pages before exploring further.
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
String vs. integer representation
In JavaScript, integers are limited to 53 bits. This causes precision loss with large IDs:API versions
| Version | ID format |
|---|---|
| X API v2 | IDs are returned as strings by default |
| X API v1.1 | Returns both id (integer) and id_str (string) — always use id_str |
Working with IDs
Storing IDs
Store IDs as strings or 64-bit integers in your database:| Database | Recommended type |
|---|---|
| PostgreSQL | BIGINT or TEXT |
| MySQL | BIGINT UNSIGNED or VARCHAR(20) |
| MongoDB | String |
| SQLite | TEXT (SQLite integers max at 63 bits) |
Comparing IDs
When comparing IDs for chronological ordering:Common ID types
| Object | Example ID | Notes |
|---|---|---|
| Post (Tweet) | 1234567890123456789 | Also called Tweet ID |
| User | 2244994945 | Older accounts have shorter IDs |
| List | 1234567890 | |
| Space | 1YqGodQbNXDxv | Alphanumeric, not Snowflake format |
| DM Event | 1234567890123456789 |
Related resources
Data Dictionary
See ID fields for each object type.
Post Lookup
Retrieve posts by ID.