herascrape
API reference

Search

Accounts, hashtags, audio, places, and Instagram's blended top results.

Five searches, all taking query. Four paginate on the standard cursor; places returns a single page.

Search journey identifiers

Accounts, hashtags, audio, and top search require two client-created UUIDs: search_session_id and serp_session_id. Audio also requires browse_session_id. Create them before the first page and repeat the exact same values with every continuation cursor. Use fresh values for a new query or an independent search journey.

const searchSessionId = crypto.randomUUID();
const serpSessionId = crypto.randomUUID();

const params = new URLSearchParams({
  query: "travel",
  search_session_id: searchSessionId,
  serp_session_id: serpSessionId,
});

The API validates UUID syntax and normalizes returned IDs to uppercase. It does not require the search and SERP IDs to be equal. A continuation cursor is bound to the exact endpoint, query, and IDs that created it; changing any of them returns 400 invalid_cursor. Cursors created before this contract are not accepted—restart those searches at page one.

Accounts

Typeahead account search. Items are compact user objects — take pk and fetch /users/{id} for the full profile.

For a specific handle, use GET /users/username/{username}: an exact lookup that returns the profile or a 404. Use this one when you want a list of candidates.

Query Parameters

search_session_id*Search Session Id

Client-created UUID reused for one search journey

Formatuuid
serp_session_id*Serp Session Id

Client-created UUID reused for one SERP journey

Formatuuid
query*Query

Search query

Length1 <= length
cursor?|

Opaque pagination cursor from a previous next_cursor

GET
/search/users
curl -X GET "https://example.com/search/users?search_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&serp_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&query=string"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

The standard list shape, with compact user objects identical to followers — pk, username, full_name, is_private, is_verified, profile_pic_url.

Search list responses add a search_context object that echoes the normalized journey IDs, including on the last page.

Hashtags

Names with post counts. Use the name with /hashtags/{name} for the media.

Query Parameters

search_session_id*Search Session Id

Client-created UUID reused for one search journey

Formatuuid
serp_session_id*Serp Session Id

Client-created UUID reused for one SERP journey

Formatuuid
query*Query

Search query

Length1 <= length
cursor?|

Opaque pagination cursor from a previous next_cursor

GET
/search/hashtags
curl -X GET "https://example.com/search/hashtags?search_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&serp_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&query=string"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

{
  "items": [
    {
      "id": "17841562887056054",
      "name": "travel",
      "media_count": 683000000,
      "formatted_media_count": "683M",
      "search_result_subtitle": "683M posts",
      "is_trending": false,
      "profile_pic_url": "https://scontent.cdninstagram.com/..."
    }
  ],
  "next_cursor": null,
  "has_more": false,
  "search_context": {
    "search_session_id": "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
    "serp_session_id": "BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB",
    "browse_session_id": null
  }
}

name has no #, and that is the form /hashtags/{name} expects.

Audio

Tracks and original sounds. Take the audio id and fetch /audio/{id}/medias for reels using it.

Query Parameters

search_session_id*Search Session Id

Client-created UUID reused for one search journey

Formatuuid
serp_session_id*Serp Session Id

Client-created UUID reused for one SERP journey

Formatuuid
browse_session_id*Browse Session Id

Client-created UUID reused for one audio browse journey

Formatuuid
query*Query

Search query

Length1 <= length
cursor?|

Opaque pagination cursor from a previous next_cursor

GET
/search/audio
curl -X GET "https://example.com/search/audio?search_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&serp_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&browse_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&query=string"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

{
  "items": [
    {
      "track": {
        "id": "18234567890123456",
        "title": "Song Title",
        "display_artist": "Artist",
        "duration_in_ms": 29000,
        "cover_artwork_uri": "https://..."
      },
      "original_sound": null,
      "metadata": {}
    }
  ],
  "next_cursor": "eyJwYWdlX3Rva2VuIjoiLi4uIn0",
  "has_more": true,
  "search_context": {
    "search_session_id": "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
    "serp_session_id": "BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB",
    "browse_session_id": "CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"
  }
}

Each item is either a licensed track or an original_sound (a creator's own audio) — the other is null. Check which is present before reading it.

Places

Venue search, optionally biased toward a point with lat and lng.

Instagram retired its standalone location-search screen, which is why some providers no longer offer this. The capability survives in the composer's place picker, and that is what this calls. Results are venues — take the location id and fetch /locations/{id} for its media.

Single page: has_more is always false.

Query Parameters

query?Query

Place name to search for; optional when lat+lng are given

Default""
lat?|

Latitude — with lng, lists nearby venues (query optional)

lng?|

Longitude — with lat, lists nearby venues (query optional)

GET
/search/places
curl -X GET "https://example.com/search/places"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

Venue objects from Instagram's place index, each wrapping a location:

{
  "items": [
    {
      "location": {
        "pk": "213385402",
        "name": "New York, New York",
        "address": "",
        "city": "New York, New York",
        "lat": 40.71427,
        "lng": -74.00597,
        "external_source": "facebook_places",
        "facebook_places_id": 106224666074625
      }
    }
  ],
  "next_cursor": null,
  "has_more": false
}

Take location.pk and use it with /locations/{id}.

Top

Instagram's blended search — accounts, hashtags, places and media in one ranked list.

Query Parameters

search_session_id*Search Session Id

Client-created UUID reused for one search journey

Formatuuid
serp_session_id*Serp Session Id

Client-created UUID reused for one SERP journey

Formatuuid
query*Query

Search query

Length1 <= length
cursor?|

Pagination cursor from next_cursor

GET
/search/top
curl -X GET "https://example.com/search/top?search_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&serp_session_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&query=string"
{
  "status": "success",
  "data": {}
}
{}

What comes back in data

{
  "edges": [
    { "node": { "__typename": "XDTUserDict", "pk": "25025320", "username": "instagram" } },
    { "node": { "__typename": "XDTHashtag", "name": "travel", "media_count": 683000000 } }
  ],
  "next_cursor": "eyJhZnRlciI6Ii4uLiJ9",
  "search_context": {
    "search_session_id": "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
    "serp_session_id": "BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB",
    "browse_session_id": null
  }
}

This is the one endpoint that does not use the {items, next_cursor, has_more} list shape: results are mixed types, so branch on node.__typename.

Reels

Reels keyword search is discontinued. GET /search/reels returns 410 Gone, because Instagram no longer offers a standalone reels keyword search.

Reels still surface in search, blended into the Top results. Media arrive in XDTTopSerpMediaGridUnit nodes: each node.items[] is a media object, and reels have product_type: "clips" and carry video_versions. For reels under a hashtag, GET /hashtags/{name}/top returns the same media as a plain list.

Errors

CodeWhen
unprocessable_entityquery or a required search UUID is missing/malformed.
unprocessable_entitylat/lng out of range.
invalid_cursorThe cursor is malformed, legacy, or does not match the endpoint, exact query, and journey IDs.
too_many_requestsOver 50 requests/second across your account's keys.
upstream_errorTransient. Retry.
upstream_unavailableInstagram refused the search on every account we tried. Retry with backoff; it is not billed.

On this page