Hashtag posts API
Posts under a hashtag as Instagram ranks them, a page at a time. sort is top (default: posts and reels) or reels (reels only). Pass next_cursor back as cursor, with the same sort, for the next page.
GEThttps://storiesfly.com/api/v1/hashtag/posts- Price 1 request
- Answers up to 15 minutes old
Parameters
All parameters go in the query string.
| Name | Type | Sent | Description |
|---|---|---|---|
name | string | required | Hashtag, with or without the #. Letters, digits and underscores. |
sort | string | optional | Which posts: top (posts and reels) or reels. Top when left out. |
cursor | string | optional | The next_cursor of the page before. Leave it out for the first page. |
Example request
Put your own key in the header, or in the apiKey option of the npm client.
curl "https://storiesfly.com/api/v1/hashtag/posts?name=sunset" \
-H "X-Api-Key: sf_live_your_key"const res = await fetch(
"https://storiesfly.com/api/v1/hashtag/posts?name=sunset",
{ headers: { "X-Api-Key": process.env.STORIESFLY_KEY } }
);
const data = await res.json();import os
import requests
r = requests.get(
"https://storiesfly.com/api/v1/hashtag/posts",
params={"name": "sunset"},
headers={"X-Api-Key": os.environ["STORIESFLY_KEY"]},
)
data = r.json()import { StoriesFly } from "storiesfly";
const sf = new StoriesFly({ apiKey: process.env.STORIESFLY_KEY! });
// The first page. The answer has next_cursor and has_more.
const data = await sf.hashtag.posts({ name: "sunset" });
// Every page, up to 4. Each page is charged as one call.
for await (const page of sf.paginate(sf.hashtag.posts, { name: "sunset" }, { maxPages: 4 })) {
console.log(page.posts.length);
}Example response
{
"name": "sunset",
"sort": "top",
"posts": [
{
"id": "3380156915588463035",
"shortcode": "C7ous5Ouvm7",
"url": "https://www.instagram.com/reel/C7ous5Ouvm7/",
"owner": {
"id": "178071216",
"username": "ronie_sunsetlover"
},
"taken_at": 1717166139,
"taken_at_iso": "2024-05-31T14:35:39.000Z",
"caption": "“Sunsets are my refuge, my sanctuary of inner peace.”\n❤️🔥🌅🌊\n•\n•\n#beachlife_naturelover \n#sunsetlover #sunrisechaser\n#cloudlover #coastalliving\n#oceanphotog…",
"media_type": "reel",
"pinned": false,
"thumbnail_url": "https://scontent-dfw6-1.cdninstagram.com/v/t51.71878-15/503843500_1998284320701463_841383452820314258_n.jpg",
"media": [
{
"id": "3380156915588463035",
"type": "video",
"image_url": "https://scontent-dfw6-1.cdninstagram.com/v/t51.71878-15/503843500_1998284320701463_841383452820314258_n.jpg",
"video_url": "https://scontent-dfw5-2.cdninstagram.com/o1/v/t2/f2/m82/AQOU_qhejHvTOeW0_KcPcGGCdu9Z8drN8jAVVJ0t4-wU55pFbj4bFWdETIdDBqAJAUla6K-UGtuaK1TkMWfPBL4Y-ZG48Jw2OjSPIjQ…",
"width": 720,
"height": 1280,
"video_duration": 8.066
}
],
"likes": 1164616,
"comments": 3007,
"shares": 4333,
"reposts": 1433,
"views": 27960545,
"saves": null,
"video_duration": 8.066,
"counts_hidden": false
},
{
"id": "3531645740114264147",
"shortcode": "DEC7RbUCEBT",
"url": "https://www.instagram.com/reel/DEC7RbUCEBT/",
"owner": {
"id": "3315577199",
"username": "kenneth.stst"
},
"taken_at": 1735478078,
"taken_at_iso": "2024-12-29T13:14:38.000Z",
"caption": "Is this heaven?? \n\n@vivavsamanabywyndham \n\n#viral #fyp #dominicana #dominican #paradise #beach #beachlife #sunset #beautiful",
"media_type": "reel",
"pinned": false,
"thumbnail_url": "https://scontent-dfw5-1.cdninstagram.com/v/t51.75761-15/470914565_18380784592105200_8972535487421849148_n.jpg",
"media": [
{
"id": "3531645740114264147",
"type": "video",
"image_url": "https://scontent-dfw5-1.cdninstagram.com/v/t51.75761-15/470914565_18380784592105200_8972535487421849148_n.jpg",
"video_url": "https://scontent-dfw6-2.cdninstagram.com/o1/v/t2/f2/m367/AQN7WfvRbu9F6BZ4Dlyt2FnbxDTh0zzeDFwiKcPHgIOYXSLuSW0e6uZj0DRibkz7wTYEZyzpsEeO_bmgHOtcgAh10X3Q13nkL9_22b…",
"width": 720,
"height": 1280,
"video_duration": 9.867
}
],
"likes": 907797,
"comments": 807,
"shares": 36407,
"reposts": 7768,
"views": 6555279,
"saves": null,
"video_duration": 9.867,
"counts_hidden": false
}
],
"next_cursor": "c1.ryg6VkAgkE2BcPyGM0q6ADwLG1KAGWvXyxXcleap6rtdnm6USXXD4rRRujLUjticHxS2vixe2jbdlG4LggGvIE1ISp6sYLXI6XWcb66UIrM_RMPDKCUhQylnCgNoMsPrfzM",
"has_more": true
}A real answer, shortened: lists are cut to two items and long texts to 160 characters.
Price and freshness
A call takes 1 request. Free requests are spent first, then your balance. The pricing page has the rates.
Answers are kept for up to 15 minutes. Asking again inside that time returns the same answer and takes 1 request again.
Page size follows Instagram and varies by endpoint.
Errors
A failed call answers with an HTTP status and a body {error, code}. These are the codes this endpoint gives. Errors and what is charged covers all of them.
| Status | Code | When |
|---|---|---|
400 | bad_request | A parameter is missing or wrong. fields lists the names. Free. |
401 | unauthorized | The X-Api-Key header is missing or the key is wrong. Free. |
402 | credits_exhausted | The free requests and the balance are used up. The answer has a topup_url, and free_requests_with_telegram when the account has no Telegram linked. Top up in the dashboard. Free. |
404 | not_found | The hashtag does not exist. Charged like an answer. |
429 | rate_limited | More requests in a second than your level allows. Wait for the Retry-After header. Free. |
500 | internal_error | A fault on our side. Retry shortly. Refunded. |
503 | upstream_unavailable | Our side failed or timed out. Retry shortly. Refunded. |
Questions about this endpoint
What does sort do?
sort is top (the default) or reels. top lists posts and reels in the order Instagram ranks them, reels lists the reels among them. Instagram no longer lists a hashtag's posts by date, so there is no recent.
How do I get the next page?
Send the next_cursor back as cursor, with the same sort: a cursor of one sort is refused with another. Each page takes 1 request.
What does each post hold?
The same fields as user/posts: caption, media, time, the owner and the counts.
Your first 100 requests are on us
Sign in with Google or Telegram, create a key, call any endpoint. Top up only when you need more.
