Search code examples
androidiosinstagraminstagram-api

Get Instagram User ID Beyond Username


I'd like to identify users beyond their username. Is there any way to identify users with a token/code/ID# that is static and will never change?

Simply because usernames are flexible and can be changed at any time meaning I cannot keep track users.


Solution

  • Dani you can track users by their user id, which stays static even if they change their username.

    In Instagram's API example they use this endpoint: https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN which gives the following response:

    {
    "data": {
        "id": "1574083",
        "username": "snoopdogg",
        "full_name": "Snoop Dogg",
        "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg",
        "bio": "This is my bio",
        "website": "http://snoopdogg.com",
        "counts": {
            "media": 1320,
            "follows": 420,
            "followed_by": 3410
        }
    

    }

    Depending on what data or which endpoints you are hitting beforehand, you should be able to get to the user ID and use that accordingly throughout your application.