100 free credits. No credit card required. Get a key

How to scrape Instagram popular search with cURL

Instagram’s own topic page: top posts, summary and related searches.

The examples use curl with jq to pick fields out of the JSON, which is the quickest way to see the data and to script it in a shell.

GET /v1/instagram/search/popular1 credit per callRefunded on failureBeta

Before you start

  1. Get an API keySign up for 100 free credits, no card. Keys start with gs_live_.
  2. Put it in the environmentEvery example reads it from GROUNDSOCIAL_API_KEY: export GROUNDSOCIAL_API_KEY=gs_live_…
  3. Set up cURLjq --version # brew install jq, or apt install jq

GET /v1/instagram/search/popular. Save this as fetch.sh and run bash fetch.sh. It reads the items in items and prints caption.text and play_count for each.

fetch.sh
# The whole response, pretty-printed:
curl -sS "https://api.groundsocial.dev/v1/instagram/search/popular?query=basketball" \
  -H "Authorization: Bearer $GROUNDSOCIAL_API_KEY" | jq .

# Just the text and play_count, one line per item:
curl -sS "https://api.groundsocial.dev/v1/instagram/search/popular?query=basketball" \
  -H "Authorization: Bearer $GROUNDSOCIAL_API_KEY" \
  | jq -r '.items[] | [.caption.text, .play_count] | @tsv'

The response

A real Instagram response to this call, recorded from the live API on 27 Nov 2026 and shortened for display: arrays keep their first items and … marks every cut. The recorded page had 24 items in items. Live calls return current data in the same shape.

200 OK
{
  "query": "basketball",
  "slug": "basketball",
  "description": "Basketball is a team sport played by two teams of five players on a rectangular court. The goal is to shoot the ball thr…",
  "related_keywords": [
    "the tallest basketball player",
    "dylan schmidt illinois basketball",
    "… 8 more"
  ],
  "items": [
    {
      "pk": "3738278218404085157",
      "id": "3738278218404085157_59411821286",
      "code": "DPhCDu_jj2l",
      "url": "https://www.instagram.com/p/DPhCDu_jj2l/",
      "taken_at": 1759857516,
      "media_type": 1,
      "product_type": null,
      "caption": {
        "text": "These moves will make you SHIFTY. 🤝🎒 #basketball #sports #athlete #nba #hooper #trending #reels #viral #explore #explore…"
      },
      "like_count": null,
      "comment_count": null,
      "like_and_view_counts_disabled": false,
      "user": {
        "pk": "59411821286",
        "username": "woahhelijah",
        "profile_pic_url": "https://scontent-lax3-1.cdninstagram.com/v/t51.82787-19/610894561_17974982900981287_5001518987003621074_n.jpg?stp=dst-jp…",
        "is_verified": true
      },
      "play_count": 714888,
      "image_versions2": {
        "candidates": [
          {
            "url": "https://scontent-lax7-1.cdninstagram.com/v/t51.82787-15/561460207_17965312502981287_577210961086174914_n.jpg?stp=dst-jpg…",
            "width": null,
            "height": null
          }
        ]
      },
      "video_versions": [
        {
          "url": "https://scontent-lax3-2.cdninstagram.com/o1/v/t2/f2/m86/AQOL5CzApQ4By69Qu9wJuwXCS4kObfMwME4ecezKH0gC6Yg5MQjOpO8oXtg2SYFU…",
          "width": null,
          "height": null
        },
        {
          "url": "https://scontent-lax3-2.cdninstagram.com/o1/v/t2/f2/m86/AQOL5CzApQ4By69Qu9wJuwXCS4kObfMwME4ecezKH0gC6Yg5MQjOpO8oXtg2SYFU…",
          "width": null,
          "height": null
        },
        "… 1 more"
      ]
    },
    {
      "pk": "3983670629257431716",
      "id": "3983670629257431716_61085633952",
      "code": "DdI11S3C8qk",
      "url": "https://www.instagram.com/p/DdI11S3C8qk/",
      "taken_at": 1789110607,
      "media_type": 1,
      "product_type": null,
      "caption": {
        "text": "The kind of peace you can’t buy ♱\n\nHooping my way through life, follow my journey, same court tomorrow ♱\n\n#hoops #hooper…"
      },
      "like_count": null,
      "comment_count": null,
      "like_and_view_counts_disabled": false,
      "user": {
        "pk": "61085633952",
        "username": "jmilyone",
        "profile_pic_url": "https://scontent-lax3-1.cdninstagram.com/v/t51.82787-19/837858166_17997172263033953_8502340270251305704_n.jpg?stp=dst-jp…",
        "is_verified": false
      },
      "play_count": 837519,
      "image_versions2": {
        "candidates": [
          {
            "url": "https://scontent-lax3-2.cdninstagram.com/v/t51.82787-15/930123953_18004943484033953_4777618756943601532_n.jpg?stp=dst-jp…",
            "width": null,
            "height": null
          }
        ]
      },
      "video_versions": [
        {
          "url": "https://scontent-lax3-2.cdninstagram.com/o1/v/t2/f2/m86/AQMEEWQBr8hl9Qvxj2Vph7WrM4f2Pu9c5_wW-Plfs1q7JtUOxtQBK-NP5E7IDysL…",
          "width": null,
          "height": null
        },
        {
          "url": "https://scontent-lax3-2.cdninstagram.com/o1/v/t2/f2/m86/AQMEEWQBr8hl9Qvxj2Vph7WrM4f2Pu9c5_wW-Plfs1q7JtUOxtQBK-NP5E7IDysL…",
          "width": null,
          "height": null
        },
        "… 1 more"
      ]
    },
    "… 22 more"
  ]
}

Top-level fields

FieldTypeDescription
querystring–
slugstringThe keyword page: instagram.com/popular/<slug>/.
descriptionstring | nullThe summary Instagram shows on the keyword page, when it has one.
related_keywordsstring[]–
itemsInstagramMedia[]–

Parameters

NameInTypeDescription
query (required)querystringTopic. Example: basketball.

Errors and retries

Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.

Errors
# --fail-with-body exits non-zero on a 4xx/5xx and still saves the error JSON.
curl -sS "https://api.groundsocial.dev/v1/instagram/search/popular?query=basketball" \
  -H "Authorization: Bearer $GROUNDSOCIAL_API_KEY" \
  --fail-with-body -o page.json \
  || jq -r '.error | "\(.code): \(.hint)"' page.json
StatusMeaning
200The topic page.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The account or post does not exist, or was removed.
429Too many requests. Wait for Retry-After seconds.
503Instagram is temporarily unavailable. Retryable; nothing was charged.

Every error code and what to do about it.

Pricing

Cost
Per call1 credit per call
1,000 calls$1.00 on the starter pack, $0.40 at volume
No key (MPP or x402)$0.01 per call
Failed callRefunded, never charged

Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.

From an AI agent (MCP)

The same call is the instagram_search_popular tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:

bash
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcp

Then ask for it in words (“Instagram’s popular-search page for a topic: top posts, summary, related searches”), or call the tool directly:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "instagram_search_popular",
    "arguments": {
      "query": "basketball"
    }
  }
}

MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.

Find what a topic’s top posts look like

Compare play_count across the page’s reels.

Keep going

Run it on your own data

One key for Instagram and 76 more platforms, over REST or MCP. Free credits on signup, no card.

Instagram is a trademark of Instagram, LLC (Meta Platforms, Inc.). We are not affiliated with or endorsed by Instagram or Meta.