> Documentation index: https://docs.scrapier.io/llms.txt
> Auth: header `X-API-Key: <key>` · Base: https://api.scrapier.io/api/v2 · Synchronous; paginate with `cursor` ← `data.next_cursor`.

# Instagram Profile Search

Search Instagram accounts by keyword and get usernames, names, follower counts and verification status.

`GET|POST https://api.scrapier.io/api/v2/instagram-profile-search/` · 1 credit per successful call · Cursor-paginated

## Overview

Send a keyword in `queries` and get back matching accounts in `profiles`, each with its ID, username, full name, verified flag, follower count, media count and profile URL.

Page on with `cursor`.

## Use cases

- Build a list of creators in a niche.
- Find brand or competitor accounts by name.

## Request

```bash
curl -G "https://api.scrapier.io/api/v2/instagram-profile-search/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "queries=fitness coach" \
  --max-time 210
```

```python
import requests

resp = requests.get(
    "https://api.scrapier.io/api/v2/instagram-profile-search/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"queries": "fitness coach"},
    timeout=210,
)
body = resp.json()
if not resp.ok:
    raise RuntimeError(body.get("error") or body.get("detail"))

print(body["data"]["profiles"])
```

POST with a JSON body works too (same parameters; the body is merged over the query string).

## Parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `X-API-Key` (header) | string | yes | — | Your API key. |
| `queries` | string | yes | e.g. `fitness coach` | Search keyword. Required first call. |
| `cursor` | string | no | — | Pagination cursor returned in the previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When `next_cursor` is null, you have reached the last page. |
| `include_media_count` | boolean | no | `true` | Include each profile's `media_count` in the results. Locked in cursor. |
| `use_proxy` | boolean | no | `true` | Route the request through Scrapier's residential proxy pool. Default: `true`. Leave as is unless support tells you otherwise. |
| `raw_data` | boolean | no | `false` | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under `raw_responses`, in place of the formatted items. When false (default) you get the formatted output. Pagination (`cursor` / `next_cursor`) works the same in both modes. |

## Response

HTTP 200. Results are in `data.profiles`. Sample from the live catalog, arrays trimmed to 3 items.

```json
{
  "success": true,
  "data": {
    "query": "fitness coach",
    "page": 1,
    "profiles": [
      {
        "id": "42116151704",
        "username": "fitness.coach.app",
        "full_name": "FITNESS COACH 🥇",
        "is_verified": false,
        "follower_count": 98277,
        "media_count": 12,
        "url": "https://www.instagram.com/fitness.coach.app/"
      }
    ],
    "next_cursor": "eyJpIjoiZml0bmVzcyBjb2FjaCIsInAiOjIsImUiOjAsInMiOlsiZml0bmVzcy5jb2FjaC5hcHAiXSwibSI6dHJ1ZSwiaCI6ImFiYzEyMyJ9"
  }
}
```

## Response fields

| Field | Type | Example | Description |
|---|---|---|---|
| `query` | string | `fitness coach` |  |
| `page` | integer | `1` |  |
| `profiles` | array | `[1 item]` | The results. |
| `next_cursor` | string | `eyJpIjoiZml0bmVzcyBjb2FjaCIsInAiOjIsImUiOjAsI…` | Pass back as `cursor` for the next page. `null` on the last page. |
| `profiles[].id` | string | `42116151704` |  |
| `profiles[].username` | string | `fitness.coach.app` |  |
| `profiles[].full_name` | string | `FITNESS COACH 🥇` |  |
| `profiles[].is_verified` | boolean | `false` |  |
| `profiles[].follower_count` | integer | `98277` |  |
| `profiles[].media_count` | integer | `12` |  |
| `profiles[].url` | string | `https://www.instagram.com/fitness.coach.app/` |  |

## Pagination

Pass `data.next_cursor` back as `cursor` until it is `null`. Required inputs are ignored once a cursor is sent. Each page is one billed call.

```python
import requests

URL = "https://api.scrapier.io/api/v2/instagram-profile-search/"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
params = {"queries": "fitness coach"}
items = []

for _ in range(10):  # each page is one billed call
    resp = requests.get(URL, headers=HEADERS, params=params, timeout=210)
    resp.raise_for_status()
    data = resp.json()["data"]
    items.extend(data.get("profiles") or [])
    if not data.get("next_cursor"):  # None = last page
        break
    params = {"cursor": data["next_cursor"]}
```

## Errors

Failed calls are free. Branch on HTTP status; the message is in `error` (or `detail`). See https://docs.scrapier.io/errors.md

- **400** Bad input. The exact message varies by endpoint. `{"success":false,"error":"…"}`
- **402** Balance below the endpoint's price. `{"error":"Insufficient credits. Buy more to scrape more.","balance":1,"required":2}`
- **403** Invalid or unknown API key. `{"detail":"Authentication service unavailable or invalid API key."}`
- **429** Throttled — wait for Retry-After. `{"detail":"Request was throttled. Expected available in N seconds."}`
- **404** unknown slug · **503** busy (retry after `Retry-After`) · **5xx** upstream failure or timeout (retry with backoff).

## Notes

- Locked into the cursor: `include_media_count`. Set them on the first call; later pages reuse them.

## Related

- [Instagram Profile](https://docs.scrapier.io/api-reference/instagram/instagram-profile.md): Look up a public Instagram account by username, @handle or URL and get its bio, follower, following and post counts and verification status.
- [Instagram Popular Search](https://docs.scrapier.io/api-reference/instagram/instagram-popular-search.md): Search Instagram by keyword without a login and get top posts and reels, related search terms and the topic's total media count.
