Instagram Data
Retrieves public data for an Instagram user, returning the follower count, following count, and total media count.
API Introduction
About this API
The Instagram Data API is a service designed to retrieve public information about Instagram user profiles and their media. The service allows developers to query a user account via their username or profile URL to obtain profile statistics and a list of recent posts. A secondary function enables querying for specific posts or Reels using their unique code or URL to get direct links to the media content. The API provides a structured JSON output of public data, intended for applications that need to display or perform basic analysis of Instagram profile information and content.
Key Features
- User Profile Data: Extracts key user statistics from a public profile, including
follower_count,following_count, andmedia_count. - User Identity Information: Retrieves a user's
full_name,username, verification status (is_verified), privacy status (is_private), and profile picture URL. - Recent Posts List: Returns a list of a user's recent posts, providing a unique
codefor each post that can be used for individual media queries. - Specific Media Retrieval: A dedicated function to query a single post or Reel using its unique code or URL. This provides direct links to the media content, such as image URLs and their dimensions.
- Simple Query Method: Accepts a username or a full profile/post URL as input, offering flexibility in how data is requested.
Use Cases
Scenario 1: Build a Social Media Profile Viewer
- Situation: A marketing agency requires an internal dashboard to quickly review the basic stats and visual style of potential influencers.
- Implementation: An analyst inputs an influencer's Instagram profile URL into the dashboard. The backend calls the
/instagram/v1/user_infoendpoint. The dashboard then displays the influencer's profile picture,full_name,follower_count,media_count, and a gallery of their recent post images, providing a quick, high-level overview.
Scenario 2: Create a Dynamic "Latest Work" Section on a Website
- Situation: A photographer wants to automatically display their latest Instagram posts on their professional portfolio website.
- Implementation: The website's backend is configured with the photographer's Instagram username. On page load, it calls the
/v1/user_infoendpoint to get theuser_postsarray. The system then iterates through the array, using thecodeand mediaurlfor each post to populate a "Latest on Instagram" photo gallery on the website.
Scenario 3: Power a "Link in Bio" Service
- Situation: A developer is creating a service that allows users to build a simple landing page that aggregates links and showcases their latest Instagram content.
- Implementation: A user signs up and provides their Instagram username. The service calls the
/v1/user_infoendpoint. It uses theprofile_pic_urlandusernamefor the page header. It then displays a clickable grid of the user's latest posts by using the URLs provided in theuser_postsarray, linking each image to the corresponding Instagram post URL.
How it Works: Endpoints & Response
The API uses two primary endpoints: one for retrieving user-level data and another for retrieving specific media data. A valid apikey is required for all requests.
User Endpoint: GET /instagram/v1/user_info
By providing a username_or_url parameter, this endpoint returns a JSON object. This object contains a user_data key with profile statistics (e.g., follower_count, full_name) and a user_posts array that lists recent media, each with its own code and media URLs.
Media Endpoint: GET /instagram/v1/media_data
By providing a reel_post_code_or_url and a type (post or reel), this endpoint returns a JSON object with details for that single piece of media, including direct URLs to the image or video content.