The short answer
Shotery finds outlier Reels and unanswered questions with five calls to a third-party Instagram API: profile, related profiles, an account's Reels, one Reel by shortcode and comments. The traps were 19-digit media IDs that JavaScript rounds, response shapes that differ from the docs, billed 4xx errors, and play counts that include replays.
Shotery tells experts what to film next. Under the hood, the idea is simple: find Reels in your niche that did far better than that account usually does, then read the comments under them to find questions nobody has answered yet. Those questions become your next videos. (More on what outlier videos are and on finding ideas in comments.)
To do that we need public Instagram data, and we didn't want to maintain our own scraper. So it goes through a third-party API. This is what we need, what we looked at, and what bit us while building it.
The five calls behind Shotery
Shotery needs five kinds of public data, and nothing more:
| What | Why we need it |
|---|---|
| Profile by username | Follower count, bio and the account's ID |
| Related profiles | Find other accounts in the same niche |
| An account's Reels | Views per Reel, to spot the outliers |
| One Reel by shortcode | When you paste a link |
| Comments on a Reel | The questions nobody answered |
What we looked at first
- RapidAPI. The free tier on the Instagram API we found allowed 20 requests a month. That's one test run.
- Apify. The actor from that same vendor was marked deprecated. Not something to build on.
- Our own scraper. For a small team, no. We'd spend our time on logins and blocks instead of the product.
We chose HikerAPI with a prepaid balance. For the endpoints we use it works out to roughly $0.60 to $1 per 1,000 requests, the balance doesn't expire, and it has the related-profiles endpoint we couldn't find elsewhere.
One honest caveat: at the time of writing we've made about 74 calls. This is what we learned building the integration, not a load test.
1. Media IDs are 19 digits, and JavaScript rounds them
Instagram media IDs don't fit in a JavaScript number. JSON.parse doesn't throw an error; it rounds. Parse 3512345678901234567 and you get 3512345678901234700 back. Anything above Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) is affected, so you store an ID that's almost right, and the next call with it fails.
The fix: the v2 endpoints accept safe_int=true and return large IDs as strings, so we add it to every v2 request. Some media objects also include an id like <media_pk>_<owner_pk> as a string, and splitting on the underscore gives a safe media ID without touching the number at all.
2. The response shape didn't match the docs
For the Reel-by-shortcode endpoint, the documentation example shows an items array. The real response was { media_or_ad: {...}, status }. We now read both. The lesson is general: save one real response per endpoint, parse against those, and write down the date you checked. Docs drift.
3. Related profiles arrive without follower counts
The related-profiles endpoint returns usernames, bios and avatars, but no follower count. Filtering by account size costs one more profile call per account. We store the follower count as unknown rather than zero, so a large account never looks tiny before we've checked it.
4. 4xx errors are billed, 5xx errors aren't
A 404 for a mistyped username costs the same as a successful call. So we:
- Clean input before calling: strip the @, lowercase the username, check the shortcode.
- Never retry a 4xx. Only rate limits (429) and server errors (5xx) are retried.
- Treat 402 as "balance ran out" and 401 or 403 as "wrong key", and stop instead of looping.
5. Play counts include replays
play_count is the number Instagram shows on a Reel, and it includes replays. That's fine for comparing Reels against each other, which is what outlier detection does. It's not the number of unique viewers, and we don't present it as one.
How we keep a prepaid balance from draining
With a prepaid balance, the risk isn't one expensive call. It's a background job quietly making a thousand cheap ones. Two things keep it in check:
- Every request is logged against the user and the task that triggered it. That gives a daily spend per person, and the scheduler stops at a daily cap.
- The provider sits behind one small interface, with a fake version for local development. Everyday development spends no credits, and switching providers means writing one new adapter. Our noted fallback is RocketAPI, which bills only 200 and 404 responses.
Even so, a "your balance is $0.52" email arrived this morning. Top-up alerts are worth setting up.
What we'd do from day one
- Save real responses and parse against them, not against the docs.
- Treat IDs as text everywhere: database, URLs and logs.
- Count the cost of each request from the first commit.
- Accept the tradeoff: a third-party scraping API depends on Instagram not changing underneath it, so keep the adapter thin and swappable.
Disclosure: we're part of HikerAPI's user-rewards program. They credit our account for posts like this. Everything above is our actual experience.
Questions
Why do Instagram media IDs break in JavaScript?
Instagram media IDs are 19 digits long, larger than the biggest integer JavaScript can represent exactly (9,007,199,254,740,991). JSON.parse rounds them silently, so the ID you store no longer matches the real one. Ask the API for IDs as strings and keep them as text everywhere.
Are failed requests billed by Instagram scraping APIs?
It depends on the provider. With HikerAPI, 4xx responses such as a 404 for a missing username are billed and 5xx server errors aren't. RocketAPI bills only 200 and 404 responses. Validate input before you call and never retry 4xx errors.
How much does it cost to pull Instagram data through an API?
For the endpoints Shotery uses, HikerAPI works out to roughly $0.60 to $1 per 1,000 requests on a prepaid balance that doesn't expire. Checking one account's recent Reels takes a few requests, because Reels come 12 per page.