Skip to main content
ProfileData is the data carrier for Instagram user information returned by the mobile API. Profile extends ProfileData and adds action methods that operate on the authenticated session — such as following, unfollowing, blocking, and fetching a user’s posts, stories, and highlights. You obtain a Profile instance from JxInsta.getProfile(username), which populates all fields and binds the auth token for subsequent calls.

ProfileData fields

ProfileData is populated from the raw JSON object returned by the Instagram user info endpoint. All fields are public and set in the constructor.
username
String
The account’s Instagram username (the handle shown after @).
pk
String
The user’s unique numeric primary key as returned by the API. Resolved from pk_id, pk, or id in that order of preference.
name
String
The user’s display name (full name), sourced from the full_name field.
biography
String
The text content of the user’s profile bio.
profilePicURL
String
The URL of the user’s current profile picture, sourced from profile_pic_url.
isPrivate
boolean
true if the account is set to private, false if it is public.
isVerified
boolean
true if the account has a verified badge.
isBusinessAccount
boolean
true if the account is registered as a business profile, sourced from is_business.
posts
int
Total number of media posts published by the account, sourced from media_count.
followers
int
The account’s current follower count, sourced from follower_count.
followings
int
The number of accounts the user is following, sourced from following_count.

toString()

Returns a human-readable representation of all ProfileData fields, useful for logging and debugging.
ProfileData.java
Profile profile = client.getProfile("testuser");
System.out.println(profile.toString());
// ProfileData{username='testuser', pk='123456789', name='Test User', ...}

Profile methods

Profile extends ProfileData and requires an auth token. All methods below use the token bound during construction.

getPosts()

Returns a PostPaginator for lazily iterating through all media posts published by this user. No network request is made until the paginator is advanced.
Profile.java
Profile profile = client.getProfile("natgeo");
PostPaginator paginator = profile.getPosts();

while (paginator.hasNext()) {
    List<Post> page = paginator.next();
    for (Post post : page) {
        System.out.println(post.shortcode + " — " + post.likes + " likes");
    }
}
ReturnsPostPaginator

getFollowers()

Returns a ProfilePaginator for lazily iterating through the user’s follower list. Each page yields a batch of ProfileData objects.
Profile.java
ProfilePaginator followers = profile.getFollowers();
while (followers.hasNext()) {
    List<Profile> page = followers.next();
    for (Profile follower : page) {
        System.out.println(follower.username);
    }
}
ReturnsProfilePaginator

getFollowings()

Returns a ProfilePaginator for lazily iterating through the list of accounts this user follows.
Profile.java
ProfilePaginator followings = profile.getFollowings();
while (followings.hasNext()) {
    List<Profile> page = followings.next();
    for (Profile following : page) {
        System.out.println(following.username);
    }
}
ReturnsProfilePaginator

getStory()

Fetches the currently active story items for this user. Returns an empty list if the user has no active stories or if the items key is absent from the API response.
Profile.java
Profile profile = client.getProfile("natgeo");
List<Story> stories = profile.getStory();
for (Story story : stories) {
    System.out.println(story);
}
ReturnsList<Story> ThrowsInstagramException

getHighlights()

Fetches all story items stored in this user’s highlight reels. Items from every highlight tray are flattened into a single list.
Profile.java
List<Story> highlights = profile.getHighlights();
System.out.println("Total highlight items: " + highlights.size());
ReturnsList<Story> ThrowsInstagramException

follow()

Sends a follow request to this user. For private accounts this creates a pending request; for public accounts the follow is immediate.
Profile.java
Profile profile = client.getProfile("targetuser");
profile.follow();
Returnsvoid ThrowsInstagramException

unfollow()

Unfollows this user on behalf of the authenticated account.
Profile.java
profile.unfollow();
Returnsvoid ThrowsInstagramException

block()

Blocks this user, preventing them from viewing the authenticated account’s profile and posts.
Profile.java
profile.block();
Returnsvoid ThrowsInstagramException