# Instagram Stories API

> Get a public Instagram account's live stories (last 24 hours) as JSON: image or video URL, time posted and expiry. Look up one story by id. 1 credit per call.

**Get the live stories of a public Instagram account** (the last 24 hours) with image or video URLs, the time each was posted and when it expires. Viewing through the API never shows up in the account's viewer list.

```
GET https://api.handlehaul.com/v1/users/{user}/stories
GET https://api.handlehaul.com/v1/stories/{story}
```

- `GET /v1/users/{user}/stories`: All live stories of an account
- `GET /v1/stories/{story}`: One story by id (expired stories answer `404`)

**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. |
| `story` | path | Numeric story id (from a story URL or a stories list). |
| `fresh` | query | `true` skips the cache. |

## Response

```json
{
  "data": [
    {
      "id": "4169566713557935031",
      "taken_at": "2026-11-28T12:00:00.000Z",
      "expires_at": "2026-11-29T12:00:00.000Z",
      "media_type": "photo",
      "thumbnail_url": "https://scontent.cdninstagram.com/…/4169566713557935031.jpg",
      "video_url": null,
      "duration_seconds": null,
      "owner": {
        "id": "4555656181",
        "username": "sage_sage52",
        "full_name": "Sage Sage",
        "is_private": false,
        "is_verified": false,
        "profile_pic_url": "https://scontent.cdninstagram.com/…/4555656181.jpg"
      }
    }
  ],
  "pagination": {
    "next_cursor": null,
    "has_more": false,
    "page_size": 4
  },
  "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/stories" -H "X-Api-Key: $HANDLEHAUL_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.handlehaul.com/v1/users/natgeo/stories",
                 headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30)
r.raise_for_status()
for s in r.json()["data"]:
    print(s["media_type"], s["taken_at"], s["video_url"] or s["thumbnail_url"])
```

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

```php
$ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/stories");
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/stories", 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

### Does the account see that I viewed their story?
No. Stories are fetched by HandleHaul, not by your Instagram account, so you never appear in the viewer list.

### How fresh are stories?
Stories are cached for 5 minutes. Pass `fresh=true` for a live fetch.
