Best Way to Get Instagram User Data Programmatically
Best Way to Get Instagram User Data Programmatically
Whether you're building an analytics dashboard, a marketing tool, or a research project — you need reliable access to Instagram user data. Here's the most effective approach.
What Data Is Available
For any public Instagram account, you can retrieve:
- Profile info — username, full name, bio, profile picture, verification status
- Metrics — follower count, following count, media count
- Business data — category, public email, phone number, address
- Content — posts, reels, stories, highlights with media URLs
- Engagement — likes, comments, shares per post
- Network — followers list, following list
The Recommended Approach
Use a dedicated REST API — it's the fastest, most reliable, and most cost-effective method.
Getting a User Profile
import requests
response = requests.get(
'https://api.hikerapi.com/v1/user/by/username',
params={'username': 'nike'},
headers={'x-access-key': 'your_api_key'}
)
user = response.json()
print(f"Name: {user['full_name']}")
print(f"Bio: {user['biography']}")
print(f"Followers: {user['follower_count']:,}")
print(f"Posts: {user['media_count']:,}")
print(f"Verified: {user['is_verified']}")
# Business accounts include contact info
if user.get('public_email'):
print(f"Email: {user['public_email']}")
if user.get('public_phone_number'):
print(f"Phone: {user['public_phone_number']}")
Getting User Posts
posts = requests.get(
'https://api.hikerapi.com/v1/user/medias',
params={'user_id': user['pk'], 'amount': 12},
headers={'x-access-key': 'your_api_key'}
).json()
for post in posts:
print(f"Type: {post['media_type']}")
print(f"Likes: {post['like_count']}")
print(f"Comments: {post['comment_count']}")
print(f"Caption: {post['caption']['text'][:100]}...")
print('---')
Using the Python SDK
For an even simpler experience, install our official Python package:
pip install hikerapi
from hikerapi import Client
client = Client('your_api_key')
# One-line profile lookup
user = client.user_by_username('nike')
print(user.follower_count)
# Get posts
medias = client.user_medias(user.pk, amount=12)
for media in medias:
print(media.like_count)
Why This Approach Works Best
| Factor | DIY Scraping | Graph API | HikerAPI |
|---|---|---|---|
| Setup time | Days-weeks | Hours | Minutes |
| Any public account | Yes* | No | Yes |
| Maintenance | Constant | Low | None |
| Rate limits | Instagram limits | Strict | None |
| Cost (10K requests) | $50-200 (proxies) | Free | $6 |
| Reliability | 60-80% | 99% | 99%+ |
*Subject to blocks
Available Endpoints
HikerAPI offers 100+ endpoints organized by category:
/v1/user— 25 endpoints for profile and account data/v1/media— 20 endpoints for posts, reels, and content/gql— 15 GraphQL endpoints for flexible queries/v1/hashtag— 10 endpoints for hashtag data/v1/location— 7 endpoints for location-based data/v1/story— 6 endpoints for stories and highlights/v1/search— 4 endpoints for search
Full interactive documentation: api.hikerapi.com/docs
Getting Started
- Create a free account — 100 requests included
- Copy your API key from the Tokens page
- Make your first API call
No credit card required. Pay-as-you-go from $0.0006 per request. Funds never expire.