A serverless API to fetch Instagram user profile information including followers, following, posts, profile picture, and more.
- Get Instagram user profile data by username
- Returns followers count, following count, posts count
- Profile picture URL (standard and HD)
- Biography and full name
- Verification status
- Privacy status
- Business account information
GET /api/profile?username=<instagram_username>
# Using curl
curl https://your-app.vercel.app/api/profile?username=instagram
# Using fetch in JavaScript
fetch('https://your-app.vercel.app/api/profile?username=instagram')
.then(res => res.json())
.then(data => console.log(data));{
"success": true,
"data": {
"username": "instagram",
"full_name": "Instagram",
"biography": "Bringing you closer to the people and things you love.",
"profile_pic_url": "https://...",
"profile_pic_url_hd": "https://...",
"follower_count": 123456789,
"following_count": 123,
"post_count": 1234,
"is_verified": true,
"is_private": false,
"is_business_account": false,
"external_url": "https://...",
"category_name": null,
"business_category_name": null,
"id": "123456789"
}
}{
"error": "User not found",
"message": "The username \"username\" does not exist on Instagram."
}{
"error": "Username is required",
"usage": "/api/profile?username=instagram"
}- Install dependencies:
npm install- Run development server:
npm run dev- Test the API:
curl http://localhost:3000/api/profile?username=instagram- Install Vercel CLI (if not already installed):
npm i -g vercel- Deploy:
npm run deployOr connect your GitHub repository to Vercel for automatic deployments.
- Instagram may rate limit requests if too many are made in a short time
- Private profiles will return limited information
- This API uses web scraping, which may break if Instagram changes their HTML structure
- For production use, consider implementing rate limiting and caching
- Always respect Instagram's Terms of Service
Consider implementing rate limiting in production:
- Use Vercel's built-in rate limiting
- Implement caching (e.g., Redis) to reduce requests
- Add request throttling per IP address
MIT