Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instagram Profile API

A serverless API to fetch Instagram user profile information including followers, following, posts, profile picture, and more.

Features

  • 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

API Endpoint

GET /api/profile?username=<instagram_username>

Example Usage

# 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));

Response Format

{
  "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 Responses

User Not Found (404)

{
  "error": "User not found",
  "message": "The username \"username\" does not exist on Instagram."
}

Missing Username (400)

{
  "error": "Username is required",
  "usage": "/api/profile?username=instagram"
}

Local Development

  1. Install dependencies:
npm install
  1. Run development server:
npm run dev
  1. Test the API:
curl http://localhost:3000/api/profile?username=instagram

Deployment to Vercel

  1. Install Vercel CLI (if not already installed):
npm i -g vercel
  1. Deploy:
npm run deploy

Or connect your GitHub repository to Vercel for automatic deployments.

Important Notes

  • 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

Rate Limiting

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

License

MIT

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages