- π Overview
- β¨ Key Features
- π‘οΈ Security & Rate Limiting
- π Live Endpoints Directory
- π Detailed API Documentation
- π» Tech Stack
- βοΈ Setup & Deployment
- π License
The Bhaigram Backend API is a next-generation wrapper around instagrapi, optimized specifically for serverless deployment on Vercel.
Whether you are building a custom Telegram Bot, a full-stack Web Application, or a social media analytics dashboard, this API handles all the heavy lifting. It fetches HD media, extracts deep profile metadata, and grabs original Instagram audio tracks instantly.
Note: This API is explicitly designed as a READ-ONLY service. All endpoints that perform write operations (like commenting or liking) have been permanently disabled to ensure 100% safety of the underlying Instagram session account from bans or restrictions.
- π Serverless Ready: Works seamlessly on Vercel's Python 3.12 serverless functions.
- π‘οΈ Built-in Rate Limiting: Prevents DoS attacks and account bans with a hard 30 req/min limit per IP.
- π΅ Direct Audio Extraction: Grabs original
.mp4audio containers for any Reel or Music search. - π₯ HD Media Downloads: Direct CDN links to watermark-free Reels, Posts, and Carousels.
- π Deep Search: Real-time search for Instagram Users, Hashtags, and Audio Tracks.
- π€ Advanced Profile Scraping: Returns WhatsApp numbers, pronouns, locations, and Account Types.
To protect the Instagram account configured in the IG_SESSION_ID environment variable, this API employs a strict security policy:
- Read-Only Enforced: No endpoint exists to alter Instagram state.
- Global Rate Limiter: A custom FastAPI middleware tracks requests via
x-forwarded-for(Vercel IP). - Threshold: If an IP exceeds 30 requests per 60 seconds, the API blocks them with a
HTTP 429 Too Many Requestsstatus, preserving the Instagram account's health.
All endpoints are hosted at the root domain (/).
| Feature Category | Endpoint Path | Method | Description |
|---|---|---|---|
| System | /health |
GET |
API Health Check |
| Downloads | /download/media |
GET |
Get download URLs and metadata for any IG Link. |
| Profile | /profile/info |
GET |
Get advanced info (Followers, Contact, Location). |
| Profile | /profile/stories |
GET |
Download currently active stories for a user. |
| Profile | /profile/highlights |
GET |
Fetch highlight folders for a user. |
| Profile | /profile/posts |
GET |
Fetch the latest posts/reels of a user in bulk. |
| Network | /profile/followers |
GET |
Fetch followers list for a user. |
| Network | /profile/following |
GET |
Fetch following list for a user. |
| Search | /search/users |
GET |
Search for accounts globally. |
| Search | /search/hashtag |
GET |
Fetch top trending media for a hashtag. |
| Search | /search/music |
GET |
Search IG Music Library for Audio Download Links. |
Extracts metadata, view counts, likes, music information, and the direct HD .mp4 URL for any Instagram Reel.
Endpoint: GET /download/media
Parameters:
url(string, required): The URL of the Instagram Reel or Post.
Example Request:
curl -X GET "https://insta.yukiapi.site/download/media?url=https://www.instagram.com/reel/DbGNF90Rx9J/"Example Response:
{
"success": true,
"data": {
"shortcode": "DbGNF90Rx9J",
"play_count": 6157648,
"video_duration": 22.23,
"music_info": {
"title": "Chokra Jawaan",
"artist": "Amit Trivedi, Vishal Dadlani",
"audio_url": "https://scontent-iad6-1...mp4?strext=1"
},
"video_url": "https://scontent-iad3-1...mp4",
"thumbnail_url": "https://scontent-iad6-1...jpg"
}
}Fetches deep account information, including business category, linked WhatsApp, and live active stories.
Endpoint: GET /profile/info
Parameters:
query(string, required): The Username or Profile URL.
Example Request:
curl -X GET "https://insta.yukiapi.site/profile/info?query=zuck"Example Response:
{
"success": true,
"data": {
"username": "zuck",
"full_name": "Mark Zuckerberg",
"follower_count": 16939494,
"whatsapp_number": "",
"account_type": 3,
"has_active_story": false,
"active_stories": [],
"location_data": {
"city_name": "",
"address_street": ""
},
"profile_pic_url_hd": "https://scontent-iad3-1...jpg"
}
}Endpoint: GET /profile/stories
Fetches all currently active 24h stories for a user, complete with direct MP4/JPG links.
Endpoint: GET /profile/highlights
Fetches all permanent highlight folders (titles and cover images).
Access Instagram's internal music library. Enter any song name and get back the official audio track download URL.
Endpoint: GET /search/music
Parameters:
query(string, required): The song name or artist.
Example Request:
curl -X GET "https://insta.yukiapi.site/search/music?query=barbad"Example Response:
{
"success": true,
"data": [
{
"title": "Tum Ho Toh (Movie: Saiyaara)",
"artist": "Vishal Mishra",
"audio_url": "https://scontent-iad3-1...mp4?strext=1",
"duration_ms": 318217,
"cover_url": "https://scontent-iad3-1...jpg"
}
]
}Quickly fetch the list of users someone is following or followed by.
Endpoints:
GET /profile/followers?username=user&amount=20GET /profile/following?username=user&amount=20
- Language: Python 3.12
- Framework: FastAPI (Uvicorn)
- Instagram Core: Instagrapi (Headless Client)
- Database: MongoDB (PyMongo)
- Hosting: Vercel Serverless Functions
# Clone the repository
git clone https://github.com/SUDEEPBOTS/Bhaigram-Backend-API.git
cd Bhaigram-Backend-API
# Install Dependencies using UV or PIP
pip install -r requirements.txt
# Set Environment Variables
export IG_SESSION_ID="your_instagram_sessionid_cookie_here"
# Run the API
uvicorn api.index:app --reload --port 8000This project is configured out-of-the-box for Vercel.
- Link the repository to Vercel.
- In Vercel Environment Variables, set
IG_SESSION_ID. - Vercel will automatically build the
api/index.pyusing Python 3.12.
This project is licensed under the MIT License. Use at your own risk. This is an unofficial API wrapper and is not affiliated with, endorsed by, or sponsored by Instagram or Meta Platforms, Inc.
# trigger redeploy