# 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.handlehaul.com/v1/users/{user}/reels
GET https://api.handlehaul.com/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 (free from cache). Failed calls and private accounts are free. Naming the account by a username we have to look up adds 1 credit; send the numeric id to skip it ([details](/pricing#usernames-and-ids)).

## Parameters

| Parameter | In | Description |
|---|---|---|
| `user` | path | Numeric user id (cheapest) or username. A username we have to look up costs 1 extra credit ([why](/docs/pricing#usernames-and-ids)). All digits = an id; write `@12345` for an all-digit username. Private accounts answer `403 private_account` (free). |
| `by` | query | Optional. `username` or `id`: says which one `user` is, instead of guessing from the digits. |
| `sort` | query | `recent` (default) or `views` (most viewed first). |
| `cursor` | query | `pagination.next_cursor` from the previous page. |
| `fresh` | query | `true` skips the cache. |

## Response

```json
{
  "data": [
    {
      "id": "8648737465156945468",
      "shortcode": "HgGfObOSsY8",
      "url": "https://www.instagram.com/reel/HgGfObOSsY8/",
      "taken_at": "2026-11-28T11:56:05.000Z",
      "media_type": "reel",
      "caption": "studio aurora · sample post 1",
      "counts": {
        "likes": 1335,
        "comments": 68,
        "views": 7344
      },
      "thumbnail_url": "https://scontent.cdninstagram.com/…/8648737465156945468.jpg",
      "video_url": "https://scontent.cdninstagram.com/…/8648737465156945468.mp4",
      "duration_seconds": 7,
      "owner": {
        "id": "8452629168",
        "username": "aurora.luna30",
        "full_name": "Aurora Luna",
        "is_private": false,
        "is_verified": false,
        "profile_pic_url": "https://scontent.cdninstagram.com/…/8452629168.jpg"
      },
      "location": {
        "id": "588975479",
        "name": "pixel Café"
      },
      "audio": {
        "id": "7902057293122027",
        "title": "ivy mila",
        "artist": "river kai"
      },
      "carousel": null
    }
  ],
  "pagination": {
    "next_cursor": "Ym9v…sealed…",
    "has_more": true,
    "page_size": 12
  },
  "meta": {
    "request_id": "req_…",
    "cached": false,
    "cache_age_seconds": 0,
    "credits_charged": 1,
    "credits_remaining": 26943
  }
}
```

## Examples

```bash
curl "https://api.handlehaul.com/v1/users/natgeo/reels?sort=views" -H "X-Api-Key: $HANDLEHAUL_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.handlehaul.com/v1/users/natgeo/reels?sort=views",
                 headers={"X-Api-Key": os.environ["HANDLEHAUL_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.handlehaul.com/v1/users/natgeo/reels?sort=views", {
  headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY },
});
const { data } = await res.json();
console.log(data.map((m) => [m.url, m.counts.views]));
```

```php
$ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/reels?sort=views");
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("HANDLEHAUL_API_KEY")],
    CURLOPT_RETURNTRANSFER => true,
]);
$body = json_decode(curl_exec($ch), true);
print_r($body["data"]);
```

```go
req, _ := http.NewRequest("GET", "https://api.handlehaul.com/v1/users/natgeo/reels?sort=views", nil)
req.Header.Set("X-Api-Key", os.Getenv("HANDLEHAUL_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer res.Body.Close()
var body map[string]any
json.NewDecoder(res.Body).Decode(&body)
fmt.Println(body["data"])
```

## 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.
