How to retrieve Instagram username from User ID?

Solution 1:

One can use (replace USERID by the user id). It returns a JSON in which the field user.username is that user's username.

With curl and jq installed, this shell oneliner will directly return the username:

curl -s | jq -r .user.username

However, keep in mind that this isn't an official API endpoint.

Solution 2:

You can use this API (from official instagram site) to fetch username by user static id:

GET{"user_id": ${user_id}}

Replace ${user_id} with actual user id.

const username =