Instagram Scraper or API: Public Data Compared
An Instagram scraper is a script that loads Instagram pages in a browser or replays the app's requests, then reads posts, hashtags and reels out of what comes back. It breaks when the site changes, and it runs into whatever limits the site puts on automated traffic. The alternative covered here is a set of 12 Instagram endpoints that return public posts, hashtag results and reels as JSON at 1 credit a successful call, under restricted-endpoint terms. This post compares the two and gives a verdict per use case, for brand and topic work in aggregate.
What does building an Instagram scraper involve?
Building an Instagram scraper means writing and maintaining browser automation or request replay against a site that wasn't built to be read by scripts. You load a profile, hashtag or post page, wait for its scripts to render the content, and parse captions, counts and media links out of the result. Or you watch the requests the page makes and replay them yourself, which is faster but ties your code to request formats you don't control.
Either way the hard part is keeping it running. Page markup and internal request formats change without notice, so a scraper that returned clean rows last week can return empty ones today. Large sites limit automated traffic, and a scraper that runs at any volume tends to start seeing login prompts, blocks or challenge pages. When that happens, stop. Getting around a site's protections with rotating accounts, proxies or CAPTCHA solvers is not a fix we'd recommend, and it moves your project from "fragile" to "against the rules".
Then read the rules themselves. Instagram's own terms, and Meta's terms for developers, are where the platform sets out what it allows. Read them before you build anything that collects Instagram data, and get legal advice if the project is commercial.
What does a scraper cost to run?
A scraper has no per-call bill, but it isn't free. You pay for the servers that run a browser per job, the time to rewrite selectors after each change, and the monitoring that tells you the output has quietly gone empty. That cost is small for a one-off script and grows with every hashtag, account and schedule you add.
What do the Instagram endpoints return?
The Instagram API at /apis/instagram returns public Instagram data as JSON, one call per lookup. It has 12 endpoints, all GET, all 1 credit per successful call. They cover hashtag and keyword search, single posts and their comments, reels for an audio track, and an account's posts, reels and tagged posts. Data is collected from publicly available sources and returned as found at the time of the call.
| Endpoint | Returns | Required | Optional |
|---|---|---|---|
/v1/instagram/hashtags-search |
Hashtag search results | q |
none |
/v1/instagram/search-popular |
Popular search results | q |
none |
/v1/instagram/post |
One post | none | url, shortcode |
/v1/instagram/post-comments |
A post's comments | shortcode |
max_id |
/v1/instagram/audio-reels |
Reels using an audio track | audio_id |
max_id |
/v1/instagram/user-posts |
An account's posts | username |
max_id |
/v1/instagram/user-reels |
An account's reels | none | username, user_id, max_id |
Five more endpoints return account details (user, user-v2, user-basic, user-embed) and highlights (user-highlights). The API page lists all 12 with their parameters.
A hashtag search is one request with your key in the X-API-Key header:
curl "https://api.perceptlayer.com/v1/instagram/hashtags-search?q=nature" \
-H "X-API-Key: $API_KEY"
We don't have a recorded response for this API, so this post doesn't show one. Run the call in the playground on the Instagram API page to see the exact fields before you write a parser. The hashtag search endpoint page links straight to it.
Which parameters do the endpoints take?
Every parameter is a string. q takes up to 100 characters on both search endpoints. username takes up to 30 characters, and so does user_id where an endpoint accepts it. shortcode on post-comments takes up to 20 characters, and audio_id up to 40. Several endpoints take an optional max_id; the reference doesn't document page sizes or defaults, so check its behaviour in the playground. The post endpoint accepts either a url or a shortcode, and post-comments takes a shortcode: the parameter names match.
Which terms apply to the restricted endpoints?
All 12 Instagram endpoints are restricted, and the restricted-endpoint terms at /legal/restricted-endpoints apply to them. They work once you accept those terms in the dashboard. The terms don't permit collecting personal data without a lawful basis, and they don't permit using data from these endpoints to contact people. That rules out lead lists, outreach and follower harvesting, whatever tool you use to collect the data.
What fits is work on brands, public posts and topics in aggregate. Count how often a hashtag appears over time. Track what a brand's own account publishes. Measure the tone of comments on a campaign post as a whole, without storing who wrote each one. When a response includes people's names, handles or profile details you don't need, drop them before you store anything. The errors list includes restricted_endpoint (403); the errors docs cover it with the other codes.
How do a scraper and the endpoints compare?
A scraper gives you control and no per-call bill, and costs you maintenance, blocks and terms risk. The endpoints give you JSON from a stable path with a credit per call, and the restricted-endpoint terms decide what you may do with it. Neither suits every job, so the table sets them side by side on the points that decide most projects.
| DIY Instagram scraper | Instagram endpoints | |
|---|---|---|
| Setup | Headless browser or request replay, session handling, parsers | API key in the X-API-Key header |
| What you get | Whatever you parse from the page | JSON from 12 documented endpoints |
| Hashtags and topics | Parsed from hashtag pages | hashtags-search and search-popular with q |
| Reels | Parsed per page | user-reels per account, audio-reels per audio_id |
| Maintenance | High: markup and requests change | Low: you maintain only your own code |
| Blocks | Risk of login prompts and challenge pages at volume | No sessions to manage; a failed call returns an error code and costs 0 |
| Speed | One browser or session per job | 1 request a second free, at least 5 a second on paid packs |
| Terms | Instagram's and Meta's terms | Restricted-endpoint terms; no personal data without a lawful basis |
| Cost | Hosting and engineering time | 1 credit per successful call; failed calls cost 0 |
What does a hashtag tracker cost?
On the endpoints, cost follows calls. A brand team that tracks 20 campaign and category hashtags with one hashtags-search call each per day makes 20 × 30 = 600 calls a month, which is 600 credits. At 20 credits a day, the 100 free credits you get after verifying an email address, with no credit card, cover the first 5 days.
Add one user-posts call a day for each of 10 brand accounts in the category, and the month grows by 10 × 30 = 300 credits, to 900. Add comments for 200 campaign posts at one call each and you reach 1,100 credits a month, which the Starter pack's 10,000 covers for about nine months. Purchased credits last 12 months, with no subscription. See pricing for what credits cost, and the credits docs for how each call is billed.
Which route should you choose?
Choose by what you'll do with the data and how often, because that decides which terms apply and what upkeep you take on. The verdicts below assume brand, topic or aggregate work, the uses the restricted-endpoint terms allow. If your plan involves contacting people or building lists of individuals, neither route is the answer.
- Hashtag and topic trends for a brand or a category: use
hashtags-searchandsearch-popularon a daily schedule. You store counts and posts per day, and you don't maintain a browser. - Monitoring a brand's own account, or competitor brands' public accounts: use
user-postsanduser-reelswith the brand'susername. Store post-level figures and captions, not follower details. - Campaign sentiment on public posts: use
post-commentswith each post'sshortcode, then score the comments in aggregate. Drop commenters' identities before you store the text. - Tracking a sound used in reels: use
audio-reelswith the track'saudio_idto follow the reels that use it over time. - A one-off question from an AI agent: connect the MCP server at
https://perceptlayer.com/mcp, wheresearch_endpointsandget_endpointare free andcall_endpointspends credits only on success. The AI agents docs cover setup. - Learning how scraping works: write a scraper against a practice site, not Instagram, and read Google Maps Scraper or Places Data API for how the same trade-off plays out on another site.
For other social sources, TikTok API: Official Options and Public Trend Data covers TikTok and the social media APIs list the rest. To check the fields first, run hashtags-search with your own hashtag in the playground on the Instagram API page, then get a free API key when they fit.
APIs in this post
Frequently asked questions
Is scraping Instagram legal?
It depends on your jurisdiction, what you collect and how you use it, and Instagram's own terms set out what the platform allows. Public posts about brands and topics are lower risk than data about individuals, which is personal data in many places. Read Instagram's terms, get legal advice for commercial use, and don't get around blocks, logins or challenges.
Can I collect Instagram data about individual people?
Not for lead generation, outreach or follower harvesting. The restricted-endpoint terms don't permit collecting personal data without a lawful basis or using data from these endpoints to contact people. Use the Instagram endpoints for brands, public posts and topics in aggregate, and drop names and handles you don't need before you store results.
How many credits does an Instagram call cost?
Each of the 12 Instagram endpoints costs 1 credit per successful call. A failed call costs nothing and returns X-Credits-Used: 0, and every successful response carries X-Credits-Used and X-Credits-Remaining. Every account gets 100 free credits after verifying an email address; larger prepaid packs start at 10,000 credits.
What happens when I hit the rate limit?
You get a 429 rate_limited error with a Retry-After header giving the seconds to wait, and the call costs nothing. Free accounts get 1 request a second, paying accounts at least 5 a second, and the limit is shared by all of an account's keys. The rate limits docs cover the RateLimit-Remaining and RateLimit-Reset headers.
Can I see an Instagram response before writing code?
Yes. The Instagram API page has a playground: pick an endpoint, fill in its parameters and run a real call with your key to see the JSON it returns. Do this before you write a parser, since this post doesn't include a recorded response and the fields are best read from a real call.