Instagram user posts API: exporting the profile grid
A profile grid is the public face of an account — and a complete grid export is engagement analysis, content auditing and growth tracking in one dataset. The user media endpoint walks it page by page.
The endpoint
GET /v1/ig/user/media/{user_id}?count=12&max_id=<cursor>
user_id is the numeric pk (see
username resolution); count sets
the requested page size; max_id carries the cursor from the previous
response's next_max_id.
The walk
from getsocialapi import Client
ig = Client(api_key="gsa_live_...").instagram
posts, cursor = [], None
while True:
page = ig.user_medias(user_id="25025320", count=12, max_id=cursor)
posts += page["items"]
cursor = page.get("next_max_id")
if not cursor:
break
print(len(posts), "posts")
Pages concatenate cleanly — no dedupe needed for a stable account. For an account that posts mid-export, re-run and merge by media pk.
What each item carries
| Field | Meaning |
|---|---|
media_type | 1 = photo, 2 = video, 8 = carousel |
caption.text | post caption (first carousel item for carousels) |
like_count, comment_count | engagement counters |
view_count | video views |
taken_at | publish timestamp |
carousel_media[] | per-item media for type 8 |
The media-type split alone answers most content-strategy questions:
photo/video/carousel ratio, engagement by format, posting cadence from
taken_at deltas.
Variants worth knowing
- Tagged posts — posts where the account appears tagged; same pagination contract. Good for UGC monitoring.
- Stories — the ephemeral layer, no pagination (active stories in one response).
- Hashtag posts — the same item shape from a different entry point.
Sizing the export
A 500-post archive is ~40 requests at count=12 — under a minute
within plan RPS. For 10 000+ post archives, checkpoint the cursor
every N pages; it is stable across sessions, so the export can resume
after any interruption without re-walking.
The Python walker above is ~8 lines — 100 free calls cover a medium-sized profile end to end.
Build with GetSocialAPI
Explore Instagram API for capabilities, pricing and integration examples. Create an account to start with 100 free calls, or follow the quickstart.