# Instagram Followers API

> List a public Instagram account's followers newest first as JSON, 25 per page with cursor pagination. See who followed an account most recently. 1 credit per page.

**List the followers of a public Instagram account, newest first.** `position: 1` is the account's most recent follower. Pages hold up to 25 accounts; page on with the cursor.

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

**Cost:** 1 credit per page of up to 25 accounts (0.5 from cache), about $0.08 per 1,000 rows. Failed calls are free.

## Parameters

| Parameter | In | Description |
|---|---|---|
| `user` | path | Username or numeric user id. Ids save a lookup. |
| `cursor` | query | `pagination.next_cursor` from the previous page. Omit for the first page. |
| `strict_order` | query | `true`: answer `503 order_unavailable` (free) instead of a list whose order is not newest first. |
| `fresh` | query | `true` skips the cache (full price). |

## Response

```json
{
  "data": [
    { "position": 1, "id": "6860189", "username": "new_follower", "full_name": "New Follower", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…" },
    { "position": 2, "id": "3141592", "username": "coffee.place", "full_name": "Coffee Place", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…" }
  ],
  "pagination": { "next_cursor": "kJx1…opaque…Qw", "has_more": true, "page_size": 25 },
  "meta": { "request_id": "req_…", "order": "newest_first", "list_hidden": false, "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26947.5 }
}
```

- `meta.order` is `newest_first`, or `unspecified` on the rare call where only a list in another order was available. Use `strict_order=true` to never receive an unspecified list.
- `meta.list_hidden: true` means the account hides its followers from everyone: the page is empty, the list is not.
- **A page can be one row short.** Now and then one account is missing from a call while the rest stay in order. Never treat an account missing from one call as an unfollow; confirm it over several calls.

## Examples

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

```python
import os, requests
H = {"X-Api-Key": os.environ["KLUPT_API_KEY"]}
url, params, rows = "https://api.klupt.io/v1/users/natgeo/followers", {}, []
for _ in range(4):                       # newest 100 followers
    body = requests.get(url, headers=H, params=params, timeout=30).json()
    rows += body["data"]
    if not body["pagination"]["has_more"]:
        break
    params = {"cursor": body["pagination"]["next_cursor"]}
```

```javascript
let cursor = null, rows = [];
do {
  const url = new URL("https://api.klupt.io/v1/users/natgeo/followers");
  if (cursor) url.searchParams.set("cursor", cursor);
  const body = await (await fetch(url, { headers: { "X-Api-Key": process.env.KLUPT_API_KEY } })).json();
  rows.push(...body.data);
  cursor = body.pagination.next_cursor;
} while (cursor && rows.length < 100);
```

## Errors

| Status | Code | When |
|---|---|---|
| 403 | `private_account` | The account is private (free) |
| 404 | `user_not_found` | No such account (free) |
| 400 | `invalid_cursor` | The cursor is from another endpoint or account |
| 503 | `order_unavailable` | `strict_order=true` and no newest-first list was available (free) |

## FAQ

### How can I see someone's newest Instagram followers with an API?
Call `GET /v1/users/{username}/followers`. The list is newest first: `data[0]` (position 1) is the most recent follower.

### Can the API tell me when someone followed an account?
No. Instagram does not share follow dates with anyone. The API gives the order (newest first), never a follow time.

### How many followers can I get?
As many as the account has, 25 per page. Each page costs 1 credit, so read only as deep as you need: the newest rows are on page one.
