Documentation
v1.0 ← Dashboard

Getting Started

IGPAPI is a REST API that lets you access public Instagram user profiles and post feeds. Built on top of a multi-account session pool, it handles authentication, rate limiting, and session management automatically.

All API responses are JSON. Send requests with the X-API-Key header for authenticated endpoints.

Authentication

Include your API key in every request using the X-API-Key header. Keys are prefixed with igapi_.

HTTP Header
X-API-Key: igapi_your_key_here

Base URL

All API calls are made to your server's base URL. Replace the domain with your deployment address:

Base URL
https://your-domain.com/api

Plans & Rate Limits

Choose a plan based on your monthly request volume. Each plan also has a per-minute rate limit to prevent bursting.

Plan Requests / Month Rate Limit Price
Starter 10,000 10 req/min Free
Pro 50,000 30 req/min Contact
Business 100,000 60 req/min Contact

Rate Limit Behavior

When you exceed the per-minute rate limit, the API returns a 429 response with a retryAfterMs field indicating when you can retry.

JSON — 429 Response
{
  "error": "rate_limit_exceeded",
  "limit": 10,
  "current": 11,
  "retryAfterMs": 38400
}
GET /api/userinfo/:username

Returns public profile information for an Instagram user. Requires a valid API key.

Parameters

NameInTypeDescription
username required path string Instagram username (no @ prefix, max 30 chars)

Response — 200 OK

JSON
{
  "pk": "25025320",
  "username": "instagram",
  "full_name": "Instagram",
  "biography": "Discovering — and telling — stories from around the world.",
  "follower_count": 672000000,
  "following_count": 81,
  "posts": 1044,
  "reels": 290,
  "is_verified": true,
  "is_private": false,
  "is_business": false,
  "profile_pic": "https://...",
  "has_stories": true,
  "external_url": "",
  "city": ""
}
GET /api/feed/:username

Returns the most recent posts for a public Instagram account. Supports cursor-based pagination.

Parameters

NameInTypeDescription
username required path string Instagram username
max_id optional query string Pagination cursor from previous response's pagination.nextMaxId

Response — 200 OK

JSON
{
  "user": {
    "pk": "25025320",
    "username": "instagram",
    "fullName": "Instagram",
    "profilePic": "https://...",
    "isPrivate": false,
    "isVerified": true
  },
  "posts": [
    {
      "id": "3567890123456789_25025320",
      "pk": "3567890123456789",
      "shortcode": "CxYZ123abc",
      "type": "image",
      "timestamp": 1743000000,
      "caption": "Hello world",
      "likeCount": 124000,
      "commentCount": 320,
      "mediaUrl": "https://...",
      "thumbnailUrl": "https://..."
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextMaxId": "3567890123456789_25025320",
    "count": 12
  }
}
Private accounts return a 403 response. Only public profiles are accessible.
GET /api/media

Returns info for a single post from its link — images, like count, comment count, and (for videos/reels) view count. Accepts a full post URL, a bare shortcode, or a numeric media id.

Parameters

NameInTypeDescription
url required query string Post link — /p/…, /reel/…, or /tv/…. You may pass ?shortcode= or ?id= (numeric media id) instead of ?url=.

Response — 200 OK

JSON
{
  "id": "3683065118176544436_10013772027",
  "shortcode": "DMc4DYVi4a0",
  "mediaId": "3683065118176544436",
  "kind": "reel",
  "likeCount": 238,
  "commentCount": 5,
  "viewCount": 1500,
  "repostCount": 251,
  "caption": "…",
  "timestamp": 1743000000,
  "thumbnailUrl": "https://...",
  "mediaUrl": "https://...",
  "images": [ { "url": "https://...", "width": 1080, "height": 1920 } ],
  "user": {
    "pk": "10013772027",
    "username": "world_record_egg",
    "fullName": "Just An Egg",
    "isVerified": true,
    "isPrivate": false,
    "profilePicUrl": "https://..."
  }
}

kind is one of photo, video, reel, or carousel. viewCount is a number for videos/reels and null for photos and carousels (reels report plays, feed videos report views). repostCount is Instagram's media_repost_count (null when the post doesn't expose it). mediaUrl is the video URL for video/reel posts. For a carousel, the response also includes a carouselItems array — one entry per slide, each with its own type and images.

Only posts from public accounts (or accounts a session follows) are accessible. Invalid links return 400; missing/removed posts return 404.

Error Handling

All errors follow a consistent JSON format:

JSON — Error Format
{
  "error": "error_code",
  "message": "Human-readable description"
}
401
Unauthorized
Missing or invalid X-API-Key header. Check your key and ensure it is active.
403
Forbidden
Account is private, challenged, or access requires special permission.
404
Not Found
The requested Instagram username does not exist.
429
Rate Limited
Too many requests. Check retryAfterMs in the response to know when to retry.
500
Server Error
An internal error occurred. Retry after a few seconds or contact support.

Code Examples

Example requests for fetching a user profile. Replace igapi_your_key and instagram with your values.

cURL
curl -X GET \
  -H "X-API-Key: igapi_your_key" \
  "https://your-domain.com/api/userinfo/instagram"
cURL — Feed with pagination
curl -H "X-API-Key: igapi_your_key" \
  "https://your-domain.com/api/feed/instagram?max_id=CURSOR"
JavaScript (fetch)
const API_KEY = 'igapi_your_key';

async function getUserInfo(username) {
  const res = await fetch(
    `https://your-domain.com/api/userinfo/${username}`,
    { headers: { 'X-API-Key': API_KEY } }
  );
  if (!res.ok) throw new Error(`Error ${res.status}`);
  return res.json();
}

async function getFeed(username, maxId = null) {
  let url = `https://your-domain.com/api/feed/${username}`;
  if (maxId) url += `?max_id=${maxId}`;
  const res = await fetch(url, { headers: { 'X-API-Key': API_KEY } });
  return res.json();
}
Python (requests)
import requests

API_KEY = "igapi_your_key"
BASE    = "https://your-domain.com/api"
headers = {"X-API-Key": API_KEY}

# Fetch profile
r = requests.get(f"{BASE}/userinfo/instagram", headers=headers)
r.raise_for_status()
profile = r.json()
print(profile["username"], profile["follower_count"])

# Fetch feed
r2 = requests.get(f"{BASE}/feed/instagram", headers=headers)
feed = r2.json()
for post in feed["posts"]:
    print(post["type"], post["likeCount"])
PHP (cURL)
<?php
function igapi_get($endpoint) {
    $ch = curl_init("https://your-domain.com/api" . $endpoint);
    curl_setopt_array($ch, [
        CURLOPT_HTTPHEADER    => ["X-API-Key: igapi_your_key"],
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 15,
    ]);
    $body = curl_exec($ch);
    curl_close($ch);
    return json_decode($body, true);
}

$profile = igapi_get("/userinfo/instagram");
echo $profile["username"] . "\n";

$feed = igapi_get("/feed/instagram");
foreach ($feed["posts"] as $post) {
    echo $post["likeCount"] . "\n";
}

Try It Live

Send a real request directly from this page. Your API key is never stored.

Live Request
API Key
Endpoint
Username
Request URL