Instagram posts by hashtag API
Public posts and reels for an exact hashtag that a web search has indexed (DuckDuckGo's results, not Google's), best effort and not a complete hashtag f...
GET /v1/instagram/search/hashtag
GET /v1/instagram/search/hashtag
Public posts and reels for an exact hashtag that a web search has indexed (DuckDuckGo's results, not Google's), best effort and not a complete hashtag feed. The cursor is the next results page and cannot go past 11. Each result is read through the Instagram post endpoint for caption, author, media and counts (enrich, on by default; a post that no longer exists is dropped). date_posted takes day, week, month or year. When the search provider asks for human verification on every try the call fails and can be retried.
- 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 |
|---|---|---|---|
hashtag | string | yes | The hashtag, with or without #. |
date_posted | string | no | Only posts found in this window. One of day, week, month, year. Also accepted values: last-hour for hour, last-day for day, last-week for week, last-month for month, last-year for year. |
media_type | string | no | Posts and reels, or reels only. One of all, reels. |
enrich | boolean | no | Read each post for its full caption, author, media and counts (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/hashtag" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "hashtag=baking" \4 --data-urlencode "enrich=false"1import os2import requests34params = {5 "hashtag": "baking",6 "enrich": "false",7}8res = requests.get(9 "https://api.socialscrape.dev/v1/instagram/search/hashtag",10 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},11 params=params,12)13body = res.json()1415if body["ok"]:16 print(body["data"])17else:18 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/instagram/search/hashtag");2url.search = new URLSearchParams({3 "hashtag": "baking",4 "enrich": "false"5}).toString();6const res = await fetch(url, {7 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },8});9const body = await res.json();1011if (body.ok) {12 console.log(body.data);13} else {14 console.error(body.error.code, body.error.message);15}1{2 "nodes": [3 {4 "name": "SocialScrape Instagram posts by hashtag",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/hashtag",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "hashtag",19 "value": "baking"20 },21 {22 "name": "enrich",23 "value": "false"24 }25 ]26 },27 "sendHeaders": true,28 "headerParameters": {29 "parameters": [30 {31 "name": "x-api-key",32 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"33 }34 ]35 }36 }37 }38 ],39 "connections": {}40}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_99548bd2a3acef13ccfc047c",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "post",13 "platform": "instagram",14 "id": "De1XqvcOC4p",15 "url": "https://www.instagram.com/reel/De1XqvcOC4p/",16 "type": "reel",17 "author": {18 "id": null,19 "handle": "sweetcrumbl.co",20 "name": "SweetCrumbl",21 "url": "https://www.instagram.com/sweetcrumbl.co/",22 "avatar_url": null,23 "verified": null24 },25 "title": null,26 "text": "Reappearing on your feed, mine's on the reel cover😭 #baking #handmade #aesthetic #pinterest",27 "published_at": "2026-10-23T00:00:00Z",28 "duration_seconds": null,29 "language": null,30 "hashtags": null,31 "mentions": null,32 "stats": {33 "views": null,34 "likes": 153000,35 "comments": 1974,36 "shares": null,37 "saves": null,38 "dislikes": null39 },40 "media": {41 "thumbnail_url": null,42 "video_url": null,43 "audio_url": null,44 "image_urls": null,45 "width": null,46 "height": null47 },48 "song": null,49 "location": null,50 "is_pinned": null,51 "is_sponsored": null,52 "extra": {53 "enriched": false,54 "hashtag": "baking",55 "search_position": 1,56 "source": "duckduckgo",57 "stats_approximate": [58 "likes"59 ]60 }61 },62 {63 "object": "post",64 "platform": "instagram",65 "id": "Da0e-5GSRVi",66 "url": "https://www.instagram.com/reel/Da0e-5GSRVi/",67 "type": "reel",68 "author": {69 "id": null,70 "handle": "craftsbyreemm",71 "name": null,72 "url": "https://www.instagram.com/craftsbyreemm/",73 "avatar_url": null,74 "verified": null75 },76 "title": null,77 "text": "Biggest supporters lol #foryou #foryoupage #baking",78 "published_at": "2026-07-15T00:00:00Z",79 "duration_seconds": null,80 "language": null,81 "hashtags": null,82 "mentions": null,83 "stats": {84 "views": null,85 "likes": 242000,86 "comments": 778,87 "shares": null,88 "saves": null,89 "dislikes": null90 },91 "media": {92 "thumbnail_url": null,93 "video_url": null,94 "audio_url": null,95 "image_urls": null,96 "width": null,97 "height": null98 },99 "song": null,100 "location": null,101 "is_pinned": null,102 "is_sponsored": null,103 "extra": {104 "enriched": false,105 "hashtag": "baking",106 "search_position": 2,107 "source": "duckduckgo",108 "stats_approximate": [109 "likes"110 ]111 }112 }113 ],114 "cursor": "eyJwIjoyLCJmIjp7InEiOiIoc2l0ZTppbnN0YWdyYW0uY29tL3AgT1Igc2l0ZTppbnN0YWdyYW0uY29tL3JlZWwpIFwiI2Jha2luZ1wiIiwicyI6IjEwIiwibmV4dFBhcmFtcyI6IiIsInYiOiJsIiwibyI6Impzb24iLCJkYyI6IjEwIiwiYXBpIjoiZC5qcyIsInZxZCI6IjQtMjY4Mzc1NDQ2NzYzMzkxMjgzMDA0ODgy...",115 "has_more": true,116 "parent": null117 },118 "cursor": "eyJwIjoyLCJmIjp7InEiOiIoc2l0ZTppbnN0YWdyYW0uY29tL3AgT1Igc2l0ZTppbnN0YWdyYW0uY29tL3JlZWwpIFwiI2Jha2luZ1wiIiwicyI6IjEwIiwibmV4dFBhcmFtcyI6IiIsInYiOiJsIiwibyI6Impzb24iLCJkYyI6IjEwIiwiYXBpIjoiZC5qcyIsInZxZCI6IjQtMjY4Mzc1NDQ2NzYzMzkxMjgzMDA0ODgy...",119 "has_more": true120}Response#
A list of Post 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_c29449962a4e626f2ece60ba"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)