Skip to main content

Bulk convert Twitter IDs to usernames without Twitter API

Apr 18, 2022 · Last updated: May 26, 2022 ·
Posted in weblog#tech
Categories: twitter

Recently, I found myself in a situation where I needed to convert a big list of permanent Twitter user IDs to usernames. Getting the username from an ID is as easy as following what this URL redirects to:<ID>. But doing this is bulk requires using the Twitter API in some way. Registering for Twitter developer account requires verifying your phone number and I didn't want to deal with credentials for this temporary task.

Meanwhile, I found It allows you to convert Twitter IDs to screen names but you have to do it one by one.

Inspecting the network tab in the developer console, I found that it makes a POST request to with the data input=<ID>. I made a file named twids with each line containing one ID, and ran the following command in my terminal. It takes each line of twids file, makes a POST request with the data, and writes out the response to stdout separated by newline characters.

xargs -I {} curl -s -d 'input={}' '' -w '\n' < twids

If you're wondering how I ended up with this problem, it all started when I decided to wipe out my Twitter profile and downloaded an archive of my data. I soon discovered that the file containing the list of accounts I followed only included the corresponding Twitter IDs, and I needed the usernames in order to obtain RSS feeds for Twitter accounts from