InstagramAnswer

Instagram Basic Display API replacement: personal accounts

Meta shut the Basic Display API and nothing replaces it for personal accounts. Ours reads public profiles and posts by username, 50 posts a call.

5 min read

Short answer

  • Meta ended the Instagram Basic Display API and every request now returns an error. Its two replacements work only for Business and Creator accounts, so no official API reads a personal account.
  • Business Discovery reads other accounts, but only Business and Creator ones, is documented only for Facebook Login, and returns no data for age-gated accounts.
  • ToolzerHub reads public profiles and posts by username: 1 credit per call, up to 50 posts per call, 100 free credits a month. It has no login flow and no write access.
On this page

Meta shut down the Instagram Basic Display API on December 4, 2024, and nothing replaces it for personal accounts. The two APIs that remain work only for Instagram Business and Creator accounts. For a public profile or its posts, our Instagram API reads them by username, and the script below saves them to CSV.

The replacement is for professional accounts

Meta's changelog says every request to Basic Display now returns an error, and Meta's announcement said no set of Instagram APIs for consumer developer apps would remain. The replacements are the Instagram API with Instagram Login and the one with Facebook Login. Both need an Instagram professional account, a business or creator one. Serving accounts you don't own needs Advanced Access, which requires App Review and Business Verification, and no Meta page lets a personal account connect to either API.

What Business Discovery can read

Business Discovery is the official way to read another account's profile and post metrics, and only for Business and Creator accounts. It is documented for Facebook Login only, and it returns no data for age-gated accounts. You call it on your own professional account's ID with the other account's username: GET /17841405309211844?fields=business_discovery.username(bluebottle){followers_count,media_count,media}. The public fields include biography, followers_count, media_count, username and website, and the media edge expands to comments_count, like_count and view_count.

Use Meta's API when the account is yours or your customers' and they can sign in: reach, publishing, comment moderation and messaging exist only there.

Public profiles and posts with ToolzerHub

We make ToolzerHub. Our Instagram API reads a public profile or its posts from a username, with one API key and no Meta app, Facebook Page or professional account of your own. /v1/instagram/user/info takes a username and returns the profile. /v1/instagram/user/posts returns up to 50 posts per call and a next_max_id that you pass back as cursor. To page an account's whole posts list, see Instagram API get user posts.

This script writes profiles and recent posts to two CSV files.

python
import csv
import os
import sys
import time
from datetime import datetime, timezone

import requests

BASE = "https://api.toolzerhub.com/v1/instagram"
HEADERS = {"x-api-key": os.environ["TOOLZERHUB_API_KEY"]}
PROFILE_FIELDS = ["username", "user_id", "full_name", "verified", "private", "followers",
                  "following", "external_url", "biography"]
POST_FIELDS = ["username", "code", "posted", "type", "likes", "comments", "caption", "url"]


def cell(value):
    # Spreadsheets run text that starts with = + - or @ as a formula; an apostrophe keeps it text.
    if isinstance(value, str) and value[:1] in ("=", "+", "-", "@", "\t", "\r"):
        return "'" + value
    return value


def get(path, params, tries=4):
    # 429 and 503 are retryable.
    for attempt in range(tries):
        r = requests.get(f"{BASE}/{path}", headers=HEADERS, params=params, timeout=90)
        if r.status_code not in (429, 503) or attempt == tries - 1:
            r.raise_for_status()
            return r.json()["data"]
        time.sleep(5 * (attempt + 1))


def profile_row(p):
    return {
        "username": p["username"],
        "user_id": p["id"],
        "full_name": p.get("full_name"),
        "verified": p.get("is_verified"),
        "private": p.get("is_private"),
        "followers": (p.get("edge_followed_by") or {}).get("count"),
        "following": (p.get("edge_follow") or {}).get("count"),
        "external_url": p.get("external_url"),
        "biography": (p.get("biography") or "").replace("\n", " "),
    }


def post_row(username, m):
    return {
        "username": username,
        "code": m["code"],
        "posted": datetime.fromtimestamp(m["taken_at"], timezone.utc).isoformat(timespec="minutes"),
        "type": m.get("product_type"),
        "likes": m.get("like_count"),
        "comments": m.get("comment_count"),
        "caption": ((m.get("caption") or {}).get("text") or "").replace("\n", " "),
        "url": f"https://www.instagram.com/p/{m['code']}/",
    }


def main(usernames, limit="24"):
    limit = int(limit)
    n_profiles = n_posts = n_calls = 0
    with open("profiles.csv", "w", newline="", encoding="utf-8") as pf, \
         open("posts.csv", "w", newline="", encoding="utf-8") as qf:
        profiles = csv.DictWriter(pf, fieldnames=PROFILE_FIELDS)
        posts = csv.DictWriter(qf, fieldnames=POST_FIELDS)
        profiles.writeheader()
        posts.writeheader()
        for name in [u.strip() for u in usernames.split(",") if u.strip()]:
            profile = get("user/info", {"username_or_url": name})
            n_calls += 1
            if not profile:  # unknown usernames return 200 with data null
                print(f"{name}: not found")
                continue
            n_profiles += 1
            profiles.writerow({k: cell(v) for k, v in profile_row(profile).items()})
            cursor, got = None, 0
            while got < limit:
                params = {"user_id": profile["id"], "count": min(50, limit - got)}
                if cursor:
                    params["cursor"] = cursor
                page = get("user/posts", params)
                n_calls += 1
                for m in page["items"][: limit - got]:
                    posts.writerow({k: cell(v) for k, v in post_row(name, m).items()})
                    got += 1
                cursor = page.get("next_max_id")
                if not page.get("more_available") or not page["items"]:
                    break
            n_posts += got
    print(f"wrote {n_profiles} profiles and {n_posts} posts, {n_calls} calls")


if __name__ == "__main__":
    if len(sys.argv) < 2:
        sys.exit("usage: python instagram_profile_posts.py user1,user2 [posts_per_user]")
    main(*sys.argv[1:])

cell() puts an apostrophe in front of text that starts with =, +, - or @, so a spreadsheet shows it as text.

Run the script

bash
export TOOLZERHUB_API_KEY=your_key
python instagram_profile_posts.py nasa,mrbeast,natgeo 60

It wrote 3 profiles and 180 posts in 9 calls and 38.8 seconds. Each account needed one profile call and two post calls (50, then 10). The profile file:

username followers following verified
nasa 104,375,026 90 yes
mrbeast 90,969,166 1,013 yes
natgeo 268,361,712 195 yes

The first posts of the NASA file:

posted type likes comments
2026-10-10 clips 688,608 6,824
2026-10-06 feed 257,196 790
2026-10-02 carousel_container 1,240,275 4,892
  • Median likes were about 170,300 for nasa, 879,200 for mrbeast and 57,000 for natgeo.
  • The first three rows of each account are older than the rest, so sort by posted if you need newest first.
  • type is Instagram's own label: clips is a reel, feed a single photo or video, carousel_container a multi-image post.
  • Posts in the list carry no view count. Reel views come from /v1/instagram/post/views at 1 credit per reel, which returned 23,543,099 video_view_count and 61,516,871 play_count for one mrbeast reel. play_count is the plays shown on the owner's Reels tab, available only for their 36 newest reels.

What it costs

Each call is 1 credit, so the run used 9 credits. At 50 posts per call, 1,000 posts from one account are 20 post calls plus 1 profile call, 21 credits. The 100 free credits a month cover that run many times; $19 buys 10,000 credits that never expire, and plans for higher volume cover more accounts. Set your key and run the script on your first username.

For comments on a post, see how to export Instagram comments; for comments and keyword search in one script, see our Instagram scraper in Python.

We are not affiliated with Meta Platforms, Inc. or Instagram.

Get this data from your own code

The Instagram API returns it as JSON with one x-api-key header. 100 free credits monthly.