PublicAPIs exposes four static methods that call Instagram’s unauthenticated endpoints. No login is required, which makes these methods ideal for read-only integrations, bots that only display content, or situations where storing credentials is not practical. Because these requests do not carry a session cookie, Instagram enforces stricter rate limits than authenticated endpoints — particularly on getProfileInfo.
Package
Methods
getPostInfo(String url)
Fetches read-only metadata for any public Instagram post by its URL. The returned PostData object cannot be used to perform actions (like, comment, etc.); use JxInsta.getPost for interactive operations.
Full URL of the Instagram post, e.g.
https://www.instagram.com/p/CODE/. The shortcode is extracted automatically.com.jxinsta.web.endpoints.post.PostData
Throws — InstagramException
getProfileInfo(String username)
Fetches public profile information for a user without requiring authentication.
The Instagram username to look up (without
@).com.jxinsta.web.endpoints.profile.ProfileData
Throws — InstagramException
getPosts(String pk, int count, String cursor)
Fetches a page of posts for a given user, identified by their numeric ID (pk). Use ProfileData.pk to obtain the numeric ID first.
The numeric user ID of the account whose posts to fetch.
Number of posts to request in this page. Instagram may return fewer results than requested.
Pagination cursor (
after) for fetching subsequent pages. Pass null to start at the most recent post.List<com.jxinsta.web.endpoints.post.PostData>
Throws — InstagramException
hashtagSearch(String tag, String after)
Returns a HashtagPaginator that pages through posts associated with a given hashtag. Each call to next() returns up to 29 HashtagPost records.
The hashtag to search for, without the
# character (e.g. "travel" not "#travel").Pagination cursor from a previous
HashtagPaginator page. Pass null to start from the beginning.com.jxinsta.web.paginators.HashtagPaginator
HashtagPost record
Each item yielded byHashtagPaginator.next() is a HashtagPost Java record with the following components.
The shortcode of the post (the
CODE part of instagram.com/p/CODE/).The numeric media ID of the post.
The post caption text.
The username of the account that published the post.
URL of the post’s display/thumbnail image (
display_uri).The view count of the post (
play_count in the API response).Direct URL to the first video version of the post.