# Instagram Comments API

> Get the comments on a public Instagram post (top or newest), replies to a comment and who liked a comment, as JSON with authors and like counts. 1 credit per page.

**Get the comments on a public Instagram post**, top or newest first, with author, text, time, like count and reply count. Then **read the replies to any comment** and **who liked it**.

```
GET https://api.klupt.io/v1/posts/{post}/comments
GET https://api.klupt.io/v1/comments/{comment}/replies?post=
GET https://api.klupt.io/v1/comments/{comment}/likers
```

- `GET /v1/posts/{post}/comments`: Comments on a post (about 15 a page)
- `GET /v1/comments/{comment}/replies?post=`: Replies to a comment
- `GET /v1/comments/{comment}/likers`: Accounts that liked a comment

**Cost:** 1 credit per successful call (0.5 from cache). Failed calls and private accounts are free.

## Parameters

| Parameter | In | Description |
|---|---|---|
| `post` | path | Post shortcode (`C9xYzAbCdEf`), numeric id, or a URL-encoded instagram.com/p/… or /reel/… link. |
| `sort` | query | comments: `top` (default) or `newest`. |
| `comment` | path | Numeric comment id. |
| `post` | query | replies: the post the comment belongs to (shortcode or id). |
| `cursor` | query | `pagination.next_cursor` from the previous page. |
| `fresh` | query | `true` skips the cache (full price). |

## Response

```json
{{SAMPLE_post_comments}}
```

## Examples

```bash
curl "https://api.klupt.io/v1/posts/C9xYzAbCdEf/comments?sort=newest" -H "X-Api-Key: $KLUPT_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.klupt.io/v1/posts/C9xYzAbCdEf/comments?sort=newest",
                 headers={"X-Api-Key": os.environ["KLUPT_API_KEY"]}, timeout=30)
r.raise_for_status()
for c in r.json()["data"]:
    print(c["author"]["username"], c["text"])
```

```javascript
const res = await fetch("https://api.klupt.io/v1/posts/C9xYzAbCdEf/comments?sort=newest", {
  headers: { "X-Api-Key": process.env.KLUPT_API_KEY },
});
const { data: comments, pagination } = await res.json();
```

## FAQ

### How do I scrape Instagram comments with an API?
Call `GET /v1/posts/{shortcode}/comments` and follow `pagination.next_cursor`. Each comment includes the author, text, time, like count and reply count.
