# Who someone recently followed (API)

> To get who an Instagram account followed most recently, call GET /v1/users/{user}/following. The first page holds the newest follows, position 1 first. Snapshot it daily to date new follows. Code in Python and Node.js.

**Short answer:** call `GET https://api.klupt.io/v1/users/{user}/following`. The Klupt API returns the accounts a public Instagram profile follows in **real newest-first order**: `position: 1` is the account it followed most recently, and the first page holds the newest ~200 follows. One page costs 2 credits (about $2.00 per 1,000 credits), plus 1 the first time we look up a username (send the numeric id to skip it), so checking an account once a day costs well under a cent.

```bash
curl "https://api.klupt.io/v1/users/natgeo/following" \
  -H "X-Api-Key: $KLUPT_API_KEY"
```

```json
{
  "data": [
    { "position": 1, "id": "1234567890", "username": "new_friend", "full_name": "New Friend", "is_private": false, "is_verified": false, "profile_pic_url": "https://…" },
    { "position": 2, "id": "2345678901", "username": "coffee.place", "full_name": "Coffee Place", "is_private": false, "is_verified": true, "profile_pic_url": "https://…" }
  ],
  "pagination": { "next_cursor": "Ym9v…", "has_more": true, "page_size": 200 },
  "meta": { "order": "newest_first", "cached": false, "credits_charged": 2, "credits_remaining": 26941 }
}
```

```php
$ch = curl_init("https://api.klupt.io/v1/users/natgeo/following");
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("KLUPT_API_KEY")],
    CURLOPT_RETURNTRANSFER => true,
]);
$body = json_decode(curl_exec($ch), true);
print_r($body["data"]);
```

```go
req, _ := http.NewRequest("GET", "https://api.klupt.io/v1/users/natgeo/following", nil)
req.Header.Set("X-Api-Key", os.Getenv("KLUPT_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"])
```

## Why the order matters

Instagram's app no longer shows a following list newest first, and shows someone else's followers in a personal order. Most scraping APIs return those lists in that unspecified order, so "the top of the list" says nothing about what is new. The Klupt API labels every list with `meta.order`; with `strict_order=true` you never get anything but `newest_first` (see [Newest-first order](/docs/newest-first-order)).

## Instagram does not share follow dates

No API can tell you the exact time of a follow, because Instagram does not publish it. Two honest ways to date follows:

1. **Order only:** the first rows of the list are the newest. Good for "the last 20 accounts they followed".
2. **Snapshots:** save the first page once a day. Accounts that appear at the top and were not in yesterday's snapshot are that day's new follows.

```python
import json, os, pathlib, requests

USER = "natgeo"
snap = pathlib.Path(f"{USER}-following.json")

r = requests.get(
    f"https://api.klupt.io/v1/users/{USER}/following",
    headers={"X-Api-Key": os.environ["KLUPT_API_KEY"]},
    timeout=30,
)
r.raise_for_status()
today = [row["username"] for row in r.json()["data"]]

before = set(json.loads(snap.read_text())) if snap.exists() else set(today)
new = [u for u in today if u not in before]
print("New follows since last check:", new)
snap.write_text(json.dumps(today))
```

```javascript
import { readFile, writeFile } from "node:fs/promises";

const user = "natgeo";
const res = await fetch(`https://api.klupt.io/v1/users/${user}/following`, {
  headers: { "X-Api-Key": process.env.KLUPT_API_KEY },
});
const { data } = await res.json();
const today = data.map((r) => r.username);
const before = new Set(JSON.parse(await readFile(`${user}.json`, "utf8").catch(() => JSON.stringify(today))));
console.log("New follows:", today.filter((u) => !before.has(u)));
await writeFile(`${user}.json`, JSON.stringify(today));
```

A page can occasionally come back one row short, so never treat a single missing row as an unfollow: confirm on the next check. To read past page one when many new follows arrived, see [Detect new followers and follows](/docs/detect-new-instagram-followers-api); to save the whole list, [Export to CSV](/docs/export-instagram-following-csv).

## From an AI assistant

Connect the [Klupt MCP server](/docs/mcp) to Claude, Cursor, VS Code or Codex and ask *"Who did @natgeo follow most recently?"*. The assistant calls `get_following` and lists the newest follows, at the same price as the REST call.

## FAQ

### How do I see who someone recently followed on Instagram with an API?
Call GET /v1/users/{user}/following on the Klupt API. It returns the public account's following list newest first, so position 1 is the most recent follow. The first page covers the newest ~200 accounts and costs 2 credits.

### Can I get the date someone followed an account?
No API can, because Instagram does not publish follow dates. Save the first page of the list once a day and compare: accounts that are new at the top are that day's follows.

### Does this work for private accounts?
No. The Klupt API covers public accounts only. A private account answers private_account, and that call is free.

### How do I see an account's newest followers instead?
Call GET /v1/users/{user}/followers. It returns followers newest first, 25 a page. See the [Followers API](/docs/instagram-followers-api).
