# Instagram Reels API

> List a public Instagram account's reels as JSON, newest first or most viewed, with view, like and comment counts, video URL, duration and audio. 1 credit per page.

**Get the reels of a public Instagram account**, newest first or sorted by views, with play counts, likes, comments, the video URL, duration and the audio each reel uses.

```
GET https://api.klupt.io/v1/users/{user}/reels
GET https://api.klupt.io/v1/audio/{audio}/reels
```

- `GET /v1/users/{user}/reels`: Reels of an account (about 12 a page)
- `GET /v1/audio/{audio}/reels`: Reels that use an audio (see the [Audio API](/docs/instagram-audio-api))

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

## Parameters

| Parameter | In | Description |
|---|---|---|
| `user` | path | Username (`natgeo`) or numeric user id. Private accounts answer `403 private_account` (free). |
| `sort` | query | `recent` (default) or `views` (most viewed first). |
| `cursor` | query | `pagination.next_cursor` from the previous page. |
| `fresh` | query | `true` skips the cache (full price). |

## Response

```json
{{SAMPLE_user_reels}}
```

## Examples

```bash
curl "https://api.klupt.io/v1/users/natgeo/reels?sort=views" -H "X-Api-Key: $KLUPT_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.klupt.io/v1/users/natgeo/reels?sort=views",
                 headers={"X-Api-Key": os.environ["KLUPT_API_KEY"]}, timeout=30)
r.raise_for_status()
top = max(r.json()["data"], key=lambda m: m["counts"]["views"] or 0)
print(top["url"], top["counts"]["views"])
```

```javascript
const res = await fetch("https://api.klupt.io/v1/users/natgeo/reels?sort=views", {
  headers: { "X-Api-Key": process.env.KLUPT_API_KEY },
});
const { data } = await res.json();
console.log(data.map((m) => [m.url, m.counts.views]));
```

## FAQ

### How do I get the view count of Instagram reels with an API?
Call `GET /v1/users/{username}/reels`. Each reel has `counts.views` (plays), `counts.likes` and `counts.comments`. Add `sort=views` to get the most viewed first.

### Can I get the audio used in a reel?
Yes. Each reel carries an `audio` object (id, title, artist). Use the id with `GET /v1/audio/{id}/reels` to find other reels with the same sound.
