> ## Documentation Index
> Fetch the complete documentation index at: https://docs.querying.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Instagram API

> Read public Instagram profiles, recent posts with likes and comment counts, single posts and reels, comments and keyword searches as JSON.

Read public Instagram data as JSON through the async task API. Send `taskType` `SOCIAL` with `platform` `instagram`, and pick what to read with `action`. A completed request costs **0.5 credits**.

## Request

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "SOCIAL", "payload": { "platform": "instagram", "action": "profile", "username": "natgeo" } }'
```

Submit the task, then poll `GET /v1/async/task/{id}` or receive its webhook. See [Async tasks](https://docs.querying.ai/concepts/async-tasks.md).

## Actions

| `action` | Reads | Required |
| - | - | - |
| `search` (default) | Posts and reels for a keyword | `query` |
| `profile` | A public account's profile and its 12 most recent posts | `username` |
| `posts` | The 12 most recent posts of an account, each with its counts | `username` |
| `post` | One post or reel with its first comments | `postUrl` |
| `comments` | A post's comments | `postUrl` |

`username` takes a username or a profile URL. `postUrl` takes a post, reel or IGTV URL, such as `https://www.instagram.com/p/Df147tCiAyB/`.

## Parameters

* `query`: Required for `search`. A keyword, hashtag word or brand name.
* `limit`: Optional. `search` takes 1 to 30, default 10. `posts` takes 1 to 12, default 12. `comments` takes 1 to 500, default 50.

## Response example

```json theme={"theme":"css-variables"}
{
  "platform": "instagram",
  "action": "profile",
  "id": "787132",
  "username": "natgeo",
  "displayName": "National Geographic",
  "biography": "Step into wonder and find your inner explorer with National Geographic.",
  "profileUrl": "https://www.instagram.com/natgeo/",
  "isVerified": true,
  "isPrivate": false,
  "followerCount": 268096466,
  "followingCount": 195,
  "postCount": 32000,
  "hasReels": true,
  "threadsUsername": "natgeo",
  "latestStoryAt": "2026-11-17T15:07:32.000Z",
  "recentPosts": [
    {
      "id": "4032379434794749057",
      "code": "Df147tCiAyB",
      "url": "https://www.instagram.com/p/Df147tCiAyB/",
      "mediaType": "carousel",
      "caption": "National Geographic photographers ventured to places far and wide this year.",
      "imageUrl": "https://scontent.cdninstagram.com/v/t51.82787-15/912032737.jpg"
    }
  ]
}
```

## Result fields

* Every response echoes `platform` and `action`. Lists carry `returnedCount`.
* `profile` returns `id`, `username`, `displayName`, `biography`, `bioLinks`, `avatarUrl`, `profileUrl`, `isVerified`, `isPrivate`, `followerCount`, `followingCount`, `postCount`, `hasReels`, `highlights`, `threadsUsername`, `pronouns` and `recentPosts`. `latestStoryAt` appears while the account has a story up, and `isMemorialized` marks a memorialized account.
* `posts` returns `posts`, the account's 12 most recent posts with `likeCount`, `commentCount` and `publishedAt` read from each post's own page.
* `post` returns `post` and the post's first `comments`. A post has `id`, `code`, `url`, `mediaType` (`image`, `video` or `carousel`), `caption`, `imageUrl`, `images`, `videoUrl`, `width`, `height`, `likeCount`, `commentCount`, `publishedAt`, `username`, `authorFullName`, `authorIsVerified`, `authorProfileImageUrl`, `coauthors`, `taggedUsers`, `topics`, `audio` (the song or the author's original sound), `hasAudio`, `captionIsEdited`, `aiLabel` and `commentsDisabled`.
* `comments` returns `comments`, each with `id`, `text`, `username`, `likeCount`, `replyCount` and `publishedAt`. A GIF comment carries `gifUrl`. `availableCount` is the post's comment count, and `partial: true` marks a list shorter than that count.
* `search` returns `posts` with `position`, the author's `username`, `authorId`, `authorIsVerified` and `authorProfileImageUrl`, and `playCount` on reels. `source` is `instagram` when Instagram has a search page for the keyword, which adds its `title`, `relatedKeywords` and Instagram's own `summary` of the keyword with the `sources` its footnote numbers point to. For other keywords `source` is `web`, and `posts` holds public posts and reels from the last 30 days.
* Instagram shows a signed-out visitor the 12 most recent posts of a profile and about a dozen comments of a post, and `posts`, `post` and `comments` return those. Read `post` for the counts and publish time of a search result.
* An account or post that does not exist, a private post, or a page Instagram shows only to signed-in visitors ends the task with `PAGE_UNAVAILABLE`. Only completed requests are charged.

## Related

* [YouTube](https://docs.querying.ai/engines/youtube.md)
* [Threads](https://docs.querying.ai/engines/threads.md)
* [Engine overview](https://docs.querying.ai/engines/overview.md)
* [Credits and limits](https://docs.querying.ai/concepts/credits-and-limits.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.