# Instagram Highlights API

> List a public Instagram account's story highlights (title, cover, item count) and get every story inside a highlight as JSON. 1 credit per call.

**List the story highlights of a public Instagram account** (title, cover image, number of stories) and **get the stories inside each highlight** with their image or video URLs.

```
GET https://api.handlehaul.com/v1/users/{user}/highlights
GET https://api.handlehaul.com/v1/highlights/{highlight}
```

- `GET /v1/users/{user}/highlights`: Highlights of an account
- `GET /v1/highlights/{highlight}`: The stories inside one highlight

**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. |
| `highlight` | path | Numeric highlight id (from the highlights list). |
| `fresh` | query | `true` skips the cache. |

## Response

```json
{
  "data": [
    {
      "id": "30247747834927280",
      "title": "Travel",
      "item_count": 4,
      "cover_url": "https://scontent.cdninstagram.com/…/hl-3500000000000000123-0.jpg"
    }
  ],
  "pagination": {
    "next_cursor": null,
    "has_more": false,
    "page_size": 5
  },
  "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/highlights" -H "X-Api-Key: $HANDLEHAUL_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.handlehaul.com/v1/users/natgeo/highlights",
                 headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30)
r.raise_for_status()
for hl in r.json()["data"]:
    print(hl["id"], hl["title"], hl["item_count"])
```

```javascript
const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/highlights", {
  headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY },
});
const { data: highlights } = await res.json();
```

```php
$ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/highlights");
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/highlights", 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 download Instagram highlights with an API?
Call `GET /v1/users/{username}/highlights` for the list, then `GET /v1/highlights/{id}` for each highlight: every story has a `video_url` or `thumbnail_url`.
