Profile class is the main entry point for interacting with any Instagram account. You retrieve a Profile by calling getProfile() on an authenticated JxInsta instance. The returned object exposes profile metadata through ProfileData fields, and lets you take actions such as following, unfollowing, and blocking the account, as well as paginating posts, followers, and followings.
Fetching a profile
Create an authenticated client
Instantiate
JxInsta with credentials or an existing session token. The Mobile and Web clients have slightly different constructors.- Mobile
- Web
Call getProfile()
Pass the target account’s username. Both clients expose the same method signature.
On the Web client,
followers and followings return -1 when the value is not included in the API response for a given endpoint. Check for -1 before displaying the count.Profile actions
Once you have aProfile object you can follow, unfollow, or block the account. All three methods throw InstagramException on failure.
Fetching stories and highlights
getStory() returns the account’s currently active story reels. getHighlights() returns all items from the account’s saved highlight collections.
null (Web) when no content is available, so check before iterating.
Paginating posts
getPosts() returns a PostPaginator which implements Iterator<List<Post>>. Call hasNext() before each next() call to avoid a NoSuchElementException.
- Mobile
- Web
The Mobile paginator takes no cursor argument — pagination state is managed internally.
Paginating followers and followings
getFollowers() and getFollowings() return a ProfilePaginator which implements Iterator<List<Profile>>. Each page contains up to 200 profiles (Mobile) or 50 profiles (Web).
- Mobile
- Web
getFollowings() in the same way to iterate over accounts that the profile follows.
ProfileData field reference
| Field | Type | Description |
|---|---|---|
username | String | The account’s username handle. |
pk | String | The numeric user ID (primary key). |
name | String | The full display name. |
biography | String | The bio text from the profile. |
profilePicURL | String | URL of the profile picture. |
isPrivate | boolean | Whether the account is private. |
isVerified | boolean | Whether the account has a verified badge. |
isBusinessAccount | boolean | Whether the account is a business profile. |
posts | int | Total number of posts published. |
followers | int | Number of followers (-1 if not available). |
followings | int | Number of accounts followed (-1 if not available). |