Instagram Post
Fetch one Instagram post by URL or shortcode, with caption, owner, like and comment counts and its latest comments.
Overview
Section titled “Overview”Send a post, reel or tv URL, or a bare shortcode, in urls. You get back one post object with its ID, type, shortcode, caption, URL, like and comment counts and the owner’s username.
detail_level (on by default) returns full detail including comments, and comments_per_post sets how many of the latest comments are kept. One record, no pagination.
Use cases
Section titled “Use cases”- Enrich a list of post links with engagement numbers.
- Archive a post’s caption and latest comments.
Request
Section titled “Request”curl -G "https://api.scrapier.io/api/v2/instagram-post-scraper/" \ -H "X-API-Key: YOUR_API_KEY" \ --data-urlencode "urls=https://www.instagram.com/p/DXHKcyvEWfr/" \ --max-time 210const params = new URLSearchParams({ urls: "https://www.instagram.com/p/DXHKcyvEWfr/" });
const res = await fetch(`https://api.scrapier.io/api/v2/instagram-post-scraper/?${params}`, { headers: { "X-API-Key": "YOUR_API_KEY" }, signal: AbortSignal.timeout(210_000),});const body = await res.json();if (!res.ok) throw new Error(body.error ?? body.detail ?? `HTTP ${res.status}`);
console.log(body.data.post);import requests
resp = requests.get( "https://api.scrapier.io/api/v2/instagram-post-scraper/", headers={"X-API-Key": "YOUR_API_KEY"}, params={"urls": "https://www.instagram.com/p/DXHKcyvEWfr/"}, timeout=210,)body = resp.json()if not resp.ok: raise RuntimeError(body.get("error") or body.get("detail"))
print(body["data"]["post"])curl -X POST "https://api.scrapier.io/api/v2/instagram-post-scraper/" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"urls":"https://www.instagram.com/p/DXHKcyvEWfr/"}' \ --max-time 210Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
X-API-Key header | string | yes | — | Your API key from the dashboard. |
urls | string | yes | e.g. https://www.instagram.com/p/DXHKcyvEWfr/ | Instagram post/reel/tv URL or bare shortcode. One record, no pagination. |
cursor | string | no | — | Pagination cursor returned in the previous response's next_cursor. Pass it back unchanged to fetch the next page. When next_cursor is null, you have reached the last page. |
detail_level | boolean | no | true | Full detail incl. comments. locked in cursor |
comments_per_post | integer | no | 10 | Latest comments kept. locked in cursor |
Advanced
| Name | Type | Default | Description |
|---|---|---|---|
use_proxy | boolean | true | Route the request through Scrapier's residential proxy pool. Default: true. Leave as is unless support tells you otherwise. |
raw_data | boolean | false | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under raw_responses, in place of the formatted items. When false (default) you get the formatted output. Pagination (cursor / next_cursor) works the same in both modes. |
Response
Section titled “Response”{ "success": true, "data": { "urls": "https://www.instagram.com/p/DXHKcyvEWfr/", "post": { "inputUrl": "https://www.instagram.com/p/DXHKcyvEWfr/", "id": "3875111963462821867", "type": "Video", "shortCode": "DXHKcyvEWfr", "caption": "One trip to Italy is never enough. #TucciinItaly", "url": "https://www.instagram.com/p/DXHKcyvEWfr/", "commentsCount": 1637, "likesCount": 117980, "ownerUsername": "natgeo" }, "next_cursor": null }}Bad input. The exact message varies by endpoint.
{ "success": false, "error": "…"}Balance below the endpoint’s price.
{ "error": "Insufficient credits. Buy more to scrape more.", "balance": 1, "required": 2}Invalid or unknown API key.
{ "detail": "Authentication service unavailable or invalid API key."}Throttled — wait for Retry-After.
{ "detail": "Request was throttled. Expected available in N seconds."}Sample from the live catalog; arrays trimmed to 3 items. Results are in data.post.
Response fields
Section titled “Response fields”| Field | Type | Example | Description |
|---|---|---|---|
urls | string | https://www.instagram.com/p/DXHKcyvEWfr/ | — |
post | object | {…} | The results. |
next_cursor | null | null | Pass back as cursor for the next page. null on the last page. |
post.inputUrl | string | https://www.instagram.com/p/DXHKcyvEWfr/ | — |
post.id | string | 3875111963462821867 | — |
post.type | string | Video | — |
post.shortCode | string | DXHKcyvEWfr | — |
post.caption | string | One trip to Italy is never enough. #TucciinItaly | — |
post.url | string | https://www.instagram.com/p/DXHKcyvEWfr/ | — |
post.commentsCount | integer | 1637 | — |
post.likesCount | integer | 117980 | — |
post.ownerUsername | string | natgeo | — |
Pagination
Section titled “Pagination”Returns everything in one call; next_cursor is always null.
Errors
Section titled “Errors”Failed calls are free. Branch on the HTTP status and read the message from error (or detail). Full details in Errors.
| Status | Meaning | Retry? | Charged? |
|---|---|---|---|
400 | Bad or missing input. | No — fix the params | No |
401 / 403 | Missing, invalid or revoked API key. | No — fix the key | No |
402 | Out of credits (body has balance). | No — top up | No |
404 | Unknown endpoint slug. | No — check the slug | No |
429 / 503 | Busy or throttled. | Yes — after Retry-After | No |
5xx | Target site or upstream failure, or timeout. | Yes — with backoff | No |
- For reels you also want the view count, use
instagram-reel-scraper.
Related
Section titled “Related”- Instagram Reel — Fetch one Instagram reel by URL or shortcode, with caption, owner, view, like and comment counts and its latest comments.
- Instagram Comments — List the comments on a public Instagram post, with author, text and like count, from the post URL.
- Instagram Transcript — Transcribe the speech in an Instagram reel or video post from its URL, with detected language and the post’s like and comment counts.