GET /v1/instagram/post_comments
Instagram comments API: get the comments of a post by shortcode
Returns the comments of one Instagram post as Page[Comment]: text, time, likes and the commenter's account. Send the numeric media_id or the post's shortcode; max_pages=1 answers one page at once, and any other value starts a job you poll. get_raw=true returns the JSON Instagram answered.
- Price
- $0.0005 per page
- Billing
- $0.0005/page
- Batch
- Yes, through /v1/batch
- Failed calls
- Not charged
Example request
curl 'https://api.virev.ai/v1/instagram/post_comments?media_id=3955764706547590026&max_pages=1' \
-H "Authorization: Bearer $VIREV_API_KEY"import os
import requests
response = requests.request(
"GET",
"https://api.virev.ai/v1/instagram/post_comments",
params={
"media_id": "3955764706547590026",
"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 |
|---|---|---|---|
media_id required | query | string | Numeric media id (the post pk). A post shortcode is accepted and converted. |
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 first, default 24. Instagram controls the returned count. |
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[Comment]. |
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
The example response of the API reference.
{
"data": {
"items": [
{
"id": "18000000000000001",
"text": "nice",
"created_at": "2025-09-04T15:35:00+00:00",
"likes": 5,
"replies": null,
"liked_by_owner": null,
"owner": {
"id": "111",
"username": "fan_one",
"full_name": "Fan One",
"is_verified": false,
"is_private": false,
"avatar_url": "https://scontent.cdninstagram.com/fan.jpg",
"latest_story_at": null,
"extra": {}
},
"extra": {}
}
],
"pages": [
{
"cursor": null,
"fetched_at": "2026-09-09T07:00:00+00:00",
"count": 1,
"signed_in": false
}
],
"next_cursor": "eyJhZnRlciI6IlFWRkMuLi4iLCJvcCI6InBvc3RfY29tbWVudHMifQ",
"has_more": true,
"stop_reason": "pages",
"coverage": {
"since": null,
"oldest_at": "2025-09-04T15:35:00+00:00",
"since_reached": false
}
},
"meta": {
"source": "live",
"fetched_at": "2026-09-09T03:10:22Z",
"cost": "$0.0005",
"balance": "$0.3777",
"request_id": "req_f1abb41157ca15c565d48a90bacef554"
}
}How it works
Wraps doc_id PolarisLoggedOutDesktopWWWPostCommentsPaginationQuery (first, after). With max_pages=1, returns Page[Comment] 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.
The example response is the crawler's own projection of a synthetic upstream document into Page[Comment], not a live capture.
Billing: $0.0005 per page, so a job bills $0.0005 for each page it reads. 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. |