# Instagram API (`apidojo/instagram-api`) Actor

Real-time Instagram data over plain HTTP. Get profiles, posts, reels, stories, followers, comments, hashtags, locations and audio as JSON. No Instagram login, no runs to start. $0.005 per successful request, same price for every endpoint.

- **URL**: https://apify.com/apidojo/instagram-api.md
- **Developed by:** [API Dojo](https://apify.com/apidojo) (community)
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 11 total users, 8 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 api requests

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 📸 Instagram API: Real-Time Profiles, Posts, Reels & Comments

Call Instagram data like any REST API. This **Instagram API** is an always-on Apify Standby Actor: send a `GET` request, get JSON back in seconds. No runs to start, no datasets to poll, no Instagram login.

Look up profiles, page through posts, reels, tagged posts, followers and followings, read stories, comments and replies, and browse hashtags, locations and audio. All through 20 simple endpoints.

**💰 Pricing:** $0.005 per successful request | **⚡ Response:** live JSON, seconds | **🔓 No Instagram login or API key**

***

### 📋 Table of Contents

1. [How It Works](#-how-it-works)
2. [Quick Start](#-quick-start)
3. [Pricing](#-pricing)
4. [Endpoints](#-endpoints)
5. [Pagination](#-pagination)
6. [Response Format](#-response-format)
7. [Errors & Status Codes](#-errors--status-codes)
8. [Code Examples](#-code-examples)
9. [Free Plan](#-free-plan)
10. [Related Actors](#-related-actors)
11. [FAQ](#-frequently-asked-questions)
12. [Contact](#-contact)

***

### 🧭 How It Works

This Actor runs in [Apify Standby mode](https://docs.apify.com/platform/actors/running/standby). Instead of starting a run and waiting for a dataset, you call an HTTP endpoint and get the result in the response.

| | Classic Actor run | This Instagram API (Standby) |
| --- | --- | --- |
| **How you call it** | Start a run, wait, read the dataset | Plain `GET` request |
| **Latency** | Run startup + scraping | Live response, no startup |
| **Result** | Dataset items | JSON in the HTTP response |
| **Billing** | Per run / per item | **Per request** |
| **Best for** | Large batch jobs | Apps, bots, agents, dashboards |

Every endpoint returns one object or one page of results. Use the `cursor` to get the next page.

***

### 🚀 Quick Start

**1. Get your Apify API token** from [Console → Settings → API & Integrations](https://console.apify.com/settings/integrations?fpr=yhdrb).

**2. Call an endpoint:**

```bash
curl "https://apidojo--instagram-api.apify.actor/user/handle/anygabriellyofficial" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

**3. Get JSON back:**

```json
{
  "status": 200,
  "message": "OK",
  "data": {
    "type": "user",
    "isAvailable": true,
    "id": "850196122",
    "username": "anygabriellyofficial",
    "fullName": "Any Gabrielly",
    "profilePicUrl": "https://scontent-sea1-1.cdninstagram.com/v/t51.2885-19/486829133_...",
    "isPrivate": false,
    "isVerified": true
  }
}
```

That's it. That request cost $0.005.

**Authentication:** send your Apify token in the `Authorization: Bearer <token>` header (recommended) or as a `?token=<token>` query parameter. The `Authorization` header is never forwarded to the upstream service.

***

### 💰 Pricing

One flat price, every endpoint.

| Event | Price | When it fires |
| --- | --- | --- |
| **Request** (`request-event`) | **$0.005** per call | Every successful request that returns data |

- **Same price for every endpoint.** A profile lookup and a page of hashtag posts cost the same.
- **You only pay for responses that contain data.** Invalid requests (`400`), unknown endpoints, plan and rate-limit refusals and upstream errors are **not charged**.
- **"Not found" answers and empty pages are charged.** A lookup for a post or profile that does not exist can return `200` with `{ "notFound": true }` as `data`. That response contains data, so it costs one request.
- **No platform fees, no compute units, no runs.** Just the per-request price.

#### Cost Examples

| Scenario | Requests | Cost |
| --- | --- | --- |
| Look up 1 profile | 1 | **$0.005** |
| Fetch 100 posts by code | 100 | **$0.50** |
| Read a hashtag, 50 pages deep | 50 | **$0.25** |
| Look up 1,000 profiles | 1,000 | **$5.00** |
| 10,000 calls in a month | 10,000 | **$50.00** |

> Paginated endpoints are charged per page. Following a `cursor` is a new request, so 10 pages = 10 requests = $0.05.

***

### 📚 Endpoints

All endpoints are `GET`. Base URL: `https://apidojo--instagram-api.apify.actor`

#### 👤 Users

| Endpoint | Description | Params |
| --- | --- | --- |
| `/user/handle/{handle}` | Profile by handle (username) | `handle` (e.g. `kyliejenner`) |
| `/userid/{handle}` | User ID for a handle | `handle` |
| `/user/{id}` | Profile by user ID | `id` (e.g. `850196122`) |
| `/user/{id}/posts` | A user's posts | `id`, `cursor` |
| `/user/{id}/posts/tagged` | Posts a user is tagged in | `id`, `cursor` |
| `/user/{id}/reels` | A user's reels | `id`, `cursor` |
| `/user/{id}/stories` | A user's current stories | `id` |
| `/user/{id}/followers` | A user's followers | `id`, `cursor` |
| `/user/{id}/followings` | Accounts a user follows | `id`, `cursor` |
| `/user/search` | Search users by keyword | `query` (required), `cursor` |

#### 🖼️ Posts

| Endpoint | Description | Params |
| --- | --- | --- |
| `/post/code/{code}` | Full post by its code | `code` (e.g. `CuKHeY_PLbZ`) |
| `/post/medias` | Media files of a post, reel or IGTV, in carousel order | `url` (required, full Instagram URL with `/p/`, `/reel/`, `/reels/` or `/tv/`) |
| `/post/search` | Search posts by keyword | `query` (required), `cursor` |
| `/post/{id}/comments` | Comments on a post | `id` (e.g. `3911525305614943306`), `cursor` |
| `/post/{id}/comments/{commentId}/replies` | Replies to a comment | `id`, `commentId` (e.g. `18104328670997094`), `cursor` |

#### #️⃣ Hashtags

| Endpoint | Description | Params |
| --- | --- | --- |
| `/hashtag/{name}/posts` | Posts for a hashtag | `name` (e.g. `cats`), `cursor`, `page` (integer) |
| `/hashtag/{name}/reels` | Reels for a hashtag | `name`, `cursor` |
| `/hashtag/{name}/postsandreels` | Posts and reels for a hashtag | `name`, `cursor` |

#### 📍 Locations

| Endpoint | Description | Params |
| --- | --- | --- |
| `/location/{id}/posts` | Posts from a location | `id`, `tab` (e.g. `recent` or `top`), `cursor`, `page` (integer) |

#### 🎵 Audio

| Endpoint | Description | Params |
| --- | --- | --- |
| `/audio/{id}/posts` | Posts that use an audio track | `id`, `cursor` |

> **Tip:** The post code is the part after `/p/` or `/reel/` in the URL. In `https://www.instagram.com/p/CuKHeY_PLbZ/` the code is `CuKHeY_PLbZ`. Endpoints under `/user/{id}` need the numeric user ID. Get it from `/userid/{handle}`. Comment endpoints need the numeric post `id`, which you find in any post object.

The full OpenAPI spec is available on the Actor's **API** tab in Apify Console.

***

### 🔄 Pagination

Paginated endpoints return a `cursor` with each page. Pass it back to get the next page.

```bash
## Page 1
curl "https://apidojo--instagram-api.apify.actor/user/850196122/posts" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"

## Page 2
curl "https://apidojo--instagram-api.apify.actor/user/850196122/posts?cursor=CURSOR_FROM_PAGE_1" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

`/hashtag/{name}/posts` and `/location/{id}/posts` also return a `page` number. For these two, send back both the `cursor` and the `page` from the previous response:

```bash
curl "https://apidojo--instagram-api.apify.actor/hashtag/cats/posts?cursor=CURSOR_FROM_PAGE_1&page=PAGE_FROM_PAGE_1" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

Stop when the response has no `cursor` or the page comes back empty. Each page is one request ($0.005).

***

### 📊 Response Format

Every response has the same envelope:

```json
{
  "status": 200,
  "message": "OK",
  "data": { }
}
```

| Endpoint type | `data` contains |
| --- | --- |
| Single post (`/post/code/{code}`) | One post object |
| Profile (`/user/handle/{handle}`, `/user/{id}`) | One user object |
| User ID lookup (`/userid/{handle}`) | `{ "isAvailable": true, "handle": "...", "id": "..." }` |
| Post media (`/post/medias`) | One media object |
| Post lists (user posts, tagged posts, reels, post search, hashtag reels, hashtag posts and reels, audio posts) | `{ "posts": [...], "cursor": "..." }` |
| Hashtag posts and location posts | `{ "posts": [...], "cursor": "...", "page": 1 }` |
| Followers | `{ "followers": [...], "cursor": "..." }` |
| Followings | `{ "followings": [...], "cursor": "..." }` |
| User search | `{ "users": [...], "cursor": "..." }` |
| Comments and replies | `{ "comments": [...], "cursor": "..." }` |
| Stories | `{ "stories": [...] }` |
| Post, reel or profile that does not exist | `{ "notFound": true }` |

#### Post Object

```json
{
  "type": "post",
  "id": "123456789",
  "code": "ABC123xyz",
  "url": "https://www.instagram.com/p/ABC123xyz/",
  "createdAt": "2024-02-01T12:00:00Z",
  "caption": "Beautiful sunset #instagram",
  "likeCount": 1000,
  "commentCount": 100,
  "isVideo": false,
  "isCarousel": false,
  "isPinned": false,
  "isPaidPartnership": false,
  "image": {
    "url": "https://instagram.com/image.jpg",
    "width": 1080,
    "height": 1080
  },
  "owner": {
    "id": "987654321",
    "username": "instagramuser",
    "fullName": "Instagram User",
    "isVerified": false,
    "followerCount": 10000,
    "followingCount": 1000,
    "postCount": 500
  }
}
```

Posts can also include `video` (URL, size, duration, `playCount`), `carouselMedia`, `audio` (title, artist, cover art, audio URL), `location` (name, address, city, `lat`, `lng`) and `isLikeAndViewCountsDisabled`.

#### User Object

Key fields: `type`, `id`, `username`, `fullName`, `profilePicUrl`, `isPrivate`, `isVerified`, `isAvailable`.

#### Comment Object

`id`, `userId`, `message`, `createdAt`, `likeCount`, `replyCount`, `isRanked`, `user` (`id`, `username`, `fullName`, `isVerified`, `isPrivate`, `profilePicUrl`).

#### Story Object

`id`, `code`, `createdAt`, `expiringAt`, `owner`, `isVideo`, `video`, `image`, `duration`, `hasAudio`, `audio`, `mentions`, `hashtags`, `link`, `coowners`, `highlights`, `canReply`, `canReshare`.

#### Media Object

`type`, `code`, `url`, `medias`. Each entry in `medias` has `type` (`image` or `video`), `link` (signed CDN link to the file), `thumbnail` and `duration` (seconds, for videos).

***

### ⚠️ Errors & Status Codes

Errors use the same envelope, without `data`. **Requests that return no data are not charged.**

| Status | Meaning | Charged? |
| --- | --- | --- |
| `200` | Success | ✅ $0.005 |
| `400` | Invalid parameters. `errors` lists what's wrong | ❌ |
| `404` | Unknown endpoint or nothing found | ❌ |
| `403` | Access not available on your plan or account | ❌ |
| `429` | Monthly free request limit reached | ❌ |
| `502` | Upstream error, safe to retry | ❌ |
| `503` | Plan check temporarily unavailable, retry shortly | ❌ |

Example `400`:

```json
{
  "status": 400,
  "message": "Bad request",
  "errors": ["query.page: page must be an integer"]
}
```

***

### 💻 Code Examples

#### cURL

```bash
curl "https://apidojo--instagram-api.apify.actor/post/code/CuKHeY_PLbZ" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

#### Python

```python
import requests

BASE = "https://apidojo--instagram-api.apify.actor"
HEADERS = {"Authorization": "Bearer YOUR_APIFY_TOKEN"}

def user_posts(user_id, pages=5):
    posts, cursor = [], None
    for _ in range(pages):
        params = {"cursor": cursor} if cursor else {}
        res = requests.get(f"{BASE}/user/{user_id}/posts", headers=HEADERS, params=params, timeout=300).json()
        data = res.get("data") or {}
        posts += data.get("posts", [])
        cursor = data.get("cursor")
        if not cursor or not data.get("posts"):
            break
    return posts

print(len(user_posts("850196122", pages=3)))  # max 3 requests = $0.015
```

#### JavaScript / Node.js

```javascript
const BASE = 'https://apidojo--instagram-api.apify.actor';
const headers = { Authorization: `Bearer ${process.env.APIFY_TOKEN}` };

const res = await fetch(`${BASE}/userid/anygabriellyofficial`, { headers });
const { data: user } = await res.json();

const followers = await fetch(`${BASE}/user/${user.id}/followers`, { headers }).then((r) => r.json());
console.log(followers.data.followers.length, followers.data.cursor);
```

#### Media Files From a Post URL

```bash
curl -G "https://apidojo--instagram-api.apify.actor/post/medias" \
  --data-urlencode "url=https://www.instagram.com/p/CuKHeY_PLbZ/" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

***

### 🆓 Free Plan

Apify Free plan users can try this API with a limited number of free requests each month. When the monthly limit is reached, the API answers `429` until the next month. [Subscribe to a paid Apify plan](https://apify.com/pricing?fpr=yhdrb) for unlimited requests.

***

### 🌴 Related Actors

Need bulk exports to a dataset, CSV or Excel instead of live calls? Use our batch scrapers:

| Tool | Best For |
| --- | --- |
| 📸 **[Instagram Scraper](https://apify.com/apidojo/instagram-scraper?fpr=yhdrb)** | General Instagram exports |
| ⚡ **[Fast Instagram Scraper API](https://apify.com/apidojo/instagram-scraper-api?fpr=yhdrb)** | Posts, reels, profiles and hashtags at scale |
| 👤 **[Instagram Profile Scraper](https://apify.com/apidojo/instagram-user-scraper?fpr=yhdrb)** | Bulk profiles and follower data |
| #️⃣ **[Instagram Hashtag Scraper](https://apify.com/apidojo/instagram-hashtag-scraper?fpr=yhdrb)** | Hashtag research |
| 📍 **[Instagram Location Scraper](https://apify.com/apidojo/instagram-location-scraper?fpr=yhdrb)** | Posts tagged at a location |
| 🗺️ **[Fast Instagram Location Scraper API](https://apify.com/apidojo/instagram-location-scraper-api?fpr=yhdrb)** | Geo-tagged posts at scale |
| 💬 **[Instagram Comments Scraper](https://apify.com/apidojo/instagram-comments-scraper?fpr=yhdrb)** | Full comment threads |
| 🗨️ **[Fast Instagram Comments Scraper API](https://apify.com/apidojo/instagram-comments-scraper-api?fpr=yhdrb)** | Comments and replies at scale |

***

### ❓ Frequently Asked Questions

#### What is a Standby Actor?

A Standby Actor is an always-running web server on Apify. You call it over HTTP like any API and get the response directly. No runs to start or datasets to read. [Learn more](https://docs.apify.com/platform/actors/running/standby).

#### How much does it cost?

**$0.005 per successful request**, the same for every endpoint. 1,000 requests = $5. Failed and invalid requests are free.

#### Am I charged per post or per request?

Per request. A page of hashtag posts costs the same as a single profile lookup.

#### Do I need an Instagram account or a Meta developer account?

No. You only need an Apify API token.

#### How do I get more than one page of results?

Pass the `cursor` from the previous response as a query parameter. For hashtag posts and location posts, also pass the `page`. Each page is a separate $0.005 request. See [Pagination](#-pagination).

#### How do I find a user ID?

Call `/userid/{handle}` with the username. The `id` in the response works with every `/user/{id}` endpoint. Profile objects from `/user/handle/{handle}` include the `id` too.

#### What happens if a post or profile does not exist?

The API can answer `200` with `{ "notFound": true }` as `data`. Check `data.notFound` before reading other fields. This response is charged like any other response with data.

#### How fast is it?

Responses come back live, usually within seconds. There is no run startup time.

#### Can I use it from an AI agent or bot?

Yes. It's a plain HTTP API with an OpenAPI spec, so it fits LLM tool calls, bots, backends and no-code tools that can make HTTP requests.

#### Where is the data stored?

Nowhere. Results are returned in the HTTP response only. For dataset, CSV or Excel exports, use one of the [batch scrapers](#-related-actors).

#### Can I access private accounts?

No. Only publicly available data is returned.

***

### 📞 Contact

If you need any sort of support, please send an email to **apidojo10@gmail.com**. You name it, we get it.

***

**Ready to call Instagram data like an API?** One endpoint per question, $0.005 per answer, live JSON in seconds. Grab your Apify token and send your first request. 📸

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("apidojo/instagram-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("apidojo/instagram-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call apidojo/instagram-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apidojo/instagram-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/YmVM8SLJq7vsWSXiM/builds/dY5uZuDsgiQjXlt60/openapi.json
