GET /v1/instagram/user_feed returns the posts and reels of one public Instagram profile by handle. Read logged out it costs $0.0005 per 12 posts, so the newest 1,000 posts of an account cost about $0.0420 over about 84 calls. The Python below builds an Instagram post scraper on that endpoint in four parts: one call, a loop over older pages, a stop at a date, and a CSV file.
The full field list, a saved sample answer and the error codes are on the Instagram post scraper API page.
Why Instagram's own API does not cover this
Meta's Business Discovery call reads another account's media only when that account is a Business or Creator account. You send it from your own professional Instagram account, with a Facebook user access token that holds instagram_basic, instagram_manage_insights and pages_read_engagement, and Meta returns nothing for age-gated accounts. Posts of a personal account stay out of reach. The Virev endpoint takes any public handle and needs only an API key.
Read one page of posts
Send the handle with max_pages=1. The call answers HTTP 200 with one page under data.items, pinned posts first and then newest first, and a next_cursor for the page after it.
curl "https://api.virev.ai/v1/instagram/user_feed?handle=natgeo&max_pages=1" \
-H "Authorization: Bearer $VIREV_API_KEY"Each post holds these fields, among others.
| Field | What it holds |
|---|---|
shortcode | The X in instagram.com/p/X/, which the single-post and comments endpoints take. |
taken_at | The publish time in ISO 8601, UTC. |
kind | image, video or carousel. |
product_type | feed, clips for a reel, or carousel_container. |
caption, hashtags, mentions | The caption text and the tags and handles parsed out of it. |
likes, comments | Counts, filled on pages read signed in. |
media, media_urls | Every image and video URL, a carousel's slides included. |
owner, coauthors, tagged | The posting account, collab co-authors and tagged accounts. |
To keep only reels, filter on product_type == "clips". The feed returns reels, carousels and photos in one list, pinned posts first. To skip pinned posts, drop the items whose is_pinned is true.
Walk older pages with the cursor
Send each answer's next_cursor back as cursor until has_more is false. Every call in this loop reads logged out, so it keeps the $0.0005 per 12 posts price.
import os
import requests
API = "https://api.virev.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"}
def newest_posts(handle: str, calls: int) -> list[dict]:
posts, cursor = [], None
for _ in range(calls):
params = {"handle": handle, "max_pages": 1}
if cursor:
params["cursor"] = cursor
response = requests.get(f"{API}/v1/instagram/user_feed", params=params, headers=HEADERS, timeout=60)
response.raise_for_status()
data = response.json()["data"]
posts.extend(data["items"])
if not data["has_more"]:
break
cursor = data["next_cursor"]
return posts
posts = newest_posts("natgeo", calls=5) # up to 60 posts for $0.0025
print(len(posts), "posts")Stop at a date with since
For a date range, send since instead and let the crawler walk the pages. since takes a date such as 2026-10-01 (midnight UTC), an RFC3339 time, or a span such as 90d. The call answers HTTP 202 with a job. Poll status_url until status is ready, then read results_url and send its next_cursor back as cursor until complete is true. Polls and downloads are free, and the job charges once when it completes.
A job reads every page through one of our signed-in Instagram accounts for $0.0100 a page. In the answers we have saved, those pages carried likes and comments on every post, while pages read logged out left both null, so use a job when you need the counts.
import os
import time
import requests
API = "https://api.virev.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"}
submit = requests.get(
f"{API}/v1/instagram/user_feed",
params={"handle": "natgeo", "since": "2026-10-01"},
headers=HEADERS,
timeout=60,
)
submit.raise_for_status() # HTTP 202: a job
job = submit.json()["data"]
while job["status"] in ("queued", "running"):
time.sleep(5)
job = requests.get(API + job["status_url"], headers=HEADERS, timeout=60).json()["data"]
# payment_required means the balance is too low. Top up, then poll status_url again.
if job["status"] != "ready":
raise RuntimeError(f"job {job['batch_id']} is {job['status']}: {job['error']}")
posts, cursor = [], None
while True:
params = {"cursor": cursor} if cursor else {}
data = requests.get(API + job["results_url"], params=params, headers=HEADERS, timeout=60).json()["data"]
for result in data["results"]:
posts.extend(result.get("items", []))
if data["complete"]:
break
cursor = data["next_cursor"]
print(len(posts), "posts since 2026-10-01 for", job["cost"])Export the posts to CSV
Either loop leaves a list of post objects. Python's csv module writes them to a file that opens in a spreadsheet.
import csv
with open("natgeo_posts.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(
f,
fieldnames=["url", "taken_at", "kind", "product_type", "likes", "comments", "caption", "hashtags", "mentions"],
)
writer.writeheader()
for post in posts:
writer.writerow({
"url": f"https://www.instagram.com/p/{post['shortcode']}/",
"taken_at": post["taken_at"],
"kind": post["kind"],
"product_type": post["product_type"],
"likes": post["likes"],
"comments": post["comments"],
"caption": post["caption"] or "",
"hashtags": " ".join(post["hashtags"]),
"mentions": " ".join(post["mentions"]),
})What a scrape costs
Prices come from the pricing page, and a failed call or a private account costs nothing.
| Workload | Calls or pages | Cost |
|---|---|---|
| Newest 12 posts of one profile | 1 call | $0.0005 |
| Newest 12 posts of 100 profiles | 100 calls | $0.0500 |
| Newest 1,000 posts of one profile, logged out | about 84 calls | about $0.0420 |
| 1,000 posts in a job, with likes and comments | about 100 signed-in pages of 10 posts | about $1.00 |
For comparison, Apify lists its Instagram Post Scraper at $1.70 per 1,000 posts on its free plan, $1.50 on its Starter plan, and from $0.40 on higher tiers.
Limits to plan for
- A private, hidden or restricted account answers 403, and you are not charged.
- The feed leaves
viewsnull, so read a reel's plays with/v1/instagram/post, which takes one shortcode (Instagram post API). - Comments of a post come from
/v1/instagram/post_comments(Instagram comments API), at $0.0005 a call. - Each organization gets 100 requests a minute across all its API keys, and a 429 carries a
Retry-Afterheader. - An account can hold five queued, running or payment-required jobs at once, and a sixth answers 429.