# Get Instagram Profile Data With an API

*Originally published at [scrapingrabbit.com](https://scrapingrabbit.com/blog/instagram-profile-api-tutorial). I built ScrapingRabbit.*


A public Instagram profile holds useful facts: who the account is, how big it is, what it links to. If you vet creators, track competitors or build a dashboard, you want those facts as data and not as a screenshot. This guide shows how to read them with one GET request.

## Request a profile

Send the username without the @ sign. Every call needs an API key. New accounts get 100 free credits and a first key is created automatically on sign-up (it is shown once on the dashboard). Sign in at [scrapingrabbit.com/login](https://scrapingrabbit.com/login), then send the key in the `x-api-key` header (a Bearer token also works). The code below reads it from the `SCRAPINGRABBIT_API_KEY` environment variable, so no key is ever written into your code.

```bash
curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/instagram/profile?username=nasa"
```

Each successful call costs about 5 credits. That is an estimate the team has not measured yet, so see the [pricing page](https://scrapingrabbit.com/pricing) for current numbers.

A shortened real answer:

```json
{
  "success": true,
  "data": {
    "id": "528817151",
    "username": "nasa",
    "fullName": "NASA",
    "bio": "Making the seemingly impossible, possible.",
    "bioLinks": [{ "url": "https://www.nasa.gov", "title": "NASA.gov Homepage" }],
    "verified": true,
    "private": false,
    "followers": 104229235,
    "following": 91,
    "hasReels": true,
    "highlightCount": 6
  }
}
```

The answer also has an `avatar` field with the address of the profile picture.

## What each field means

| Field | Meaning |
| --- | --- |
| `id` | Instagram's own number for the account. It stays the same if the username changes. |
| `username` and `fullName` | The handle and the display name |
| `bio` | The profile text |
| `bioLinks` | A list of links, each with a `url` and a `title` |
| `verified` | `true` for a verified account |
| `private` | `true` for a private account |
| `followers` and `following` | Counts, as numbers |
| `hasReels` | Whether the account has Reels |
| `highlightCount` | How many story highlights the profile shows |

The counts are a snapshot. They were read on 27 November 2026, and they change all the time.

## Read it in code

```javascript
async function instagramProfile(username) {
  const url = `https://api.scrapingrabbit.com/v1/instagram/profile?username=${encodeURIComponent(username)}`;
  const res = await fetch(url, { headers: { "x-api-key": process.env.SCRAPINGRABBIT_API_KEY } });
  const body = await res.json();
  if (!body.success) return null;

  const p = body.data;
  return {
    name: p.fullName || p.username,
    followers: p.followers,
    isPrivate: p.private,
    links: (p.bioLinks ?? []).map((link) => link.url),
  };
}

console.log(await instagramProfile("nasa"));
```

Two details in that code matter. The function returns `null` when `success` is false, so your program can show a message and not crash. And `bioLinks` might be missing, so the code falls back to an empty list.

In Python:

```python
import os
import requests

res = requests.get(
    "https://api.scrapingrabbit.com/v1/instagram/profile",
    params={"username": "nasa"},
    headers={"x-api-key": os.environ["SCRAPINGRABBIT_API_KEY"]},
    timeout=60,
)
body = res.json()
if body["success"]:
    print(body["data"]["followers"])
```

## Add the highlights

The profile says how many highlights there are. To see them, call the highlights endpoint (also about 5 credits per call):

```bash
curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/instagram/highlights?username=nasa"
```

The answer has a `highlights` list. Each item has an `id`, a `title` and a `coverUrl`. There is also a `hasMore` flag, which was `false` for the account in our test. If it is `true`, there are more highlights than the list shows.

## Check a handle first

If you accept usernames from people, check that a name exists before you spend a profile request on it. The username check endpoint (about 5 credits per call too) tells you whether a name is taken and, for a name in use, returns the account's name and follower count. It is a cheap way to avoid asking for a profile that is not there.

## Things to plan for

- **Private accounts.** Check the `private` field before you rely on other data. A private account shows less to the public.
- **Images expire.** The avatar and highlight cover links point to Instagram's image servers. Do not store the link as a permanent address.
- **Rate limits and credits.** Each key is limited per minute: 10 requests on the free plan, 60 on Starter, 120 on Pro and 300 on Scale. Every successful call costs credits, so cache each profile for a while, because the numbers move slowly.
- **Always check `success`.** A failed request has `success` set to `false`, a `code` such as `RATE_LIMITED` or `INVALID_API_KEY`, and a `message`. Failed calls are not charged.

## Try it without code

The free Instagram profile viewer works in the browser with no key and shows these fields for any public profile, and the free highlight viewer lists the highlights with their covers.
