All tutorials

How to scrape Instagram search results with Python (2026)

A Python walkthrough for GET /v2/instagram/profiles/search. Copy the snippet, run it, then read the JSON.

GET /v2/instagram/profiles/search · 1 credit

Also available in

You'll search Instagram for a phrase and see the results you get back.

Typical job: finding creators. Search a niche such as "travel magazine", page through with cursor, shortlist handles, then look up each keeper with /profiles/{profile} for the full profile. This searches accounts, not hashtags or reels.

Get ready

Create a Social Fetch API key and get Python ready. New accounts include 100 free credits.

The API Keys page in the Social Fetch app. The New API key form is labelled: type a name, then click Create key.
Open API Keys, name the key and click Create key. The full key is shown only once, so copy it straight away.
  • API key. Create a Social Fetch account, open API Keys and create a key. New accounts include 100 free credits.

  • Python setup. Python 3 with requests installed (pip install requests). Set SOCIALFETCH_API_KEY to your key.

When you're done, SOCIALFETCH_API_KEY is set in your shell.

Make the request

Copy the Python sample and run it. It calls GET /v2/instagram/profiles/search with your key in the x-api-key header, using this example: /v2/instagram/profiles/search?query=travel+magazine.

Request
Python

It prints the response as a Python dict with data and meta. An error status stops the script at raise_for_status() instead.

Read the response

The response is JSON with two parts: data holds the search results and meta holds creditsCharged and requestId. The sample below is a trimmed copy of a real response; the endpoint page lists every field. Credits are charged on completed lookups, not on failed requests.

The Social Fetch Playground running GET /v2/instagram/profiles/search with the query travel magazine. The query field, the accounts list in the response and the 1 credit charge are labelled. Handles and names in the results are blurred.
The same search in the Playground. data.accounts lists the matching accounts, best match first; data.page.nextCursor gets the next page.
Request
Sample response

Check data.lookupStatus first when the response has one. Keep meta.requestId in case a row looks wrong.

search results are a shortlist, not full profiles. Look up the keepers with GET /v2/instagram/profiles/{profile}. Keep the same query when you pass cursor.

You finished

The Playground, the docs and your code all call the same endpoint at the same price. Pick a next step below.

Common questions

Do I need an official Instagram developer account?

No. Social Fetch authenticates with your Social Fetch API key. You call GET /v2/instagram/profiles/search and we handle the lookup. You still need to follow each platform's terms for how you use public data.

What does the Instagram profile search endpoint return?

JSON with two parts: data holds the search results and meta holds creditsCharged and requestId. The endpoint page and the API docs describe every field.

Instagram profile search vs hashtag search vs reels search?

Use this route to find accounts by keyword. Use GET /v2/instagram/hashtags/search to find hashtags, and GET /v2/instagram/reels/search to search reels by keyword. They are separate calls.

Does Instagram profile search return the full profile card?

No. Each result has the id, handle, display name, picture and whether the account is verified or private. Call GET /v2/instagram/profiles/{profile} for the full profile and its counts before you store it.

How much does a successful request cost?

1 credit. Failed requests are free.

Is this okay for production?

Yes. It's the same API the Playground and the docs use: typed errors, a requestId on every response, and credits charged only on completed lookups. New accounts get 100 free credits.

Any Python-specific tips for this request?

Yes. Call response.raise_for_status() before response.json(), set a timeout on requests.get, and keep response.json()["meta"]["requestId"] when a row looks wrong.