How to Extract Instagram Data Without Getting Blocked
If you've ever tried to pull data from Instagram programmatically, you know how frustrating it is. Instagram aggressively blocks scrapers, rotates their internal APIs, and bans accounts that make too many requests. Proxy pools, headless browsers, cookie rotation — it's an entire infrastructure problem before you even get to the data you actually need.
EternalSocial handles all of that complexity behind a single REST API. You send an HTTP request, you get clean JSON back. No proxies, no browser automation, no account bans.
This guide walks you through extracting Instagram profiles, posts, reels, and comments using the EternalSocial API, with practical code examples you can drop into your project today.
Prerequisites
You'll need an EternalSocial API key. You can get one by signing up for a free trial. Once you have your key, every request uses the same authentication header:
Authorization: Bearer YOUR_API_KEY
The base URL for all endpoints is:
https://api.eternalsocial.dev/v1
Extracting Instagram Profiles
The profile endpoint returns everything you'd see on a public Instagram profile: bio, follower counts, post count, profile picture URL, verification status, and more.
Request
curl -X GET "https://api.eternalsocial.dev/v1/instagram/profile/natgeo" \
-H "Authorization: Bearer YOUR_API_KEY"
TypeScript Example
const response = await fetch(
"https://api.eternalsocial.dev/v1/instagram/profile/natgeo",
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
}
);
const profile = await response.json();
console.log(profile.data.username); // "natgeo"
console.log(profile.data.followers); // 283000000
console.log(profile.data.biography); // "Experience the world..."
console.log(profile.data.isVerified); // true
Response Fields
The profile response includes:
username— The Instagram handlefullName— Display namebiography— Bio textfollowers— Follower countfollowing— Following countpostsCount— Total number of postsprofilePicUrl— High-resolution profile picture URLisVerified— Blue check verification statusisPrivate— Whether the account is privateexternalUrl— Link in bio URLcategory— Account category (e.g., "Media/News Company")
This is useful for competitor analysis, influencer vetting, or building profile databases for research.
Fetching Feed Posts
The posts endpoint returns a user's feed posts with full metadata: captions, like counts, comment counts, timestamps, media URLs, and tagged users.
Request
curl -X GET "https://api.eternalsocial.dev/v1/instagram/posts/natgeo?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
TypeScript Example
const response = await fetch(
"https://api.eternalsocial.dev/v1/instagram/posts/natgeo?limit=10",
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
}
);
const { data, pagination } = await response.json();
for (const post of data) {
console.log(
`${post.shortcode}: ${post.likes} likes, ${post.comments} comments`
);
console.log(`Caption: ${post.caption?.substring(0, 100)}...`);
console.log(`Posted: ${post.timestamp}`);
console.log("---");
}
Pagination
Most Instagram accounts have hundreds or thousands of posts. The API uses cursor-based pagination to let you fetch them in batches:
let cursor: string | undefined;
const allPosts = [];
do {
const url = new URL(
"https://api.eternalsocial.dev/v1/instagram/posts/natgeo"
);
url.searchParams.set("limit", "50");
if (cursor) url.searchParams.set("cursor", cursor);
const response = await fetch(url.toString(), {
headers: { Authorization: "Bearer YOUR_API_KEY" },
});
const { data, pagination } = await response.json();
allPosts.push(...data);
cursor = pagination.nextCursor;
} while (cursor);
console.log(`Fetched ${allPosts.length} total posts`);
The pagination.nextCursor field is null when there are no more results.
Extracting Reels
Instagram Reels have become the dominant content format. The reels endpoint works similarly to posts but returns reel-specific metadata like view counts, play counts, and audio information.
Request
curl -X GET "https://api.eternalsocial.dev/v1/instagram/reels/natgeo?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
TypeScript Example
const response = await fetch(
"https://api.eternalsocial.dev/v1/instagram/reels/natgeo?limit=10",
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
}
);
const { data } = await response.json();
for (const reel of data) {
console.log(`Reel: ${reel.shortcode}`);
console.log(`Views: ${reel.viewCount}`);
console.log(`Plays: ${reel.playCount}`);
console.log(`Likes: ${reel.likes}`);
console.log(`Audio: ${reel.audioTitle || "Original audio"}`);
console.log("---");
}
Reels data is especially valuable for identifying trending content formats and measuring video engagement rates.
Fetching Comments
Comments give you direct access to audience sentiment. The API returns comment text, author info, like counts, reply counts, and timestamps.
Request
curl -X GET "https://api.eternalsocial.dev/v1/instagram/comments/CxYzAbCdEf?limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
Replace CxYzAbCdEf with the post's shortcode (the alphanumeric string in any Instagram post URL).
TypeScript Example
const shortcode = "CxYzAbCdEf";
const response = await fetch(
`https://api.eternalsocial.dev/v1/instagram/comments/${shortcode}?limit=20`,
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
}
);
const { data } = await response.json();
for (const comment of data) {
console.log(`@${comment.username}: ${comment.text}`);
console.log(`Likes: ${comment.likes} | Replies: ${comment.replyCount}`);
console.log(`Posted: ${comment.timestamp}`);
console.log("---");
}
Comments support the same cursor-based pagination as posts and reels.
Understanding Rate Limits
The EternalSocial API uses a token-bucket rate limiting system. Each plan has a per-minute request allowance:
| Plan | Requests/min | Concurrent | | ---------- | ------------ | ---------- | | Free Trial | 30 | 2 | | Starter | 120 | 5 | | Growth | 300 | 10 | | Enterprise | Custom | Custom |
When you hit a rate limit, the API returns a 429 Too Many Requests response with a Retry-After header telling you how many seconds to wait.
Handling Rate Limits in Code
async function fetchWithRetry(
url: string,
apiKey: string,
maxRetries = 3
): Promise<unknown> {
for (let attempt = 0; attempt < maxRetries; attempt++) {
const response = await fetch(url, {
headers: { Authorization: `Bearer ${apiKey}` },
});
if (response.status === 429) {
const retryAfter = Number(response.headers.get("Retry-After")) || 10;
console.log(`Rate limited. Retrying in ${retryAfter}s...`);
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
continue;
}
if (!response.ok) {
throw new Error(`API error: ${response.status} ${response.statusText}`);
}
return response.json();
}
throw new Error("Max retries exceeded");
}
The key difference from DIY scraping: rate limits with EternalSocial are predictable and documented. With direct Instagram scraping, you get no warning — just a ban.
Error Handling Best Practices
The API returns standard HTTP status codes with descriptive error messages:
- 200 — Success
- 400 — Bad request (invalid parameters)
- 401 — Unauthorized (invalid or missing API key)
- 404 — User or resource not found
- 429 — Rate limit exceeded
- 500 — Server error (retry with backoff)
Always check for 404 errors specifically — they usually mean the Instagram account is private, deleted, or the username is misspelled.
const response = await fetch(
`https://api.eternalsocial.dev/v1/instagram/profile/${username}`,
{
headers: { Authorization: "Bearer YOUR_API_KEY" },
}
);
if (response.status === 404) {
console.log(`Account @${username} not found or is private`);
return null;
}
if (!response.ok) {
const error = await response.json();
throw new Error(`API error: ${error.message}`);
}
const profile = await response.json();
Common Use Cases
Here's what teams typically build with Instagram data extraction:
Influencer Marketing Platforms
Fetch profiles and engagement metrics to vet influencers before brand partnerships. Calculate real engagement rates by comparing likes and comments against follower counts.
Competitive Intelligence
Track competitor posting frequency, engagement trends, and content strategy shifts over time. Monitor when they change bios, launch new products, or shift messaging.
Social Listening
Pull comments across posts to measure audience sentiment. Identify recurring themes, complaints, or feature requests from real users.
Academic Research
Collect public social media data for studies on content virality, platform dynamics, or digital culture — without violating Instagram's terms yourself.
API Reference
For the complete list of Instagram endpoints, request parameters, and response schemas, see the API documentation.
Key Instagram endpoints:
GET /instagram/profile/{username}— Profile dataGET /instagram/posts/{username}— Feed postsGET /instagram/reels/{username}— ReelsGET /instagram/comments/{shortcode}— Post/reel commentsGET /instagram/stories/{username}— Active storiesGET /instagram/followers/{username}— Follower listGET /instagram/following/{username}— Following list
Get Started
EternalSocial gives you reliable Instagram data through a clean API — no proxies, no headless browsers, no account bans.
Sign up for a free trial to get your API key and start extracting Instagram data in minutes. The free tier includes 1,000 requests per month, which is enough to build and test your integration before scaling up.
If you need help getting started, check the API documentation or reach out to our team at support@eternalsocial.dev.