Moving to 64-bit Twitter User IDs

By @kurrik
Tuesday, 22 January 2013

Every entity represented in Twitter’s API has an ID associated with it. As we allocate larger and larger numbers for these IDs, the space required to store them must grow in turn. For example, we migrated Tweet IDs from 32-bit to 64-bit integers back in 2009, then did the same for direct message IDs in 2011. We expect to start allocating user IDs in a 64-bit integer space sometime this year. Update: This change is happening on October 21, 2013.

This means that if you currently use signed 32-bit integers to track user IDs in your system, you should update your code to use 64-bit integers as soon as you can. To be safe, and to provide a date to aim for, we recommend making this change by July 1, 2013. This includes statically typed variables in your application code and column types in your database code.

For those of you still accessing the numeric IDs via Javascript or any other non-statically-typed language, we strongly suggest using the “id_str” property instead, which treats the user ID as a string. (This property has existed on user objects for some time - it is not a new addition). Where available, “id_str” continues to be the best way to access any ID in the system, even for platforms which support 64-bit integers.

As usual, please leave any feedback about this announcement in the following discussion thread. We’ve also updated the calendar of API changes to reflect this post.