There are two ways to get data out of Instagram: Meta's official API, or scraping the public site. The right one depends on whose data you need. For accounts you manage, use the API. For anyone else's posts and comments, the API will not give you the data and scraping is the only route.
This guide explains why, and what each option costs you.
The short version
| Official API | Web scraping | |
|---|---|---|
| Whose data | Accounts you own or manage | Any public post or profile |
| Comments on other accounts' posts | No | Yes |
| Account type needed | Business or Creator | None |
| Approval | Meta app review for production use | None |
| Within Instagram's terms | Yes | No |
| Upkeep | Low | High if you build it yourself |
| Best for | Your own analytics, publishing, replying | Research on accounts you do not control |
The official Instagram API
What it is in 2026
Meta has changed its Instagram APIs several times, and older guides are often out of date. The points that matter now:
- The Basic Display API, which used to give read access to personal accounts, was shut down in December 2024.
- What remains is the Instagram API, which works only with Business and Creator accounts. There are two ways to log in: with an Instagram account or through a linked Facebook Page.
- Anything beyond testing with your own accounts needs Meta's app review.
Check Meta's developer documentation for current details, because limits and permissions change.
What you can do with it
For an account that has authorised your app, you can:
- Read the account's profile fields and its own posts
- Read, reply to, hide and delete comments on the account's own posts
- Read insights such as reach and engagement
- Publish posts and reels
There is also limited read access to other accounts:
- Business Discovery returns basic public figures and recent posts for another Business or Creator account, by username. It does not return the comments on those posts.
- Hashtag search returns public posts for a hashtag. Meta limits it to 30 unique hashtags per account in any seven days.
What you cannot do with it
- Read the comments on a post from an account you do not manage
- Read anything from a personal account
- Export another account's followers
- Skip app review for a production app
When it is the right choice
Use the API when the data is yours: a dashboard for your own account, a tool that replies to your own comments, scheduled publishing, or a product where each customer connects their own account. It is stable, documented and within the rules.
Web scraping
What it is
Scraping collects what Instagram shows publicly, using software instead of a person with a browser. The data is the same as what a visitor sees on a public post or profile.
What it adds
- Every comment on any public post or reel, with username, text, time and like count
- Replies to those comments
- Public profile details for any public account
- No dependence on the account owner authorising anything
What it costs you
It breaches Instagram's terms. Meta prohibits automated collection without permission. That is a contractual matter between you and Meta, and it is separate from whether scraping public data is lawful where you are.
The legal position is not simple. In the United States, hiQ Labs v. LinkedIn (2022) and Meta v. Bright Data (2024) both went in favour of scraping public data in specific circumstances, and both were narrow. Privacy laws such as the GDPR apply to usernames and comments even when they are public. This is not legal advice. If your project is commercial or large, speak to a lawyer.
Building it yourself is ongoing work. Instagram loads comments through internal requests that need a valid session and change without notice. A scraper that works today can stop working next month. You need to handle sessions, pagination, reply threads, rate limits and repairs.
Build it or use a service
If you scrape, you can build the scraper or pay a service that maintains one.
Build it yourself if you have unusual requirements and engineers who can maintain it indefinitely. The cost is their time, at the start and every time Instagram changes.
Use a service if you want the data and not the maintenance. You send a URL and get structured results. Social Flex works this way: you pay per comment collected, with one-off credit packs or monthly plans.
Example: the same question, both ways
Suppose you want every comment on a post.
If the post is on your own Business account, the official API can list them:
import requests
TOKEN = "YOUR_ACCESS_TOKEN"
MEDIA_ID = "YOUR_MEDIA_ID"
url = f"https://graph.instagram.com/{MEDIA_ID}/comments"
params = {"fields": "id,username,text,timestamp,like_count", "access_token": TOKEN}
while url:
page = requests.get(url, params=params).json()
for comment in page.get("data", []):
print(comment["username"], comment["text"])
url = page.get("paging", {}).get("next")
params = None # the "next" URL already carries the query
If the post belongs to anyone else, that request is not available to you, and a scraping service is the practical route:
import requests
import time
API_KEY = "sf_live_YOUR_API_KEY"
BASE = "https://api.social-flex.com"
HEADERS = {"X-API-Key": API_KEY, "Content-Type": "application/json"}
job = requests.post(
f"{BASE}/scrape",
headers=HEADERS,
json={"post_url": "https://www.instagram.com/p/ABC123DEF456/"},
).json()
while True:
status = requests.get(f"{BASE}/jobs/{job['id']}", headers=HEADERS).json()
if status["status"] in ("completed", "failed"):
break
time.sleep(5)
if status["status"] == "completed":
data = requests.get(f"{BASE}/jobs/{job['id']}/result", headers=HEADERS).json()
for comment in data["comments"]:
print(comment["username"], comment["text"])
The API documentation covers the full request and response.
Which to use, by task
| Task | Use |
|---|---|
| Analytics for your own account | Official API |
| Replying to or moderating your own comments | Official API |
| Scheduling and publishing posts | Official API |
| A product where customers connect their accounts | Official API |
| Auditing a giveaway on a post you do not own | Scraping |
| Reading the comments on competitors' posts | Scraping |
| Checking an influencer's audience before a deal | Scraping |
| Market or academic research across many accounts | Scraping |
Many teams use both: the API for their own account and scraping for everything outside it.
Frequently asked questions
Can the official API read comments on someone else's post? No. It reads comments only on posts from accounts that have authorised your app.
Does scraping put my own Instagram account at risk? With a service such as Social Flex you never connect or log in with your own Instagram account, so it is not involved.
Is scraped data less accurate than API data? No. It is the same public data a visitor sees. Counts such as likes keep changing, so record when you collected them.
Do I need to be a developer to scrape? Not with a service. Social Flex has a dashboard where you paste a URL and download a CSV. The API is optional.
Can I start with one and add the other later? Yes. They do not conflict.
Need the comments from a post you do not manage? Create a free Social Flex account. It includes 5,000 credits, one job every 24 hours and up to 1,000 comments per job.