GET /v1/instagram/user_feed
Instagram post scraper API: get a profile's posts and reels
This Instagram post scraper API returns the posts and reels of one public account by handle: shortcode, time, kind, caption, hashtags, mentions, tagged accounts, media URLs and, on pages read signed in, likes and comments. max_pages=1 answers one page at once, and any other value, or a since date, starts a job you poll. Read one post by shortcode with the Instagram post API and its comments with the comments API.
- Price
- $0.0005 per 12 results
- Billing
- $0.0005/12, $0.0100/signed-in page
- Batch
- Yes, through /v1/batch
- Failed calls
- Not charged
Example request
curl 'https://api.virev.ai/v1/instagram/user_feed?handle=instagram&max_pages=1' \
-H "Authorization: Bearer $VIREV_API_KEY"import os
import requests
response = requests.request(
"GET",
"https://api.virev.ai/v1/instagram/user_feed",
params={
"handle": "instagram",
"max_pages": "1",
},
headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
timeout=60,
)
response.raise_for_status()
print(response.json())Parameters
| Name | In | Type | Description |
|---|---|---|---|
handle required | query | string | Instagram account handle (a leading @ is accepted). On the operations whose upstream call takes the numeric account id, the crawler resolves it; a handle it has never seen costs one extra anonymous profile read. |
since | query | string | Stop at this date. 2025-09-21 means midnight UTC (2025-09-21T00:00:00Z). Datetimes must use RFC3339 with a timezone, for example 2025-09-21T09:00:00+09:00. 365d means 365 days before submission. Invalid calendar dates return 400. With max_pages, the first boundary reached stops the walk. since alone creates a job. |
max_pages | query | integer | Maximum pages to fetch. -1 walks until exhaustion or since with no page cap, and must be written. Omitted, since alone bounds the walk; with neither, the job stops after 10 pages. Any positive integer is accepted. 1 returns one page synchronously with HTTP 200; any other value creates a durable job with HTTP 202. |
cursor | query | string | Opaque next_cursor from an earlier acquisition of this operation, also with get_raw=true. A native Instagram max_id or end_cursor from a raw page answers 400. Result download cursors belong to the results route. |
page_size | query | integer | Native count, default 12. Instagram controls the returned count. Billed per 12 unique returned items. |
cached | query | auto | cache_only | live | auto (default) serves a read saved within the last 24 hours for these exact arguments, otherwise fetches. cache_only never contacts Instagram (404 not_cached when nothing is saved, whatever its age). live always fetches. Anything else is a 400. A saved read is an earlier answer of this operation for the same arguments; an account in the profile library (/v1/instagram/profile) is not one until this operation has read it. cache_only reads one saved page per request: omit max_pages or pass 1, and continue with next_cursor. |
get_raw | query | boolean | true returns the upstream JSON exactly as Instagram answered it instead of the normalized Page[Post]. |
Idempotency-Key | header | string | Reuse this key with the same inputs to recover a lost job submission. A different input with the same key returns 409. |
Example response
One of our signed-in Instagram accounts read this page, so likes and comments are filled, and the live API wraps the answer in a meta block with the cost and request id. Shown here are 3 of the 10 posts in the data block saved for handle=instagram on 2026-11-25 and read back with cached=cache_only, which never contacts Instagram, with lists cut to their first 3 items and long text shortened.
{
"data": {
"items": [
{
"id": "4036874267181041121",
"shortcode": "DgF28H6PcXh",
"taken_at": "2026-11-23T17:01:20+00:00",
"kind": "video",
"product_type": "clips",
"caption": "the peel at the end >>> 🌸\n\n#InTheMoment\n\nVideo and music by @paul_riedmueller",
"hashtags": [
"InTheMoment"
],
"mentions": [
"paul_riedmueller"
],
"accessibility_caption": null,
"likes": 203972,
"comments": 6014,
"views": null,
"counts_hidden": false,
"comments_disabled": null,
"is_pinned": false,
"is_paid_partnership": false,
"owner": {
"id": "25025320",
"username": "instagram",
"full_name": "Instagram",
"is_verified": true,
"is_private": false,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/550891366_18667771684001321_1383210656577177067_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GGbv1SApFvlLPVJCAOtF0XrDJjITbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2…",
"latest_story_at": "2026-11-24T20:14:57+00:00",
"extra": {}
},
"coauthors": [],
"sponsors": [],
"tagged": [
{
"id": "5619557401",
"username": "paul_riedmueller",
"full_name": "𝓟𝓪𝓾𝓵 𝓡𝓲𝓮𝓭𝓶𝓾𝓮𝓵𝓵𝓮𝓻",
"is_verified": false,
"is_private": null,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/583122071_18406602061189402_5180717786476360888_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=102&ig_cache_key=GJe8wSIaEWEBtWRBALi0eNBgm_VHbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5j…",
"latest_story_at": null,
"extra": {}
}
],
"location": null,
"audio": {
"id": "27067218186209055",
"title": "Original audio",
"artist": "paul_riedmueller",
"is_original": true
},
"thumbnail_url": "https://instagram.ficn3-3.fna.fbcdn.net/v/t51.82787-15/903005757_1153538590422109_1397028078736474940_n.jpg?stp=dst-jpg_e15_tt6&_nc_cat=1&ig_cache_key=NDAzNjg3NDI2NzE4MTA0MTEyMTExNTM1Mzg1ODcwODg3NzY%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=ey…",
"video_duration": null,
"media": [
{
"kind": "video",
"url": "https://instagram.ficn3-3.fna.fbcdn.net/o1/v/t2/f2/m86/AQPfUPkBljkn-uyqVht8aonJHqB1qSJXVPCpVWT1_RQvAXJ6M0EEBNtf-7yAV-umayo8WvuYJarss6z7yuWeCpv9YgRu4xqf2ulI4os.mp4?_nc_cat=1&_nc_oc=AdpQ5G35c6dPPXUEc7kLL5GwjdXfD6MUWgv1wMXGTSu6Rac-W55zIkCFIXKq…",
"width": 720,
"height": 1280,
"duration": null
}
],
"media_urls": [
"https://instagram.ficn3-3.fna.fbcdn.net/o1/v/t2/f2/m86/AQPfUPkBljkn-uyqVht8aonJHqB1qSJXVPCpVWT1_RQvAXJ6M0EEBNtf-7yAV-umayo8WvuYJarss6z7yuWeCpv9YgRu4xqf2ulI4os.mp4?_nc_cat=1&_nc_oc=AdpQ5G35c6dPPXUEc7kLL5GwjdXfD6MUWgv1wMXGTSu6Rac-W55zIkCFIXKq…"
],
"extra": {}
},
{
"id": "4034795878330602587",
"shortcode": "Df-eXldGxRb",
"taken_at": "2026-11-20T20:06:11+00:00",
"kind": "carousel",
"product_type": "carousel_container",
"caption": "we’ve hit the Las Vegas Grand Prix jackpot. @visacashapprb driver @arvid.lindblad takes us through a practice day, from pre-paddock moments to what’s on his playlist in the car 🏁\n\nwatch the #LasVegasGP free on @appletv, the US home of @f1\n…",
"hashtags": [
"LasVegasGP"
],
"mentions": [
"visacashapprb",
"arvid.lindblad",
"appletv"
],
"accessibility_caption": "Photo shared by Instagram on November 20, 2026 tagging @visacashapprb, @f1, and @arvid.lindblad. May be an image of racing vehicles, race car, helmet and text.",
"likes": 402989,
"comments": 6993,
"views": null,
"counts_hidden": false,
"comments_disabled": null,
"is_pinned": false,
"is_paid_partnership": false,
"owner": {
"id": "25025320",
"username": "instagram",
"full_name": "Instagram",
"is_verified": true,
"is_private": false,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/550891366_18667771684001321_1383210656577177067_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GGbv1SApFvlLPVJCAOtF0XrDJjITbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2…",
"latest_story_at": "2026-11-24T20:14:57+00:00",
"extra": {}
},
"coauthors": [
{
"id": "5542953666",
"username": "arvid.lindblad",
"full_name": "Arvid Lindblad",
"is_verified": true,
"is_private": null,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/741106144_18446824408185667_5512138833993959472_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GOBhLCxDexUASolBADCI2KAQDX9MbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2…",
"latest_story_at": null,
"extra": {}
}
],
"sponsors": [],
"tagged": [
{
"id": "330587883",
"username": "lando",
"full_name": "Lando Norris",
"is_verified": true,
"is_private": null,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.2885-19/458491014_1278008923572146_213590393602142634_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GIYEVBuyx_ijV4oEAKpxF9JU0-YCbkULAAAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2RlX…",
"latest_story_at": null,
"extra": {}
},
{
"id": "1070427790",
"username": "visacashapprb",
"full_name": "Visa Cash App Racing Bulls F1 Team",
"is_verified": true,
"is_private": null,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/861190380_18642612169027791_5505077714524582195_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GOy4VDPPMAVkWztCADMxKKMD92VMbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2…",
"latest_story_at": null,
"extra": {}
},
{
"id": "1692820292",
"username": "f1",
"full_name": "FORMULA 1®",
"is_verified": true,
"is_private": null,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/774033792_18629752507020293_7788221637935302919_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GIDRIi4FNG9EqS9CAAcJJeFQUhVsbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2…",
"latest_story_at": null,
"extra": {}
}
],
"location": null,
"audio": null,
"thumbnail_url": "https://instagram.ficn3-3.fna.fbcdn.net/v/t51.82787-15/910629315_18816837493001321_5613063578197879477_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=1&ig_cache_key=NDAzNDc5MzQ5MDAwNDU0MTM4MQ%3D%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI…",
"video_duration": null,
"media": [
{
"kind": "image",
"url": "https://instagram.ficn3-3.fna.fbcdn.net/v/t51.82787-15/910629315_18816837493001321_5613063578197879477_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=1&ig_cache_key=NDAzNDc5MzQ5MDAwNDU0MTM4MQ%3D%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI…",
"width": 1080,
"height": 1350,
"duration": null
},
{
"kind": "video",
"url": "https://instagram.ficn3-3.fna.fbcdn.net/o1/v/t16/f2/m84/AQM3WNajDLT2HbKNvSJ-03i7uOROXQSor2JVBvKkqpudrUVM8xYwTy0a4JT1ZdH5ykwNEnFiiopao0c7RGUFITXSpwqLR9fLk9-BF1E.mp4?_nc_cat=105&_nc_oc=Adq7aEhTEqSGzt4ePMIEa8Lenz36r--j9rzjcK8hFT9H3vwrOf97P8xKJ…",
"width": 720,
"height": 900,
"duration": null
},
{
"kind": "video",
"url": "https://instagram.ficn3-3.fna.fbcdn.net/o1/v/t16/f2/m84/AQNPcEpqAZMxGNkhILAeyIPSJVZbpEgPHL4ybZNul1Yc0YoNB7IAertVyl9Y85daFYfwT9n4tJG4ZO1GjGvsRKjFcmm404iFxmpuxKM.mp4?_nc_cat=108&_nc_oc=Adob1KKCQsQYgCP0Bh6EkTh-wqQk3qHnuE4ru2MDvqEOyDR4GkLa9OECG…",
"width": 720,
"height": 900,
"duration": null
}
],
"media_urls": [
"https://instagram.ficn3-3.fna.fbcdn.net/v/t51.82787-15/910629315_18816837493001321_5613063578197879477_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=1&ig_cache_key=NDAzNDc5MzQ5MDAwNDU0MTM4MQ%3D%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI…",
"https://instagram.ficn3-3.fna.fbcdn.net/o1/v/t16/f2/m84/AQM3WNajDLT2HbKNvSJ-03i7uOROXQSor2JVBvKkqpudrUVM8xYwTy0a4JT1ZdH5ykwNEnFiiopao0c7RGUFITXSpwqLR9fLk9-BF1E.mp4?_nc_cat=105&_nc_oc=Adq7aEhTEqSGzt4ePMIEa8Lenz36r--j9rzjcK8hFT9H3vwrOf97P8xKJ…",
"https://instagram.ficn3-3.fna.fbcdn.net/o1/v/t16/f2/m84/AQNPcEpqAZMxGNkhILAeyIPSJVZbpEgPHL4ybZNul1Yc0YoNB7IAertVyl9Y85daFYfwT9n4tJG4ZO1GjGvsRKjFcmm404iFxmpuxKM.mp4?_nc_cat=108&_nc_oc=Adob1KKCQsQYgCP0Bh6EkTh-wqQk3qHnuE4ru2MDvqEOyDR4GkLa9OECG…"
],
"extra": {}
},
{
"id": "4033352068250302848",
"shortcode": "Df5WFYiJXmA",
"taken_at": "2026-11-18T20:19:00+00:00",
"kind": "image",
"product_type": "feed",
"caption": "somewhere between cloud 9 and the @cma stage ☁️\n\n@megmoroney performs at the 60th annual #CMAawards tonight, where she’s nominated for Song of the Year and Female Vocalist of the Year.\n\na closer look at country’s biggest night with megan, c…",
"hashtags": [
"CMAawards"
],
"mentions": [
"cma",
"megmoroney"
],
"accessibility_caption": "Photo shared by Instagram on November 18, 2026 tagging @megmoroney, and @cma. May be pop art of one or more people, makeup, turtleneck and text.",
"likes": 327010,
"comments": 4715,
"views": null,
"counts_hidden": false,
"comments_disabled": null,
"is_pinned": false,
"is_paid_partnership": false,
"owner": {
"id": "25025320",
"username": "instagram",
"full_name": "Instagram",
"is_verified": true,
"is_private": false,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/550891366_18667771684001321_1383210656577177067_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GGbv1SApFvlLPVJCAOtF0XrDJjITbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2…",
"latest_story_at": "2026-11-24T20:14:57+00:00",
"extra": {}
},
"coauthors": [],
"sponsors": [],
"tagged": [
{
"id": "47409282",
"username": "megmoroney",
"full_name": "Megan Moroney",
"is_verified": true,
"is_private": null,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/580917099_18546194983049283_7717051542809504403_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GGsXoCJDWOaDquNBAJNqitJ9eRhrbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2…",
"latest_story_at": null,
"extra": {}
},
{
"id": "218784435",
"username": "cma",
"full_name": "Country Music Association",
"is_verified": true,
"is_private": null,
"avatar_url": "https://scontent.cdninstagram.com/v/t51.82787-19/926685419_18648095551032436_768248837066301703_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=1&ig_cache_key=GOsYPDd0jA4XWEBCAAehcTg-XqkKbmNDAQAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2ZW5jb2R…",
"latest_story_at": null,
"extra": {}
}
],
"location": null,
"audio": null,
"thumbnail_url": "https://instagram.ficn3-3.fna.fbcdn.net/v/t51.82787-15/903005679_18816277264001321_5705965247936288370_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=1&ig_cache_key=NDAzMzM1MjA2ODI1MDMwMjg0OA%3D%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI…",
"video_duration": null,
"media": [
{
"kind": "image",
"url": "https://instagram.ficn3-3.fna.fbcdn.net/v/t51.82787-15/903005679_18816277264001321_5705965247936288370_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=1&ig_cache_key=NDAzMzM1MjA2ODI1MDMwMjg0OA%3D%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI…",
"width": 3072,
"height": 4096,
"duration": null
}
],
"media_urls": [
"https://instagram.ficn3-3.fna.fbcdn.net/v/t51.82787-15/903005679_18816277264001321_5705965247936288370_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=1&ig_cache_key=NDAzMzM1MjA2ODI1MDMwMjg0OA%3D%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI…"
],
"extra": {}
}
],
"pages": [
{
"cursor": null,
"fetched_at": "2026-11-25T00:06:07.201310+00:00",
"count": 10,
"signed_in": true
}
],
"next_cursor": "eyJtYXhfaWQiOiJBUUhUblVycm9OaTYzWHJQLUpPelJTWkowei0xLXBoeElDejZGV2dqSGp1bU9xZUtCeWkyVWNBaS1jNFlfSERsRE1WaG9ZdjQ0NnlXQ3NyNzl1a1dQeUUwNXciLCJvcCI6InVzZXJfZmVlZCJ9",
"has_more": true,
"stop_reason": "pages",
"coverage": {
"since": null,
"oldest_at": "2026-11-13T16:59:51+00:00",
"since_reached": false
}
}
}Response fields
| Field | Type | Description |
|---|---|---|
data.items[].id | string | Numeric media id of the post, sent as a string. |
data.items[].shortcode | string | The X in instagram.com/p/X/. Send it to the post API or the comments API. |
data.items[].taken_at | string | Publish time in ISO 8601, UTC. |
data.items[].kind | string | image, video or carousel. |
data.items[].product_type | string | Instagram's own type: feed, clips for a reel, or carousel_container. |
data.items[].caption | string | null | The caption text. |
data.items[].hashtags | string[] | Hashtags in the caption, without the #. |
data.items[].mentions | string[] | Handles named in the caption, without the @. |
data.items[].accessibility_caption | string | null | Instagram's alt text for the media, when it has one. |
data.items[].likes | integer | null | Like count. The logged-out pages we have saved leave it null, and so does a hidden like count. |
data.items[].comments | integer | null | Comment count. The logged-out pages we have saved leave it null. |
data.items[].views | integer | null | A reel's play count. The feed does not carry it, so it is null here. |
data.items[].counts_hidden | boolean | null | True when the owner hid the like and view counts. |
data.items[].is_pinned | boolean | null | True when the post is pinned to the top of the profile. |
data.items[].is_paid_partnership | boolean | null | True when Instagram labels the post as a paid partnership. |
data.items[].owner | Account | The posting account: id, username, full_name, is_verified, is_private and avatar_url. |
data.items[].coauthors | Account[] | Co-authors of a collab post. |
data.items[].tagged | Account[] | Accounts tagged in the media. |
data.items[].sponsors | Account[] | Brands named in the paid partnership label. |
data.items[].audio | Audio | null | A reel's sound: id, title, artist and is_original. |
data.items[].thumbnail_url | string | null | The cover image URL. |
data.items[].media | Media[] | One entry per image or video, a carousel's slides included: kind, url, width, height. |
data.items[].media_urls | string[] | The same media URLs as a flat list. |
data.pages[].signed_in | boolean | True when one of our signed-in accounts read the page, which sets its price. |
data.next_cursor | string | null | Send it back as cursor for the next page. |
data.has_more | boolean | False on the last page of the profile. |
data.stop_reason | string | Why the read stopped, such as pages, since or exhausted. |
data.coverage.oldest_at | string | Publish time of the oldest post read. |
data.coverage.since_reached | boolean | True when the walk reached the since date. |
Logged-out pages and signed-in pages: price and fields
Each page is billed one of two ways, and data.pages[].signed_in says which.
- A call with
max_pages=1and no cursor reads page 1 logged out for $0.0005 per 12 posts it returns, and a call with thenext_cursorof such a call stays logged out at the same price. - At that price 1,000 posts take about 84 calls and cost about $0.0420, because Instagram decides how many posts a page holds.
- A job, which any other
max_pagesor asincedate starts, reads every page through one of our signed-in Instagram accounts for $0.0100 a page. - The signed-in pages we have saved held 10 posts each, so 1,000 posts cost about $1.00 that way.
- In the saved answers we checked on 2026-11-26, pages read logged out had
likesandcommentsnull on every post, and pages read signed in had both on every post.
A failed call, a private account and a timeout cost nothing.
Scrape every post since a date
Send since and the crawler walks the profile back to that date in a job, so you never handle an Instagram cursor. since takes a date such as 2025-09-21 (midnight UTC), an RFC3339 time, or a span such as 90d. Add max_pages to stop earlier, or max_pages=-1 to walk the whole profile.
- The call answers HTTP 202 with
batch_id,status_urlandresults_url. - Poll
status_urluntilstatusisready, which is free. - Read
results_url, and send itsnext_cursorback ascursoruntilcompleteis true. - The job charges once, when it completes, and a failed job charges nothing.
import os
import time
import requests
API = "https://api.virev.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"}
# since alone starts a job (HTTP 202) that walks back to the date.
submit = requests.get(
f"{API}/v1/instagram/user_feed",
params={"handle": "instagram", "since": "90d"},
headers=HEADERS,
)
submit.raise_for_status()
job = submit.json()["data"]
while job["status"] in ("queued", "running"):
time.sleep(5)
job = requests.get(API + job["status_url"], headers=HEADERS).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 {}
page = requests.get(API + job["results_url"], params=params, headers=HEADERS)
page.raise_for_status()
data = page.json()["data"]
for result in data["results"]:
posts.extend(result.get("items", []))
if data["complete"]:
break
cursor = data["next_cursor"]
print(len(posts), "posts for", job["cost"])Page through the newest posts one call at a time
For a cheap read of the newest posts, call with max_pages=1 and send each answer's next_cursor back as cursor. Each call answers HTTP 200 with one page, and has_more turns false on the last one.
import os
import requests
API = "https://api.virev.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"}
posts, cursor = [], None
for _ in range(5): # 5 calls, about 60 posts
params = {"handle": "instagram", "max_pages": 1}
if cursor:
params["cursor"] = cursor
response = requests.get(f"{API}/v1/instagram/user_feed", params=params, headers=HEADERS)
response.raise_for_status()
data = response.json()["data"]
posts.extend(data["items"])
if not data["has_more"]:
break
cursor = data["next_cursor"]
print(len(posts), "posts")curl 'https://api.virev.ai/v1/instagram/user_feed?handle=instagram&max_pages=1&cursor=NEXT_CURSOR' \
-H "Authorization: Bearer $VIREV_API_KEY"Export Instagram posts to CSV
Write the posts from either loop to a CSV file with Python's csv module. The post URL is https://www.instagram.com/p/<shortcode>/, for a reel too.
import csv
# posts: the list of items from either loop above
with open("instagram_posts.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["shortcode", "url", "taken_at", "kind", "product_type", "likes", "comments", "caption", "hashtags", "media_urls"])
for post in posts:
writer.writerow([
post["shortcode"],
f"https://www.instagram.com/p/{post['shortcode']}/",
post["taken_at"],
post["kind"],
post["product_type"],
post["likes"],
post["comments"],
post["caption"] or "",
" ".join(post["hashtags"]),
" ".join(post["media_urls"]),
])How it works
Wraps GET /api/v1/feed/user/{username}/username/?count&max_id. With max_pages=1, returns Page[Post] under data; with get_raw=true returns the upstream JSON.
The default request creates a durable job (202). Use max_pages=1 for one synchronous Page response (200). Poll status_url, then read results_url with its opaque cursor. Acquisition stops at the first of since, max_pages, or exhaustion. Jobs continue after disconnects. Result responses are bounded to 3 MiB; this does not limit the crawl. An output unit above that byte budget fails the job before billing; results return 413. The selected raw or normalized mode never changes automatically. Supply Idempotency-Key to recover a lost submission response; reuse it with the same inputs.
Unknown, unsupported, and repeated query parameters return 400 before acquisition or billing.
Billing: $0.0005 per 12 unique returned items, rounded up to a minimum of one billing unit. That price holds for a page read logged out. A page read through one of our signed-in Instagram accounts costs $0.0100 per page instead. Page 1 reads the logged-out timeline, then our signed-in grid for the like, comment and play counts the timeline lacks, so it costs the signed-in price whenever that grid answers, as it did on every staging read on 2026-11-25. Only a page the logged-out timeline alone answered costs the logged-out price. A job reads every page through a signed-in account, and so does a call with a cursor from a job. Each entry of pages says signed_in, and a get_raw=true answer counts them in signed_in_pages. Jobs settle once after successful completion. Submission, polling and repeat downloads are free. Insufficient funds return 402 with no result data until a top-up covers the full charge.
Errors
| Status | When |
|---|---|
400 | The request parameters are invalid. |
401 | Missing, malformed, or revoked API key. |
402 | Balance is too low for this request. |
403 | Instagram does not show this account to logged-out readers: it is private, hidden or restricted, or it no longer exists. Retrying will not change the answer until the account changes. You are not charged. |
404 | cached=cache_only found nothing saved for these arguments (not_cached; call again with cached=auto to fetch it), or the account, post, highlight, or location does not exist (not_found). |
429 | Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged. |
502 | The upstream fetch failed. You are not charged. |
503 | Billing could not be confirmed, so no upstream data was returned. |
504 | The upstream request timed out. You are not charged. |
Frequently asked questions
How much does it cost to scrape 1,000 Instagram posts?
Read logged out with max_pages=1, 1,000 posts take about 84 calls at $0.0005 per 12 posts, about $0.0420 in all, because Instagram decides how many posts a page holds. Read in a job, every page goes through one of our signed-in accounts at $0.0100 a page, and the signed-in pages we have saved held 10 posts each, so 1,000 posts cost about $1.00. Failed calls are never charged.
Why are likes and comments null on some posts?
In the saved answers we checked, pages read logged out carried no like or comment counts, and pages read signed in carried both. A job reads every page signed in. likes is also null when the owner hides the like count, and counts_hidden is then true.
Does the posts API return reel views?
No. The profile feed does not carry a reel's play count, so views is null. The Instagram post API at /docs/instagram-post-api reads one post or reel by shortcode, views included.
How do I get only reels, or only posts?
Filter on kind and product_type. A reel has kind video and product_type clips, a carousel has kind carousel, and a single photo has kind image and product_type feed. The feed returns all three in one list, pinned posts first and then newest first. To skip pinned posts, drop the items whose is_pinned is true.
Is it legal to scrape Instagram posts, and can I read a private account?
We give no legal advice. The endpoint reads only public accounts, and a private, hidden or restricted account answers 403 with no charge. Check the law that applies to how you store and use the data.
Do I need an Instagram account or login?
No. You send only your Virev API key in the Authorization header. A max_pages=1 call and the calls that follow its cursor read logged out. A job reads every page through one of our signed-in Instagram accounts at $0.0100 a page, and those pages are where likes and comments come from.
Guides that use this endpoint
- How to Get Instagram Profile Data with an API (2026 Guide)
- Building an Influencer Discovery Tool: The Complete API Guide
- Instagram Engagement Rate API: Calculate ER for Any Creator
- The Cheapest Instagram Data API: Pay-Per-Request Pricing Explained
- Instagram post scraper: export a profile's posts to CSV with Python