- Instagram profile search API
Instagram profile search API
Accounts for a name or keyword, from the Instagram pages a web search has indexed (DuckDuckGo's results, not Google's and not Instagram's own ranking),...
GET /v1/instagram/search/profiles
GET /v1/instagram/search/profiles
Accounts for a name or keyword, from the Instagram pages a web search has indexed (DuckDuckGo's results, not Google's and not Instagram's own ranking), best effort and not a complete list. Each result states the account's name and rounded follower, following and post counts (extra.stats_approximate). The first 10 on a page are then read through the Instagram profile endpoint for exact counts, bio, links and picture (enrich, on by default; an account that no longer exists is dropped). The cursor is the next results page and cannot go past 11. When the search provider is busy or asks for human verification on every try the call fails, costs nothing and can be retried. Look an exact username up with profile.
- Cost: 1 credit
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
query | string | yes | Profile name, username or keywords. Also accepted as keyword, q. |
enrich | boolean | no | Read the first 10 accounts of a page for exact counts, bio, links and picture (on by default). Off returns only what the search result states, much cheaper and faster. Default true. |
Every request also accepts:
cursor: the cursor from the previous page (Pagination).trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).
Example request#
Set your key in the environment first (see Authentication).
1curl -G "https://api.socialscrape.dev/v1/instagram/search/profiles" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "query=fitness coach"1import os2import requests34params = {5 "query": "fitness coach",6}7res = requests.get(8 "https://api.socialscrape.dev/v1/instagram/search/profiles",9 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},10 params=params,11)12body = res.json()1314if body["ok"]:15 print(body["data"])16else:17 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/instagram/search/profiles");2url.search = new URLSearchParams({3 "query": "fitness coach"4}).toString();5const res = await fetch(url, {6 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },7});8const body = await res.json();910if (body.ok) {11 console.log(body.data);12} else {13 console.error(body.error.code, body.error.message);14}1{2 "nodes": [3 {4 "name": "SocialScrape Instagram profile search",5 "type": "n8n-nodes-base.httpRequest",6 "typeVersion": 4.2,7 "position": [8 0,9 010 ],11 "parameters": {12 "method": "GET",13 "url": "https://api.socialscrape.dev/v1/instagram/search/profiles",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "query",19 "value": "fitness coach"20 }21 ]22 },23 "sendHeaders": true,24 "headerParameters": {25 "parameters": [26 {27 "name": "x-api-key",28 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"29 }30 ]31 }32 }33 }34 ],35 "connections": {}36}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_5a0c4a5cf86952b8b193607c",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "profile",13 "platform": "instagram",14 "id": "20655288921",15 "handle": "fitness_._coach",16 "name": "Incredible Fitness Coach",17 "headline": null,18 "url": "https://www.instagram.com/fitness_._coach/",19 "kind": "unknown",20 "bio": "Lean Muscle🏃♂️\nDieting🍓\nGyming🏋️♂️🏋️♀️\nExercises🏋️♂️\n#healthtips #fitness #motivation #gym",21 "avatar_url": "https://scontent-atl3-1.cdninstagram.com/v/t51.2885-19/69639655_532726704200506_7538254279832764416_n.jpg?stp=dst-jpg_s150x150_tt6&_nc_cat=103&ig_cache_key=GOedJgQ6W-cZg_QBAAAAAABUQp1obkULAAAB1501500j-ccb7-5&ccb=7-5&_nc_sid=669407&efg=eyJ2Z...",22 "banner_url": null,23 "verified": false,24 "is_private": false,25 "external_url": null,26 "links": [],27 "location": null,28 "category": null,29 "created_at": null,30 "stats": {31 "followers": 396,32 "following": 657,33 "posts": null,34 "likes": null,35 "views": null36 },37 "extra": {38 "enriched": true,39 "has_reels": false,40 "is_memorialized": false,41 "is_unpublished": false,42 "relay_id": "17841420667631911",43 "search_position": 1,44 "source": "duckduckgo"45 }46 },47 {48 "object": "profile",49 "platform": "instagram",50 "id": null,51 "handle": "thestrongwai",52 "name": "Daniel Wai | Fitness Coach",53 "headline": null,54 "url": "https://www.instagram.com/thestrongwai/",55 "kind": "unknown",56 "bio": null,57 "avatar_url": null,58 "banner_url": null,59 "verified": null,60 "is_private": null,61 "external_url": null,62 "links": null,63 "location": null,64 "category": null,65 "created_at": null,66 "stats": {67 "followers": 109000,68 "following": 715,69 "posts": 510,70 "likes": null,71 "views": null72 },73 "extra": {74 "enrich_error": "upstream_blocked",75 "enriched": false,76 "search_position": 2,77 "source": "duckduckgo",78 "stats_approximate": [79 "followers"80 ]81 }82 }83 ],84 "cursor": "eyJwIjoyLCJmIjp7InEiOiJzaXRlOmluc3RhZ3JhbS5jb20gZml0bmVzcyBjb2FjaCBcIkluc3RhZ3JhbSBwaG90b3MgYW5kIHZpZGVvc1wiIiwicyI6IjEwIiwibmV4dFBhcmFtcyI6IiIsInYiOiJsIiwibyI6Impzb24iLCJkYyI6IjExIiwiYXBpIjoiZC5qcyIsInZxZCI6IjQtMzM2NTg5OTgwODgxOTY3Mzk2MzEx...",85 "has_more": true,86 "parent": null87 },88 "cursor": "eyJwIjoyLCJmIjp7InEiOiJzaXRlOmluc3RhZ3JhbS5jb20gZml0bmVzcyBjb2FjaCBcIkluc3RhZ3JhbSBwaG90b3MgYW5kIHZpZGVvc1wiIiwicyI6IjEwIiwibmV4dFBhcmFtcyI6IiIsInYiOiJsIiwibyI6Impzb24iLCJkYyI6IjExIiwiYXBpIjoiZC5qcyIsInZxZCI6IjQtMzM2NTg5OTgwODgxOTY3Mzk2MzEx...",89 "has_more": true90}Response#
A list of Profile objects in data.items, with data.cursor and data.has_more.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
not_found | 404 | no | The platform says this profile, post or item does not exist. |
upstream_blocked | 503 | yes | The platform blocked this fetch; retry (a fresh exit is used). |
Every request can also fail with the account and platform errors listed on the Errors page.
Example error:
1{2 "ok": false,3 "error": {4 "code": "upstream_blocked",5 "message": "The platform blocked this fetch; retry (a fresh exit is used).",6 "retryable": true7 },8 "credits_charged": 0,9 "request_id": "req_a8b5f98ad767fd15e7703610"10}Related endpoints#
- Instagram profile (
GET /v1/instagram/profile) - Instagram profile by user id (
GET /v1/instagram/basic-profile) - Instagram profile post count (
GET /v1/instagram/profile/post-count) - Instagram profile posts (
GET /v1/instagram/profile/posts) - Instagram profile reels (
GET /v1/instagram/profile/reels) - Instagram post or reel details (
GET /v1/instagram/post) - Instagram reel transcript (
GET /v1/instagram/post/transcript) - Instagram post comments (
GET /v1/instagram/post/comments)