herascrape
API reference

Users

Profiles, followers, posts, reels, stories, highlights and reposts.

Users are addressed by numeric id on the base path. The one exception is the username lookup, which resolves a handle and returns the profile — take pk from it and use that everywhere else.

# Once, to resolve the handle:
GET /users/username/instagram      # -> { "pk": "25025320", ... }

# From then on:
GET /users/25025320/followers
GET /users/25025320/stories

There are no username-addressed sub-resources. Handles change and ids do not, so resolve once and cache the id.

Follower and following lists come back reshuffled on every request, so one full walk sees about 70-90% of the list; repeat the walk to collect the rest. Some business and verified accounts (natgeo, for one) list only about 45-49 followers before has_more goes false; plain business accounts page through fully. Both are Instagram's behaviour.

Profile by username

Fetches the full profile by handle in one Instagram request. Returns 404 profile_not_found when no account has that handle.

Path Parameters

username*Username
GET
/users/username/{username}
curl -X GET "https://example.com/users/username/string"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

The same profile object as by id below — this endpoint only differs in how it finds the user.

Profile by id

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$
GET
/users/{user_id}
curl -X GET "https://example.com/users/string"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

A profile is Instagram's full user object — roughly 250 top-level fields. Abridged, with the ones most callers use:

{
  "pk": "25025320",
  "username": "instagram",
  "full_name": "Instagram",
  "biography": "Discover what's new on Instagram 🔎✨",
  "biography_with_entities": { "raw_text": "Discover what's new on Instagram 🔎✨", "entities": [] },
  "external_url": "https://about.instagram.com/",
  "bio_links": [{ "url": "https://about.instagram.com/", "title": "" }],
  "follower_count": 692000000,
  "following_count": 176,
  "media_count": 7712,
  "is_private": false,
  "is_verified": true,
  "is_business": true,
  "category": "Internet company",
  "public_email": "",
  "profile_pic_url": "https://scontent.cdninstagram.com/...",
  "hd_profile_pic_versions": [{ "width": 1080, "height": 1080, "url": "..." }],
  "has_highlight_reels": true,
  "pronouns": []
}
FieldNote
pkThe numeric id. This is what every other endpoint wants.
biographyThe bio as plain text. biography_with_entities.raw_text carries the same string, with any @mentions and #hashtags itemised alongside.
bio_linksThe link-in-bio entries, richer than external_url.
is_privateIf true, sub-resources return 403.
hd_profile_pic_versionsSized variants; pick the largest. URLs are signed and expire.

The rest are Instagram's own flags — shopping eligibility, Threads state, moderation settings. They pass through untouched, so anything Instagram adds appears without us shipping a release.

Followers and following

Paginated on the standard cursor. Items are Instagram's compact user objects, not full profiles — fetch /users/{id} for the rest.

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$

Query Parameters

cursor?|

Opaque pagination cursor from a previous next_cursor

GET
/users/{user_id}/followers
curl -X GET "https://example.com/users/string/followers"
{
  "status": "success",
  "data": {}
}
{}

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$

Query Parameters

cursor?|

Opaque pagination cursor from a previous next_cursor

query?|

Return only the accounts this user follows whose username or full name matches this text. Page with cursor, sending the same query. Empty items means nothing matched.

GET
/users/{user_id}/following
curl -X GET "https://example.com/users/string/following"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

{
  "items": [
    {
      "pk": "51065942432",
      "username": "example",
      "full_name": "Example Account",
      "is_private": false,
      "is_verified": false,
      "profile_pic_url": "https://scontent.cdninstagram.com/...",
      "latest_reel_media": 0,
      "account_badges": []
    }
  ],
  "next_cursor": "eyJtYXhfaWQiOiIxMDAifQ",
  "has_more": true
}

Compact user objects — about 15 fields, not the ~250 of a full profile. There is no follower/following count here; fetch /users/{pk} for that.

Search a following list

Add query to /users/{id}/following to get only the accounts whose username or full name matches, for example to check whether a user follows a given account without paging the whole list:

GET /users/25025320/following?query=natgeo

Matches come back in the same items shape. Page with next_cursor and send the same query again; a search returns at most a few pages. Empty items means nothing matched.

Posts

The profile grid. Instagram serves this as a streamed GraphQL response whose shape differs from the other list endpoints, and we pass it through as-is:

{
  "feed": {
    "more_available": true,
    "next_max_id": "...",
    "profile_grid_items": [{ "media": {} }],
    "pinned_profile_grid_items_ids": ["<media id>"]
  },
  "posts": { "<media id>": {} }
}

feed.profile_grid_items is the ordered list — that array is the ordering key, and pins are called out in feed.pinned_profile_grid_items_ids. posts is a lookup keyed by media id.

Page with cursor, taking the value from feed.profile_grid_items_cursor. Keep going while feed.more_available is true:

GET /users/13460080/posts
GET /users/13460080/posts?cursor=<feed.profile_grid_items_cursor>
GET /users/13460080/posts?cursor=<next feed.profile_grid_items_cursor>

feed.next_max_id is present in the response but is not a paging token for this endpoint — Instagram's profile-timeline query keys on the cursor and ignores max_id, so feeding next_max_id back returns the first page again. The endpoint has no max_id parameter, so one you pass is ignored and you get page one again. Page with cursor only.

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$

Query Parameters

cursor?|

Opaque pagination cursor from a previous next_cursor

flat?Flat

Return one items list in grid order, each post joined with its grid entry, instead of the feed and posts halves

Defaultfalse
GET
/users/{user_id}/posts
curl -X GET "https://example.com/users/string/posts"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

The {feed, posts} shape above — and it is not the same media object that /posts/{id} returns. This endpoint is served from Instagram's GraphQL profile timeline, and we pass that through rather than reshaping it, so the difference is real and worth planning for.

The media arrives split across the two halves, and neither is complete alone:

WhereHasDoes not have
posts["<media id>"]code, caption, like_count, comment_count, play_count, complete carousel_media childrenimage_versions2, video_versions, and only a stub user
feed.profile_grid_items[].mediaimage_versions2, video_versions for reels, the full user (full_name, profile_pic_url)code, and carousel children may be truncated

Join the two on the media id to get one usable post. Which half holds the media depends on the post type, so take each from the side that actually carries it:

Post typeTake the media from
Single image (product_type: "feed")either half's image_versions2
Reel / video (product_type: "clips")feed.profile_grid_items[].media.video_versions — the posts half has no video renditions at all
Carousel (product_type: "carousel_container")posts["<id>"].carousel_media — the grid half sometimes drops the renditions on children after the first, and can report a video child as an image

Measured on one profile across four pages: every one of the 23 reels carried video_versions in the grid half and none in the posts half, while all 85 carousel children were complete in the posts half against 81 in the grid. Nothing is missing from the response — but reading only one half loses video on reels, or the trailing items of a carousel.

flat=true

Pass flat=true and we do that join for you. data becomes:

{
  "items": [{ "code": "...", "caption": {}, "video_versions": [], "user": {} }],
  "longform": [],
  "next_cursor": "...",
  "has_more": true
}

items follows the grid order. Each item is the posts entry with every field it lacks taken from its grid entry, down to each carousel child, so it carries code, the caption and counts, carousel_media with every child's image_versions2 and dimensions, video_versions for reels, and the full user. Instagram splits these fields between the two halves differently from page to page; the flat item always has the union. Page with next_cursor exactly as without the flag. The cost is the same.

Some fields also arrive with a short type prefix — 1ltaken_at, 1fvideo_duration, 1flat, 1flng, 1ldevice_timestamp, 1lbrs_severity. That is Instagram's own disambiguation in this GraphQL response, not a transport artifact, and it is what the mobile client receives. We leave the keys exactly as they arrive, because renaming them here would mean guessing on your behalf and re-guessing every time Instagram changes something.

If you want the flat REST media shape for a user's videos, /users/{user_id}/reels returns taken_at, image_versions2, video_versions and video_duration unprefixed.

Reels and tagged

Reels is the clips tab; tagged is media the user was tagged in. Both use the standard cursor list.

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$

Query Parameters

cursor?|

Opaque pagination cursor from a previous next_cursor

sort_by_views?Sort By Views

Sort profile reels by view count

Defaultfalse
GET
/users/{user_id}/reels
curl -X GET "https://example.com/users/string/reels"
{
  "status": "success",
  "data": {}
}
{}

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$

Query Parameters

cursor?|

Opaque pagination cursor from a previous next_cursor

GET
/users/{user_id}/tagged
curl -X GET "https://example.com/users/string/tagged"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

The standard list shape, with media objects in the same shape as a post. Reels are all product_type: "clips"; tagged mixes photos, carousels and reels.

Pass sort_by_views=true on the reels endpoint to order a profile's reels by view count instead of newest-first — the app's "most viewed" sort. It pages with the same cursor.

Reposts

Content the user has reposted. Standard cursor list.

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$

Query Parameters

cursor?|

Opaque pagination cursor from a previous next_cursor

GET
/users/{user_id}/reposts
curl -X GET "https://example.com/users/string/reposts"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

The standard list shape, with media objects in the same shape as a post — the reposted originals, each carrying its own author in user.

Stories and highlights

Both return a single page — has_more is always false and next_cursor is null. Stories returns the currently-active reel, which is empty for a user with nothing posted in the last 24 hours. Highlights returns the tray; fetch one highlight's media through GET /highlights/{id}.

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$
GET
/users/{user_id}/stories
curl -X GET "https://example.com/users/string/stories"
{
  "status": "success",
  "data": {}
}
{}

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$
GET
/users/{user_id}/highlights
curl -X GET "https://example.com/users/string/highlights"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

Stories returns media items (same shape as a post). Highlights returns tray entries:

{
  "items": [
    {
      "id": "highlight:17913155365000000",
      "title": "Behind the scenes",
      "media_count": 12,
      "created_at": 1699999999,
      "is_pinned_highlight": false,
      "cover_media": { "cropped_image_version": { "url": "..." } },
      "user": { "pk": "25025320", "username": "instagram" }
    }
  ],
  "next_cursor": null,
  "has_more": false
}

Pass id straight to GET /highlights/{id} — the highlight: prefix is accepted, and so is the bare number.

About this account

Instagram's "About this account" panel — join date, country, verification status, and former usernames where shown.

Best-effort. Instagram ships this screen as a rendered UI tree rather than JSON, so we request it in English and extract the visible text: details holds every line, and date_joined and country are pulled from the labelled ones. date_joined is month-level (e.g. "March 2010"). Treat details as the reliable field and the rest as convenience.

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$
GET
/users/{user_id}/about
curl -X GET "https://example.com/users/string/about"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

Instagram does not serve this screen as JSON, so the response is assembled from the rendered panel. is_verified is true when Instagram includes the profile's verification badge in the panel and false otherwise.

{
  "date_joined": "March 2010",
  "country": "United States",
  "is_verified": false,
  "former_usernames": [],
  "former_usernames_count": 0,
  "details": ["Date joined", "March 2010", "Account based in", "United States"]
}

Similar accounts

Instagram's "Suggested for you" list for a profile: the related accounts the app shows when you open it. It comes as one page, so has_more is always false.

Path Parameters

user_id*User Id

Numeric Instagram user id (pk)

Match^\d+$

Query Parameters

expand?Expand

Return up to 30 suggestion cards, each with the account's recent post previews (media_infos)

Defaultfalse
GET
/users/{user_id}/similar
curl -X GET "https://example.com/users/string/similar"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

The standard list shape. Each item is a slim user — pk, username, full_name, is_verified, is_private, profile_pic_url — plus a social_context subtitle (the short "why suggested" line). Most profiles return about 80 accounts; the list is empty when Instagram has no suggestions for the profile.

Suggestion cards with recent posts

Add expand=true to get up to 30 suggestion cards instead of bare users. Each item carries:

  • user: the suggested account, with the same slim fields as above.
  • social_context: the short "why suggested" line.
  • media_infos: up to 6 of the account's recent posts (photos, carousels and reels), each with pk, id, media_type, product_type, image_versions2, dimensions, and video_versions for videos.
  • thumbnail_urls: one thumbnail per post in media_infos.

Accounts with few posts carry fewer previews. An expanded call costs the same as a plain one.

curl "https://api.herascrape.com/users/787132/similar?expand=true" \
  -H "x-api-key: $HERASCRAPE_KEY"

Errors

CodeWhen
profile_not_foundNo such user, or deleted or banned.
private_accountThe profile exists; its content is not visible.
invalid_cursorThe cursor was not one we issued.
too_many_requestsOver 50 requests/second across your account's keys.
upstream_errorTransient. Retry.

On this page