Meta का official Instagram Graph API आपको सिर्फ अपने या authorized Business accounts की Stories और Reels पढ़ने देता है, और इसके लिए linked Facebook Page के साथ App Review भी जरूरी होता है। API Hop Instagram Data API के जरिए developers सीधे synchronous GET endpoints कॉल करके public user Stories (V2 $0.002/req), Highlights (V2 $0.002/req), Reels feeds और keyword search (V1 $0.001/req, V2 $0.002/req) निकाल सकते हैं, और $0.001–$0.002/req में shortcode और 19-digit media_id के बीच conversion कर सकते हैं।
मुख्य बातें
- Stories और Highlights के लिए V3 के बजाय V2 चुनें: V1 में Stories endpoints नहीं हैं। Active 24-hour Stories और profile Highlights के लिए V2 ($0.002/req)
usernameयाuser_idदोनों स्वीकार करता है और V3 ($0.008/req) से एक-चौथाई कीमत पर चलता है। - Input और discovery जरूरत के हिसाब से Reels endpoints बांटें: अगर आपके पास creator का
user_idपहले से है तो V1 ($0.001/req) से Reels list निकालें।usernameसे शुरुआत करने या keyword search करने के लिए V2 ($0.002/req) इस्तेमाल करें, और cursor-basedafter/beforepagination या recommended feeds के लिए V3 ($0.008/req) रखें। - V3 shortcode converters की कीमत $0.002 है, $0.008 नहीं: Standard V3 endpoints
$0.008/reqचार्ज करते हैं, लेकिन तीनों shortcode utilities (/v3/media-ids,/v3/shortcodesऔर/v3/shortcodes/from-url) सिर्फ $0.002/req लेती हैं, जबकि V1 converters $0.001/req के हैं। - 60 सेकंड का sync response और failure पर credit release: हर route सिर्फ
GETquery parameters लेता है, request body की अनुमति नहीं देता, और बिना auto-retry या auto-pagination के चलता है। Upstream failure पर hold किया गया credit वापस रिलीज हो जाता है, जबकि सफल empty Story response पर एक request का बिल बनता है। - बिना monthly fee के $10 minimum top-up: API Hop Pricing page पर $10 का non-expiring prepaid deposit 5,000 V2 Stories calls या 10,000 V1 Reels calls कवर करता है, जिसमें USDT/USDC और local wallets का ग्लोबल सपोर्ट मिलता है।
2026 में Instagram Stories, Reels और Shortcodes निकालने के तीन तरीके
अपना integration लिखने से पहले onboarding rules, billing models और 10,000 calls की लागत की तुलना करें (2026-11-30 को verified):
| Access Route | Account और Review Barrier | Billing Model | 10,000 Calls की अनुमानित लागत | Operational Boundary |
|---|---|---|---|---|
| Official Instagram Graph API | Facebook Page से जुड़ा Business/Creator account; App Review जरूरी | $0/call (प्रति 24h 4,800 × impressions की सीमा) | $0 (सिर्फ अपने या client accounts) | किसी भी public account की Stories या competitor Reels नहीं पढ़ सकते; कम impressions पर rate limit जल्दी लगती है |
| Apify Reels / Story Scrapers | Meta review की जरूरत नहीं | Per-result actor fee (~$0.49–$2.00+/1K items) + platform plan (Starter $19/mo) + proxy/compute | ~$4.90–$20.00+ (plan और compute अलग) | Async actor containers से cold-start latency आती है; concurrency बढ़ने पर proxy खर्च बढ़ता है |
| API Hop Instagram Data API | Self-serve Bearer key, कोई Meta review नहीं | Pay-per-call prepaid: $0.001 (V1), $0.002 (V2 और V3 shortcode tools), $0.008 (V3 main) | $10.00 (V1 Reels) या $20.00 (V2 Stories) | Public read-only data; pagination tokens और string ID parsing client code संभालता है |
अगर आप profiles, posts और comments के सभी 93 endpoints का नक्शा देखना चाहते हैं, तो Instagram API 93-endpoint गाइड या हमारा Apify Instagram Scraper बनाम API Hop कॉस्ट तुलना लेख देखें। यह ट्यूटोरियल Stories, Highlights, Reels और Shortcode Conversion के लिए production Python कोड पर फोकस करता है।
शुरू करने से पहले जरूरी चीजें
पहली request भेजने से पहले तीन चीजें सेटअप कर लें:
- API Hop Key: API Hop Pricing page पर रजिस्टर करके Bearer key बनाएं। Prepaid balance $10 से शुरू होता है (कभी expire नहीं होता), इसके लिए किसी US credit card या business KYC की जरूरत नहीं है, और यह USDT/USDC crypto, Brazil PIX व Indonesia QRIS/GoPay/DANA सपोर्ट करता है।
- Local Runtime: Python 3.9+ और
requestsपैकेज, या सामान्यcurl। - Contract Bookmarks: सटीक parameter rules के लिए Instagram API Overview और Instagram Endpoint Reference खुले रखें।
pip install -U requests
export APIHOP_API_KEY="sk-your-apihop-key"
क्विकस्टार्ट: 2 मिनट में User Stories और Shortcode निकालें
Instagram के सभी routes Authorization: Bearer headers के साथ GET query strings इस्तेमाल करते हैं। V2 ($0.002/req) के जरिए username से active 24-hour Stories लाएं:
curl --get "https://api.apihop.ai/v1/instagram/v2/users/stories" \
-H "Authorization: Bearer $APIHOP_API_KEY" \
--data-urlencode "username=instagram"
जब आपके पास सिर्फ shared Reel या post URL हो, तो Python में V3 URL utility ($0.002/req) से उसका shortcode निकालें:
import os
import requests
resp = requests.get(
"https://api.apihop.ai/v1/instagram/v3/shortcodes/from-url",
headers={"Authorization": f"Bearer {os.environ['APIHOP_API_KEY']}"},
params={"url": "https://www.instagram.com/reel/DUlObENDmJD/"},
timeout=60,
)
resp.raise_for_status()
print("code:", resp.json().get("code"), "data:", resp.json().get("data"))
अपेक्षित output: code: 200 data: {'shortcode': 'DUlObENDmJD'} (API upstream के code/data envelope को ज्यों का त्यों रखता है)।
स्टेप-बाय-स्टेप गाइड: Stories, Highlights, Reels और Shortcode Endpoints चुनना
इस workflow में शामिल 16 endpoints की सूची नीचे दी गई है (pricing और parameter rules 2026-11-30 को verified):
| मॉड्यूल | Endpoint Path | कीमत / सफल कॉल | जरूरी / anyOf Fields | Pagination और Optional Params |
|---|---|---|---|---|
| User Stories | GET /v1/instagram/v2/users/stories | $0.002 | username या user_id (कम से कम एक) | कोई नहीं (24h active tray देता है) |
| User Stories (V3) | GET /v1/instagram/v3/users/stories | $0.008 | username | कोई नहीं |
| Highlights List | GET /v1/instagram/v2/users/highlights | $0.002 | username या user_id (कम से कम एक) | कोई नहीं |
| Highlight Stories | GET /v1/instagram/v2/highlights/stories | $0.002 | highlight_id (जैसे 17895069621772257) | कोई नहीं |
| Highlight Stories (V3) | GET /v1/instagram/v3/highlights/stories | $0.008 | highlight_id (जैसे highlight:18064916456320419) | reel_ids, first, last |
| User Reels (Low-Cost) | GET /v1/instagram/v1/users/reels | $0.001 | user_id | count (1–50), max_id |
| User Reels (Username) | GET /v1/instagram/v2/users/reels | $0.002 | username या user_id (कम से कम एक) | pagination_token |
| Search Reels | GET /v1/instagram/v2/search/reels | $0.002 | keyword | pagination_token |
| Recommended Reels | GET /v1/instagram/v3/reels/recommended | $0.008 | कोई नहीं | first (1–50), after |
| URL to Shortcode | GET /v1/instagram/v3/shortcodes/from-url | $0.002 | url | कोई नहीं |
| Shortcode to Media ID | GET /v1/instagram/v1/media-ids (V2/V3 $0.002) | $0.001 | shortcode | कोई नहीं |
| Media ID to Shortcode | GET /v1/instagram/v1/shortcodes (V2/V3 $0.002) | $0.001 | media_id (string) | कोई नहीं |
स्टेप 1: V2 से Active Stories और Archived Highlights निकालें
Stories 24 घंटे बाद गायब हो जाती हैं, जबकि pinned Story collections Highlights में उपलब्ध रहती हैं। पहले users/highlights कॉल करके highlight_id values लें, फिर हर Highlight के अंदर के items निकालें:
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['APIHOP_API_KEY']}"}
base = "https://api.apihop.ai"
# 1. Fetch active 24h Stories ($0.002)
stories_resp = requests.get(
f"{base}/v1/instagram/v2/users/stories",
headers=headers,
params={"username": "instagram"},
timeout=60,
)
stories_resp.raise_for_status()
stories_json = stories_resp.json()
assert stories_json.get("code") == 200 and stories_json.get("data") is not None
# 2. Fetch profile Highlights directory ($0.002)
hl_resp = requests.get(
f"{base}/v1/instagram/v2/users/highlights",
headers=headers,
params={"username": "instagram"},
timeout=60,
)
hl_resp.raise_for_status()
hl_json = hl_resp.json()
print("Stories ok, highlights keys:", list((hl_json.get("data") or {}).keys()))
अपेक्षित output: Stories ok, highlights keys: [...]। मिले हुए किसी भी Highlight ID को GET /v1/instagram/v2/highlights/stories?highlight_id=... में पास करें। V2 में plain numeric string (17895069621772257) चलता है जबकि V3 अक्सर highlight: prefix मांगता है, इसलिए दोनों versions के format न मिलाएं।
स्टेप 2: Creator Reels फेच करें और Keyword से Reels सर्च करें
जब आपके पास user_id मौजूद हो, तो V1 GET /v1/instagram/v1/users/reels मात्र $0.001 में count=50 Reels तक लौटाता है। Topic के हिसाब से trending clips खोजने के लिए V2 GET /v1/instagram/v2/search/reels ($0.002/req) कॉल करें:
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['APIHOP_API_KEY']}"}
resp = requests.get(
"https://api.apihop.ai/v1/instagram/v2/search/reels",
headers=headers,
params={"keyword": "ai tools"},
timeout=60,
)
resp.raise_for_status()
body = resp.json()
assert body.get("code") == 200 and body.get("data") is not None, f"Upstream error: {body}"
print("Reels search keys:", list(body["data"].keys()), "req:", resp.headers.get("X-Request-Id"))
अपेक्षित output: Reels search keys: [...] req: ...। अगले V2 पेज के लिए response का pagination_token पास करें, या V1 /v1/instagram/v1/users/reels में paginate करते समय max_id भेजें।
स्टेप 3: URLs, Shortcodes और 19-Digit Media IDs के बीच Convert करें
आगे के कई endpoints पूरे share URL के बजाय सिर्फ shortcode या 19-digit media_id लेते हैं। /v3/shortcodes/from-url ($0.002) से shortcode निकालें और फिर V1 /v1/media-ids ($0.001) से उसका numeric string ID प्राप्त करें:
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['APIHOP_API_KEY']}"}
sc = "DRhvwVLAHAG"
mid_resp = requests.get(
"https://api.apihop.ai/v1/instagram/v1/media-ids",
headers=headers,
params={"shortcode": sc},
timeout=60,
)
mid_resp.raise_for_status()
mid_data = mid_resp.json().get("data") or {}
media_id = str(mid_data.get("media_id") or mid_data.get("id") or "")
print("shortcode -> media_id:", media_id)
अपेक्षित output: shortcode -> media_id: 3774507992167247878 (precision loss से बचने के लिए इसे हमेशा string ही रखें)। वापस convert करने के लिए string media_id के साथ $0.001 में GET /v1/instagram/v1/shortcodes कॉल करें।
पूरा वर्किंग उदाहरण: Stories, Highlights और Paginated Reels Collector
यह script किसी creator का user_id resolve करती है, active 24-hour Stories लाती है, पहला Highlight album फेच करती है, V1 max_id से Reels के दो पेज paginate करती है, 429/5xx retries व HTTP 200 business-code checks संभालती है, और कुल अनुमानित लागत प्रिंट करती है:
import json
import os
import time
import requests
API_KEY = os.environ["APIHOP_API_KEY"]
BASE_URL = "https://api.apihop.ai"
def ig_get(path: str, params: dict, max_retries: int = 3):
for attempt in range(max_retries):
resp = requests.get(
f"{BASE_URL}{path}",
headers={"Authorization": f"Bearer {API_KEY}"},
params=params,
timeout=60,
)
req_id = resp.headers.get("X-Request-Id")
if resp.status_code == 200:
payload = resp.json()
if payload.get("code") == 200 and payload.get("data") is not None:
return payload["data"], req_id
raise RuntimeError(f"Business error {path}: code={payload.get('code')} req={req_id}")
if resp.status_code in (429, 500, 502, 503, 504) and attempt < max_retries - 1:
wait = 2 ** (attempt + 1)
print(f"[Retry {attempt + 1}] HTTP {resp.status_code}, sleep {wait}s (req={req_id})")
time.sleep(wait)
continue
resp.raise_for_status()
raise RuntimeError("Max retries exceeded")
def collect_creator_video_assets(username: str, reels_pages: int = 2, out_path: str = "ig_story_reels.json"):
cost = 0.0
result = {"username": username, "stories": [], "highlight_stories": [], "reels": []}
# 1. Resolve user_id (V1: $0.001)
prof, _ = ig_get("/v1/instagram/v1/users/profile/by-username", {"username": username})
cost += 0.001
user_obj = prof.get("user") or prof
user_id = str(user_obj.get("id") or user_obj.get("pk") or "")
if not user_id:
raise ValueError(f"Missing user_id for @{username}")
# 2. Fetch active 24h Stories (V2: $0.002)
stories_data, _ = ig_get("/v1/instagram/v2/users/stories", {"user_id": user_id})
cost += 0.002
result["stories"] = stories_data.get("items") or stories_data.get("tray") or []
# 3. Fetch Highlights list and first Highlight album (V2: $0.002 + $0.002)
hl_list, _ = ig_get("/v1/instagram/v2/users/highlights", {"user_id": user_id})
cost += 0.002
tray = hl_list.get("tray") or hl_list.get("items") or []
if tray:
first_hl_id = str(tray[0].get("id") or "").replace("highlight:", "")
if first_hl_id:
hl_detail, _ = ig_get("/v1/instagram/v2/highlights/stories", {"highlight_id": first_hl_id})
cost += 0.002
result["highlight_stories"] = hl_detail.get("items") or []
# 4. Paginate Reels via V1 (V1: $0.001 / page)
cursor = None
for _ in range(reels_pages):
query = {"user_id": user_id, "count": 12}
if cursor:
query["max_id"] = str(cursor)
reels_data, _ = ig_get("/v1/instagram/v1/users/reels", query)
cost += 0.001
items = reels_data.get("items") or []
if not items:
break
result["reels"].extend(items)
cursor = reels_data.get("next_max_id") or reels_data.get("max_id")
if not cursor or reels_data.get("more_available") is False:
break
time.sleep(0.5)
with open(out_path, "w", encoding="utf-8") as f:
json.dump(result, f, ensure_ascii=False, indent=2)
print(
f"Done @{username}: stories={len(result['stories'])}, "
f"highlights={len(result['highlight_stories'])}, reels={len(result['reels'])}, "
f"est_cost=${cost:.4f}"
)
if __name__ == "__main__":
collect_creator_video_assets("instagram", reels_pages=2)
अपेक्षित output: Done @instagram: stories=..., highlights=..., reels=..., est_cost=$0.0090 (एक V1 profile lookup, तीन V2 Story/Highlight calls और दो V1 Reels pages एक सेंट से भी कम में)।
Error Handling और Troubleshooting
Support diagnostics के लिए हर response में X-Request-Id header आता है:
| Status / लक्षण | Platform Code और आम वजह | सुझाव |
|---|---|---|
400 | 10000 / 10001: अनजान field, duplicate param, या username/user_id गायब | केवल Instagram Endpoint Reference में दिए fields भेजें |
401 | 20000: Authorization: Bearer header गायब या गलत | जांचें कि APIHOP_API_KEY में extra space न हो और key active हो |
402 | 40000: Prepaid credit balance कम है | API Hop Pricing page पर टॉप-अप करें |
403 | 20001: Gateway बंद है या key को permission नहीं है | अपने console में API key scopes चेक करें |
429 | 40001 / 40002: Rate limit या concurrency ceiling पूरी हो गई | Requests के बीच कम से कम 0.5s का गैप और 2s / 4s backoff लगाएं |
5xx / 60s timeout | 50000–50003: Upstream error या timeout (credit hold रिलीज हो जाता है) | अधिकतम 2 बार retry करें और X-Request-Id लॉग करें |
HTTP 200 पर code != 200 | Upstream business error (private account, expired Story, गलत shortcode) | Parsing से पहले payload.get("code") == 200 जांचें |
आम समस्याएं और जरूरी सावधानियां
- JavaScript में
media_idकोNumberमानने पर precision loss: 19-digit Instagrammedia_idजैसे3850699893338385742की वैल्यूNumber.MAX_SAFE_INTEGER(9007199254740991) से बड़ी होती है। सामान्यJSON.parse()आखिरी अंकों को round कर देता है जिससे/shortcodeslookup फेल हो जाता है। सभी IDs और cursors को string ही रखें। - सभी V3 endpoints को $0.008 समझ बैठना: मुख्य V3 endpoints का रेट
$0.008/reqहै, लेकिन तीनों shortcode converters (/v3/media-ids,/v3/shortcodesऔर/v3/shortcodes/from-url) सिर्फ $0.002/req लेते हैं। सीधेshortcodeयाmedia_idबदलने के लिए V1 और भी सस्ता यानी $0.001/req है। - V2 और V3 के
highlight_idformat आपस में मिलाना: V2/v2/highlights/storiesमें सिर्फ numeric ID (17895069621772257) चलता है, जबकि V3/v3/highlights/storiesआमतौर परhighlight:18064916456320419लेता है। Version बदलते समय prefix हटाना या जोड़ना न भूलें। - V1 या V3 को
pagination_tokenभेजना: V1 Reels मेंmax_id, V2 मेंpagination_tokenऔर V3 मेंafter/beforeचलता है। गलत cursor name भेजने पर400validation error आता है। - बिना active Stories वाले accounts को बार-बार poll करना: जब किसी creator की कोई 24-hour Story live न हो, तब भी valid empty response पर 1 request का बिल बनता है। Tight loop चलाने के बजाय posting schedule के हिसाब से polling सेट करें।
लागत का अनुमान और Workload हिसाब
API Hop की डिफॉल्ट pricing ($0.001 V1, $0.002 V2 और V3 shortcode tools, $0.008 V3 main) के आधार पर:
$$\text{Total Cost} = (N_{V1} \times $0.001) + (N_{V2 + V3\text{ Shortcode}} \times $0.002) + (N_{V3\text{ Main}} \times $0.008)$$
| Workload परिदृश्य | Request Mix और Volume | API Hop लागत | Apify तुलना (~$0.49–$2.00+/1K + $19/mo) |
|---|---|---|---|
| इस ट्यूटोरियल की पूरी script चलाना | 3 V1 calls + 3 V2 calls | $0.009 (1 सेंट से कम) | Platform plan और actor cold-start इंतजार जरूरी |
| 100 creators की रोजाना 24h Stories चेक (मासिक) | 100 × 30 = 3,000 V2 Stories calls | $6.00 / महीना | Result fees के बिना ही Starter plan $19/mo से शुरू |
| 500 creators × 50 Reels (25,000 वीडियो) | 500 V1 profile IDs + 500 V1 Reels pages | $1.00 | 25K items के लिए ~$12.25–$50.00 और मासिक प्लान |
| 10,000 share URLs से Shortcode व Media ID | 10,000 V3 from-url ($0.002) + 10,000 V1 media-ids ($0.001) | $30.00 | आम scrapers में हल्के ID-swap endpoints कम मिलते हैं |
API Hop Pricing page पर $10 का minimum top-up कभी expire नहीं होता और कोई मासिक बंधन नहीं रखता। यही API key API Hop Data API catalog में YouTube, Threads और TikTok endpoints भी अनलॉक करती है, साथ ही आप Reels transcripts को summarize करने के लिए Claude, GPT और DeepSeek मॉडल्स भी चला सकते हैं।
आगे किन बातों पर ध्यान रखें
- Account-specific pricing overrides: Account स्तर पर तय खास रेट catalog defaults से ऊपर माने जाते हैं, इसलिए बड़े पैमाने वाली टीमें console में अपनी वास्तविक credit कटौती चेक करें।
- Upstream media-array संरचना में बदलाव: V2 और V3 Story objects में
trayऔरitemsके अंदर nested video rendition keys कभी-कभी बदलती रहती हैं। CDN media URLs निकालते समय defensive.get()lookup ही इस्तेमाल करें।
अक्सर पूछे जाने वाले सवाल
क्या Instagram Story API मुफ्त है?
Meta का official Instagram Graph API मंजूर Business या Creator accounts के लिए मुफ्त है, लेकिन इसमें linked Facebook Page व Meta App Review जरूरी है और यह केवल आपके या authorized client accounts तक सीमित रहता है। यह किसी भी public Story या competitor Reels को नहीं खींच सकता। API Hop पर कोई स्थायी free tier नहीं है, लेकिन मासिक सब्सक्रिप्शन शुल्क शून्य है: API Hop Pricing page पर $10 के minimum deposit से 5,000 V2 Stories requests चलती हैं और इस पूरे ट्यूटोरियल का खर्च $0.009 है।
V1, V2 और V3 में Instagram Reels API की pricing कैसे काम करती है?
API Hop प्रति पेज items की संख्या के बजाय प्रति सफल request के हिसाब से बिल करता है: V1 GET /v1/instagram/v1/users/reels की कीमत $0.001 (प्रति पेज 50 items तक), V2 /v2/users/reels और /v2/search/reels की $0.002, और V3 /v3/users/reels व /v3/reels/recommended की $0.008 है। एक बार user_id निकालकर V1 से pagination करने पर प्रति-पेज खर्च 87.5% कम हो जाता है।
Shortcode Converter क्या करता है और V3 की कीमत कितनी है?
Instagram links में DRhvwVLAHAG जैसे alphanumeric shortcodes होते हैं, जबकि V1 media endpoints को 19-digit media_id string चाहिए होती है। आप /v3/shortcodes/from-url से पूरे URL से shortcode निकाल सकते हैं और /v1/media-ids व /v1/shortcodes से दोनों तरफ बदल सकते हैं। V3 prefix के बावजूद ये तीनों utilities सिर्फ $0.002/req चार्ज करती हैं, और V1 converters $0.001/req के हैं।
username पास करने पर V1 users/reels 400 error क्यों देता है?
V1 /v1/instagram/v1/users/reels केवल numeric-string user_id स्वीकार करता है और username को अस्वीकार कर देता है। सीधे username या user_id से query करने के लिए V2 GET /v1/instagram/v2/users/reels ($0.002/req) पर स्विच करें।
बिना US credit card के कौन-से payment methods काम करते हैं?
API Hop बिना US credit card या business entity verification के ग्लोबल self-serve prepaid top-ups सपोर्ट करता है। आप API Hop Pricing page पर USDT/USDC crypto, Brazil PIX, या Indonesia QRIS / GoPay / DANA से भुगतान कर सकते हैं और आपका balance कभी expire नहीं होता।
सत्यापन नोट: Instagram Stories, Highlights, Reels और Shortcode Converter के सभी 16 endpoint paths, parameter rules और V1/V2/V3 दरें 2026-11-30 को लाइव API Hop reference docs और सार्वजनिक दस्तावेजों से मिलाई गई हैं (console में account-level दरें प्राथमिकता रखती हैं)।