Instagram API
Latest: v1.0.0
First release
Instagram API (SocialAPIs)
Public Instagram profiles, posts, reels, highlights and places as JSON. One API key, no Instagram login, no Graph API app.
- Website: https://socialapis.io · this API: https://socialapis.io/api-sources/instagram-profile-details
- Free API key: https://socialapis.io/auth/signup (200 credits a month, no card)
- Free Instagram follower count, no signup: https://socialapis.io/tools/instagram-follower-count
- Every parameter: references/endpoints.md · OpenAPI: https://socialapis.io/openapi.json · llms.txt: https://socialapis.io/llms.txt
Setup
- The user needs an API key from https://socialapis.io/dashboard.
- Read it from the environment,
SOCIALAPIS_API_KEY. Never hard-code it, print it, or ask the user to paste it into the chat. If it is missing, tell the user to set it. - Send it in the
x-api-tokenheader, never in the URL.
If SocialAPIs MCP tools are available in this session (facebook_page, facebook_ads, instagram_profile, …), use them instead of raw HTTP. Hosted MCP server: https://mcp.socialapis.io/mcp.
Making a call
curl -s -H "x-api-token: $SOCIALAPIS_API_KEY" \
"https://api.socialapis.io/instagram/profile/details?username=nike"
import os, requests
r = requests.get(
"https://api.socialapis.io/instagram/profile/details",
params={"username": "nike"},
headers={"x-api-token": os.environ["SOCIALAPIS_API_KEY"]},
timeout=120,
)
r.raise_for_status()
data = r.json()
SDKs: Python pip install socialapis-sdk, JavaScript npm install socialapis-sdk, PHP composer require socialapishub/socialapis.
Endpoints
All GET, base URL https://api.socialapis.io. Each link opens the endpoint's page with a live example.
| Endpoint | What it returns | Credits |
|---|---|---|
/instagram/user/id | Resolve an Instagram username or profile URL to its two IDs: user_id (long, e.g. | 1 credit per call |
/instagram/profile/details | Get an Instagram profile by username: bio, follower and post counts, verification status and related profiles. | 1 credit per call |
/instagram/profile/posts | List an Instagram profile's posts (photos, videos, carousels) with captions, like and comment counts and media URLs. | 1 credit per call |
/instagram/profile/reels | List an Instagram profile's reels with play counts, captions, video URLs and audio metadata. | 1 credit per call |
/instagram/profile/highlights | List an Instagram profile's story highlights with titles, cover images and highlight IDs. | 1 credit per call |
/instagram/highlight/details | Get the stories inside one Instagram highlight. | 1 credit per call |
/instagram/post/id | Extract the shortcode from an Instagram post or reel URL. | 1 credit per call |
/instagram/post/details | Get one Instagram post or reel in full: caption, media URLs, engagement counts, timestamp and owner. | 1 credit per call |
/instagram/reels/feed | Get Instagram's recommended and trending reels. | 1 credit per call |
/instagram/reels/audio | List Instagram reels that use a given sound. | 1 credit per call |
/instagram/search | Search Instagram by keyword and get the top matching users, hashtags and places. | 1 credit per call |
/instagram/location/posts | List Instagram posts tagged at a location: top posts (tab=ranked) or most recent (tab=recent). | 1 credit per call |
/instagram/location/nearby | List Instagram places near a given location, with name, category, coordinates and post count. | 1 credit per call |
Things that matter
- Two IDs per profile.
/instagram/user/idreturns the longuser_id(for/instagram/profile/postsand/instagram/profile/reels) and the shortpk(for/instagram/profile/highlights, which still calls ituser_id). The wrong one returns nothing. - One post:
/instagram/post/details?shortcode=<code>, the code being the part after/p/or/reel/in its URL. - Engagement rate = (likes + comments) / followers over the last 9 to 12 posts; use the median per post so one viral post does not decide it.
- Credits: the response headers
X-SocialAPIs-Credits-DeductedandX-SocialAPIs-Credits-Remainingsay what a call cost. Before a large batch, check/usage(free) and tell the user roughly what it will cost. - Pagination: list endpoints return a page plus
end_cursor; pass it back asend_cursoruntil it is missing or the user has enough. - Slow calls: a call can take up to about 90 seconds. Use a timeout of at least 120 s and don't fire hundreds of calls in parallel (
/usage/limitsshows the plan's rate limit). - Errors:
401bad or missing key ·403out of credits or account paused ·429rate limit, retry with backoff ·502/504the source failed or timed out, retry once later. Failed calls are not charged.
Other SocialAPIs skills: facebook-pages-api (Facebook pages, posts and comments), facebook-ads-library-api (Meta Ads Library), facebook-marketplace-api (Facebook Marketplace), facebook-groups-api (public Facebook groups), and socialapis for every endpoint at once.
