# Instagram

Canonical: https://monsterapi.co/docs/instagram

The Instagram API returns profiles, posts, reels, comments, saved highlights, locations, audio tracks and discovery lists.

Use `https://api.monsterapi.co/instagram/api` as the base URL. Check the current operation price in the [API reference](https://monsterapi.co/docs/api).

## Profiles and account lists

| Request                                                  | Returned information                                           |
| -------------------------------------------------------- | -------------------------------------------------------------- |
| [GET `/profile/{username}`](https://monsterapi.co/docs/api/instagram-profile)      | Profile details and available highlights.                      |
| [GET `/profile/id/{id}`](https://monsterapi.co/docs/api/instagram-profile)         | Profile details, including the current username.               |
| [GET `/profile/info/{username}`](https://monsterapi.co/docs/api/instagram-profile) | Profile counts, category and available first posts and videos. |
| [GET `/user/{id}/posts`](https://monsterapi.co/docs/api/instagram-media)           | A page of account posts.                                       |
| [GET `/user/{id}/reels`](https://monsterapi.co/docs/api/instagram-media)           | A page of account reels.                                       |
| [GET `/user/{id}/similar`](https://monsterapi.co/docs/api/instagram-profile)       | Suggested accounts.                                            |

Copy `user.id` from GET `/profile/{username}` into the `id` parameter of GET `/profile/id/{id}`, GET `/user/{id}/posts`, GET `/user/{id}/reels` or GET `/user/{id}/similar`.
The ID remains stable when the username changes. GET `/profile/id/{id}` returns the current username in `user.username`.

GET `/profile/info/{username}` includes available posts at `data.user.edge_owner_to_timeline_media.nodes` and videos at `data.user.edge_felix_video_timeline.nodes`.
A `500 upstream_shape` or `503 upstream_error` response from this request does not establish whether the account exists.

## Posts, comments and highlights

| Request                                                   | Returned information                                                                 |
| --------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| [GET `/media/{shortcode}`](https://monsterapi.co/docs/api/instagram-media)          | Post, reel or video details, author information and available comment previews.      |
| [GET `/media/{shortcode}/comments`](https://monsterapi.co/docs/api/instagram-media) | A page of comments without reply contents.                                           |
| [GET `/media/{shortcode}/embed`](https://monsterapi.co/docs/api/instagram-media)    | A post overview with its author, caption, counters and available views and duration. |
| [GET `/highlight/{id}`](https://monsterapi.co/docs/api/instagram-stories)           | Stories saved in a highlight.                                                        |

Copy `posts[].shortcode` from GET `/user/{id}/posts` or `reels[].shortcode` from GET `/user/{id}/reels` into the `shortcode` parameter of a post request.
The numeric `id` of a post is a different value and is not a shortcode.

Copy `highlights[].id` from GET `/profile/{username}` into the `id` parameter of GET `/highlight/{id}`.
A highlight ID is different from a story item ID. An unavailable highlight returns `404`; restricted access can return `501 requires_auth`.

## Discovery, places and audio

| Request                                                | Returned information                                                       |
| ------------------------------------------------------ | -------------------------------------------------------------------------- |
| [GET `/explore`](https://monsterapi.co/docs/api/instagram-discovery)             | Discovery sections, entries, section IDs and available continuations.      |
| [GET `/explore/sections`](https://monsterapi.co/docs/api/instagram-discovery)    | A page of entries for one discovery section.                               |
| [GET `/location/{id}`](https://monsterapi.co/docs/api/instagram-discovery)       | Available name, category, address, coordinates and post count for a place. |
| [GET `/location/{id}/posts`](https://monsterapi.co/docs/api/instagram-discovery) | The first page of posts for a place, from the `ranked` or `recent` tab.    |
| [GET `/audio/{id}`](https://monsterapi.co/docs/api/instagram-discovery)          | Available audio track information and a page of reels using the track.     |

For GET `/explore/sections`, copy `sections[].id` from GET `/explore` into `section` and the same section’s `sections[].next_cursor` into `cursor`.
Use the `id` field, including its `PolarisPopularSearchHomeSection:` prefix, rather than the separate `section` field.

A location ID is the numeric ID segment of an Instagram location URL.
GET `/location/{id}` returns it in `location.id`; pass that value as `id` to GET `/location/{id}/posts`.
Location post lists have no continuation cursor.

Copy `data.items[].media.clips_metadata.audio_ranking_info.best_audio_cluster_id` from [GET `/user/{id}/reels`](https://monsterapi.co/docs/api/instagram-media) into the `id` parameter of [GET `/audio/{id}`](https://monsterapi.co/docs/api/instagram-discovery) when present.
Keep the original request `id` when following `next_cursor`. Track information can be `null` while the response still contains reels.
`audio_asset_id` is a different field and is not declared interchangeable with this audio cluster ID.

## Popular terms and search

| Request                                                    | Returned information                                                              |
| ---------------------------------------------------------- | --------------------------------------------------------------------------------- |
| [GET `/popular?keyword=…`](https://monsterapi.co/docs/api/instagram-discovery)       | A term overview, reel count expressed as text, related terms and first reels.     |
| [GET `/popular/reels?keyword=…`](https://monsterapi.co/docs/api/instagram-discovery) | A page of reels with available like counts, comment counts and publication times. |
| [GET `/search/reels?q=…`](https://monsterapi.co/docs/api/instagram-search)           | Available reels for a search term.                                                |

Terms appear in `sections[].entries[].keyword` from GET `/explore` and `entries[].keyword` from GET `/explore/sections`.
Use a term within the format documented for the destination request.

The `keyword` parameter accepts 1 to 256 characters: letters and digits of any script, hyphens and spaces, with at least one letter or digit.
The `q` parameter accepts 1 to 256 Unicode characters: letters, numbers, combining marks, punctuation, symbols and space separators.
Controls, format characters, default-ignorable characters and whitespace-only queries are rejected. Accepted text keeps its spaces and case.

`media_count_text` is a reel count expressed as text, which can be abbreviated, such as `483M`.
It is not an exact numeric count. A search term does not guarantee an available result page.

## Continue a list

Copy the returned `next_cursor` into `cursor` without modifying it. Keep the same object or term, and use the endpoint that returned it except for the documented popular-overview continuation.

| Cursor producer                                  | Cursor consumer                             | Keep unchanged                                 |
| ------------------------------------------------ | ------------------------------------------- | ---------------------------------------------- |
| GET `/user/{id}/posts`: `next_cursor`            | GET `/user/{id}/posts`: `cursor`            | `id`                                           |
| GET `/user/{id}/reels`: `next_cursor`            | GET `/user/{id}/reels`: `cursor`            | `id`                                           |
| GET `/media/{shortcode}/comments`: `next_cursor` | GET `/media/{shortcode}/comments`: `cursor` | `shortcode`                                    |
| GET `/popular`: `next_cursor`                    | GET `/search/reels`: `cursor`               | Pass the same `keyword` as `q`                 |
| GET `/popular/reels`: `next_cursor`              | GET `/popular/reels`: `cursor`              | `keyword`                                      |
| GET `/search/reels`: `next_cursor`               | GET `/search/reels`: `cursor`               | `q`                                            |
| GET `/audio/{id}`: `next_cursor`                 | GET `/audio/{id}`: `cursor`                 | `id`                                           |
| GET `/explore`: `sections[].next_cursor`         | GET `/explore/sections`: `cursor`           | Pass the matching `sections[].id` as `section` |
| GET `/explore/sections`: `next_cursor`           | GET `/explore/sections`: `cursor`           | `section`                                      |

Stop when `next_cursor` is omitted or the terminal page returns `404 not_found`.
An empty page with a continuation remains `200`. Posts and account reels accept `limit` from 1 to 50, defaulting to 12; the returned count can differ.
Comments and audio lists have no `limit` parameter.

## Fields and refusals

Most responses include `data` with additional information. Named fields provide profile details, captions, counters, timestamps and media addresses.
Named identifiers are strings. Numeric named counters are numbers; `media_count_text` is text. Unavailable named values are `null`. An available empty string, list or object keeps that value.

`images` and `videos` contain available renditions in order. Use the URL and dimensions when they are provided.
The `type` field of named media uses `1` for a photo, `2` for a video and `8` for a carousel; other media schemas use the documented type labels.

`has_audio` is a nullable boolean in named media returned by GET `/user/{id}/posts`, GET `/user/{id}/reels`, GET `/media/{shortcode}`, GET `/location/{id}/posts`, GET `/popular/reels` and GET `/audio/{id}`.
It is `null` when the flag is unavailable or is not a boolean. A true flag does not guarantee audible playback.

Refusals contain `status`, `code` and `message`. A malformed input returns `400`; a private post list returns `403 private`.
An empty or unavailable resource can return `404 not_found`, which does not by itself prove that an account is absent.
Unsupported access can return `501 requires_auth`. Temporary failures and rate limits can return `503`; use `Retry-After` when it is present.

## Public examples

Use the [API reference](https://monsterapi.co/docs/api) for ready-made public inputs and response examples.
Read [Examples](https://monsterapi.co/docs/examples) for provenance, preparation costs, task recipes, and pagination stop rules.
