How to Analyze an Instagram Influencer with an API
Whether you run an influencer marketing agency, vet creators for brand deals, or build a media-monitoring product, the same question comes up again and again: is this account actually worth working with? Follower count alone doesn't answer it. You need engagement rate, posting consistency, what content actually performs, and whether the comments under each post read like a real audience or a bot farm.
This guide shows how to assemble a complete influencer profile programmatically with the Instagram Cheapest API on RapidAPI. We'll combine four endpoints — profile, media, Reels, and comments — into a single analysis in Python. Everything runs on real-time, uncached public data at as little as $0.10 per 1,000 requests, so profiling a creator costs a fraction of a cent.
The four signals that matter
A useful influencer analysis blends four data sources, each backed by one endpoint:
- Profile snapshot — follower count, following count, post count, bio, verified status (
user/{username}) - Recent posts — likes and comments per post, captions, post type, timestamps (
user_media) - Reels performance — video plays and engagement, since Reels often reach far beyond the follower base (
user_reels) - Comment quality — who is actually commenting, and what they say (
media_comments)
Step 1: Resolve the profile
Start with the username. The user/{username} endpoint is the only path-param endpoint in the API and returns the profile snapshot, including the numeric user_id you'll need for every other call.
import requests
API_HOST = "instagram-cheapest.p.rapidapi.com"
BASE = f"https://{API_HOST}/api/v1/instagram"
API_KEY = "YOUR_RAPIDAPI_KEY"
HEADERS = {"x-rapidapi-host": API_HOST, "x-rapidapi-key": API_KEY}
def get_profile(username):
r = requests.get(f"{BASE}/user/{username}", headers=HEADERS)
r.raise_for_status()
return r.json()
profile = get_profile("nasa")
print(profile)
The response is raw Instagram JSON, so inspect it once to learn the exact field names (they aren't fixed by this API). You're looking for the user ID, follower count, and post count — the denominators for the metrics below.
Step 2: Pull recent posts and compute engagement rate
Engagement rate is the single most-cited influencer metric. The standard formula is:
engagement_rate = (avg_likes + avg_comments) / followers * 100
Fetch a page of recent posts with user_media (it returns ~12 items per page and echoes a top-level next_max_id for pagination), then average the engagement across them:
def get_media(user_id, next_max_id=None):
params = {"user_id": user_id}
if next_max_id:
params["next_max_id"] = next_max_id
r = requests.get(f"{BASE}/user_media", headers=HEADERS, params=params)
r.raise_for_status()
return r.json()
def engagement_rate(user_id, followers, pages=2):
likes, comments, posts = 0, 0, 0
next_max_id = None
for _ in range(pages):
data = get_media(user_id, next_max_id)
items = data.get("items", []) # confirm the key from the raw JSON
for post in items:
likes += post.get("like_count", 0)
comments += post.get("comment_count", 0)
posts += 1
next_max_id = data.get("next_max_id")
if not data.get("more_available"):
break
if posts == 0 or followers == 0:
return None
return (likes / posts + comments / posts) / followers * 100
# rate = engagement_rate(user_id, followers)
# print(f"Engagement rate: {rate:.2f}%")
As a rough industry benchmark, mega-accounts (1M+ followers) often sit around 1–2%, while smaller niche creators frequently exceed 3–5%. A huge follower count paired with a sub-0.5% engagement rate is the classic sign of an inflated audience — which we dig into in the fake-engagement detection guide.
Step 3: Find top-performing content and posting cadence
Once you have the posts, two derived insights tell a brand what actually works for this creator: which posts overperform, and how consistently they post.
from datetime import datetime
def analyze_posts(items):
scored = []
for p in items:
eng = p.get("like_count", 0) + p.get("comment_count", 0)
scored.append({
"code": p.get("code"),
"engagement": eng,
"taken_at": p.get("taken_at"), # unix timestamp in the raw JSON
})
# Top 3 posts by engagement
top = sorted(scored, key=lambda x: x["engagement"], reverse=True)[:3]
# Posting cadence: average days between posts
times = sorted(s["taken_at"] for s in scored if s["taken_at"])
gaps = [(b - a) / 86400 for a, b in zip(times, times[1:])]
cadence = sum(gaps) / len(gaps) if gaps else None
return top, cadence
Top posts reveal the formats and themes that resonate (a brand wants its product in those formats). Cadence reveals reliability — a creator who posts every 10 days is a different partner than one who posts daily.
Step 4: Add Reels, where the reach lives
Reels routinely out-reach in-feed posts because Instagram pushes them to non-followers. Pull them with user_reels (it paginates with an after cursor taken from page_info.end_cursor) and compare play counts against the follower base:
def get_reels(user_id, after=None):
params = {"user_id": user_id}
if after:
params["after"] = after
r = requests.get(f"{BASE}/user_reels", headers=HEADERS, params=params)
r.raise_for_status()
return r.json()
# A reel with plays far above the follower count signals strong
# algorithmic distribution — valuable for awareness campaigns.
If you want to go further, reels_audio?audio_id= lets you find other Reels using the same audio track — useful for spotting whether a creator is riding a trending sound or starting one. See the Reels & audio tutorial for that workflow.
Step 5: Analyze comment quality and sentiment
This is where genuine influence separates from vanity metrics. Fetch comments for the creator's top posts with media_comments?code= (the code is the post shortcode, and the endpoint paginates with an after cursor), then look at who comments and what they say.
def get_comments(code, after=None):
params = {"code": code}
if after:
params["after"] = after
r = requests.get(f"{BASE}/media_comments", headers=HEADERS, params=params)
r.raise_for_status()
return r.json()
comments = get_comments("ABC1234XYZ_")
# Inspect the JSON for comment text and commenter usernames.
Two cheap, high-signal checks you can run on the comment text:
- Sentiment — run the text through a sentiment model (e.g. VADER from
nltk, or any LLM) to score how the audience reacts to the creator and to sponsored posts specifically. - Authenticity — a real audience writes varied, on-topic comments. A flood of single-emoji comments, generic "Nice! 🔥🔥" repeats, or "follow me back" spam is a red flag for purchased engagement.
# Minimal sentiment pass with VADER (pip install nltk)
from nltk.sentiment import SentimentIntensityAnalyzer
sia = SentimentIntensityAnalyzer()
texts = [c["text"] for c in comments.get("comments", []) if c.get("text")]
scores = [sia.polarity_scores(t)["compound"] for t in texts]
avg_sentiment = sum(scores) / len(scores) if scores else 0
print(f"Average comment sentiment: {avg_sentiment:.2f}") # -1 to +1
What you can build with this
Stitch those four steps into one function and you have the core of several products:
- Influencer discovery & vetting dashboards — rank creators by real engagement, not followers.
- Brand-safety checks — scan recent captions and comment sentiment before a partnership goes live.
- Campaign reporting — snapshot a creator before and after a sponsored post to measure lift.
- Competitive intelligence — track which content formats win in a niche over time.
For a wider list of products you can build on these endpoints, see What can you build with an Instagram API?
What does a full profile cost?
A thorough analysis of one creator is roughly: 1 profile call + 2–3 media pages + 1–2 Reels pages + comments for the top 3 posts ≈ 8–12 requests. At the per-request rates below, that's well under two cents per creator.
- Free Basic tier: 30 requests/month — enough to profile 2–3 creators while you test
- Pro tier ($59/mo): 150,000 requests included, then $0.13 per 1,000
- Ultra tier ($119/mo): 900,000 requests included, then $0.11 per 1,000
- Mega tier ($249/mo): 3,000,000 requests included, then $0.10 per 1,000
Profiling 10,000 creators a month (~100,000 requests) fits inside the Pro tier's included quota. Add the optional fields parameter to every call to trim the raw JSON and stay within the 10 GB/month bandwidth allowance.
Compliance and responsible use
This API returns public Instagram data only. Influencer analytics, audience research, and brand vetting are common use cases, but you remain responsible for complying with Instagram's terms of service and applicable privacy laws like GDPR and CCPA — especially when storing commenter usernames or building profiles of individuals. The API is not affiliated with or endorsed by Meta or Instagram.
Conclusion
Follower count is the least interesting number on an Instagram profile. By combining the user/{username}, user_media, user_reels, and media_comments endpoints, you can compute real engagement rate, surface top content, measure posting cadence, and read the room in the comments — the signals that actually predict whether a creator delivers. At $0.10–$0.13 per 1,000 requests, full creator profiles cost pennies, which makes data-driven influencer analysis practical even at agency scale.
Compliance note: this API returns public Instagram data only. You are responsible for complying with Instagram's terms and applicable privacy law (GDPR/CCPA). Not affiliated with or endorsed by Meta/Instagram.