# Instagram Similar Accounts API

> Get the accounts Instagram suggests as similar to a profile, up to about 80, as JSON. Find lookalike creators and competitors. 1 credit per call.

**Get the accounts Instagram suggests as similar to a profile**: up to about 80 related creators, brands or competitors in one call.

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

- `GET /v1/users/{user}/related`: Accounts similar to this one

**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. |
| `fresh` | query | `true` skips the cache. |

## Response

```json
{
  "data": [
    {
      "id": "7545813283",
      "username": "luna.pixel42",
      "full_name": "Luna Pixel",
      "is_private": false,
      "is_verified": false,
      "profile_pic_url": "https://scontent.cdninstagram.com/…/7545813283.jpg"
    }
  ],
  "pagination": {
    "next_cursor": null,
    "has_more": false,
    "page_size": 30
  },
  "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/related" -H "X-Api-Key: $HANDLEHAUL_API_KEY"
```

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

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

```php
$ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/related");
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/related", 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 find similar Instagram accounts?
Call `GET /v1/users/{username}/related`. It returns the accounts Instagram itself suggests next to that profile.
