# Instagram Public Data API — profiles, posts, reels, hashtags, comments and search (no login required, public content only)

> public profile facts and first-page recent posts
> ReefAPI engine `instagram` · 10 endpoints · clean JSON, no scraping or browsers to manage.

## How to call
- **Endpoint:** `POST https://api.reefapi.com/instagram/v1/<action>` with a JSON body.
- **Auth:** header `x-api-key: <YOUR_REEFAPI_KEY>` — create one free (1,000 credits, no card): https://reefapi.com/signup
- **Response (every call):** `{ ok: boolean, data: ..., meta: { record_count, credits, ... }, error: { code, message } }` — branch on `ok`. Failed or blocked calls are free.
- **One key + one shared credit pool** across every ReefAPI API. Per-call credits are listed on each endpoint below.
- **Use it from an AI agent (MCP):** connect `https://api.reefapi.com/mcp` (remote streamable-http, `Authorization: Bearer <key>`) and your assistant can call these actions directly.

## Endpoints

### POST /instagram/v1/profile — 1 credit
public profile facts and first-page recent posts

**Parameters:**
- `username` (string, required) — Instagram handle without the @ (the name in instagram.com/<username>).

**Returns:** profile{} — username, full_name, biography, follower_count, following_count, post_count, is_verified/private/business, category, profile_pic, external_url, user_id, recent_posts[]

**Example request body:**
```json
{
  "username": "nike"
}
```

### POST /instagram/v1/posts — 1 credit
public profile timeline posts from feed/user with max_id pagination

**Parameters:**
- `username` (string, required) — Instagram handle without the @ (the name in instagram.com/<username>).
- `limit` (integer, optional, default 12) — Max items to return (1-50). Larger values are clamped to 50.
- `max_id` (string, optional) — Pagination cursor from a previous response's page_info.next_max_id (also accepted as 'cursor'). Omit for the first page.

**Returns:** posts[] (media_id, shortcode, caption, like_count, comment_count, media/video), page_info{next_max_id, has_next_page}

**Example request body:**
```json
{
  "username": "nike"
}
```

### POST /instagram/v1/reels — 1 credit
public profile reels from clips/user with max_id pagination

**Parameters:**
- `username` (string, required) — Instagram handle without the @ (the name in instagram.com/<username>).
- `limit` (integer, optional, default 12) — Max items to return (1-50). Larger values are clamped to 50.
- `max_id` (string, optional) — Pagination cursor from a previous response's page_info.next_max_id (also accepted as 'cursor'). Omit for the first page.

**Returns:** reels[] (media_id, shortcode, caption, view/play count, like_count), page_info{max_id, has_next_page}

**Example request body:**
```json
{
  "username": "nike"
}
```

### POST /instagram/v1/similar_accounts — 1 credit
public related profiles from web_profile_info

**Parameters:**
- `username` (string, required) — Instagram handle without the @ (the name in instagram.com/<username>).
- `limit` (integer, optional) — Max related accounts to return (Instagram returns up to ~80).

**Returns:** accounts[] — related profiles (user_id, username, full_name, is_verified, profile_pic)

**Example request body:**
```json
{
  "username": "nike"
}
```

### POST /instagram/v1/search — 1 credit
topsearch blended public users, hashtags, and places

**Parameters:**
- `query` (string, required) — Free-text search term (matches users / hashtags / places).

**Returns:** users[], hashtags[], places[] — blended public topsearch results

### POST /instagram/v1/users_search — 1 credit
public user lookup by handle (exact / near-exact match)

**Parameters:**
- `query` (string, required) — Free-text search term (matches users / hashtags / places).

**Returns:** users[] — matching public accounts (user_id, username, full_name, is_verified, follower_count, post_count). NOTE: logged-out access resolves the account whose handle matches the query (exact / near-exact). Full fuzzy 'find similar names' search is login-gated by Instagram and is not available without an account.

### POST /instagram/v1/hashtag_search — 1 credit
topsearch public hashtags only

**Parameters:**
- `query` (string, required) — Free-text search term (matches users / hashtags / places).

**Returns:** hashtags[] — matching tags (name, id, media_count, formatted_media_count)

### POST /instagram/v1/post_info — 1 credit
maximally-complete public post/reel detail by shortcode (URL) or media_id

**Parameters:**
- `shortcode` (string, optional) — Post shortcode — the code in instagram.com/p/<shortcode>/ or /reel/<shortcode>/ (a full post/reel URL is also accepted). Provide shortcode OR media_id.
- `media_id` (string, optional) — Numeric media id (from a post's media_id field). Provide media_id OR shortcode.

**Returns:** post{} — media_id, shortcode, media_type, caption, like_count, comment_count, view_count, display_url/video_url, dimensions, video_duration, accessibility_caption, owner, tagged_users[], location{}, music{audio_id,song,artist}, coauthor_producers[], and carousel_media[] (every image/video of an album). Richest detail comes from a shortcode; media_id resolves the same media.

### POST /instagram/v1/post_comments — 1 credit
public comments for a post/reel by shortcode (URL) or media_id, with CURSOR pagination

**Parameters:**
- `shortcode` (string, optional) — Post shortcode — the code in instagram.com/p/<shortcode>/ or /reel/<shortcode>/ (a full post/reel URL is also accepted). Provide shortcode OR media_id.
- `media_id` (string, optional) — Numeric media id (from a post's media_id field). Provide media_id OR shortcode.
- `limit` (integer, optional) — Comments per call (default 50; one call returns up to ~1200 within the time budget). For MORE, chunk with `cursor`.
- `cursor` (string, optional) — Resume token from a previous call's `next_cursor` — page UNLIMITED depth across short calls (no timeout). Omit for page 1.

**Returns:** comments[] (comment_id, text, created_at, username, user{user_id,username,is_verified,profile_pic}) + comment_count (total on post) + returned_count + next_cursor (pass back as `cursor` for the next batch; null = exhausted) + has_more. Works on posts AND reels. Logged-out.

### POST /instagram/v1/audio_media — 1 credit
public reels feed that use a given audio/music track, with pagination

**Parameters:**
- `audio_id` (string, required) — Numeric audio/music id. Get it from a reel/post via post_info (post.music.audio_id) — every reel that uses a sound exposes one. Returns the public reels feed built on that sound.
- `limit` (integer, optional, default 12) — Max items to return (1-50). Larger values are clamped to 50.
- `max_id` (string, optional) — Pagination cursor from a previous response's page_info.next_max_id (also accepted as 'cursor'). Omit for the first page.

**Returns:** audio{audio_id, media_count, formatted_media_count, song_name, artist_name}, media[] (media_id, shortcode, caption, like/comment/play count, video/display url, user), page_info{max_id, has_next_page}

## More
- Try it live, no code: https://reefapi.com/playground?engine=instagram
- Human docs page: https://reefapi.com/docs/instagram
- Every ReefAPI API in one file (for your AI): https://reefapi.com/llms-full.txt
