Tutorial · Instagram · cURL, Python, Node.js, PHP, Go, Ruby

Search Instagram accounts by name or username

Search accounts by name. Complete code for GET /v1/instagram/search/users in six languages and both official SDKs, each tested against the documented response.

Short answer. One call returns accounts that match q, each with id, username, full_name, verified and private flags and a picture. Instagram caps a search at about 40 results.

Facts checked 2 December 2026. Prices change: follow the links before you decide.

Why call it

  • Power account autocomplete in a creator-search or campaign tool.
  • Match brand or creator names from a spreadsheet to Instagram accounts.
  • Let an AI agent find the right account before it calls other routes.

The request

GET https://api.handlehaul.com/v1/instagram/search/users with your key in the X-Api-Key header. Search accounts by name. Up to about 40 results per search. 1 credit a page.

Parameters for Search accounts by name
ParameterInDescription
q requiredquery
cursorquerynext_cursor from the previous page (opaque, sealed).
freshquerytrue skips the cache (full price).

Code in 6 languages

Each sample is a complete program: it reads the key from HANDLEHAUL_API_KEY, waits and retries when the API answers 429 (using Retry-After), stops with the error code on anything else, and follows pagination.next_cursor for up to 3 pages. The SDK versions do the retries for you.

instagram-user-search.sh

# Search accounts by name. --retry waits out a 429 using its Retry-After header;
# --fail exits with code 22 on any other error (drop it to read the error JSON).
# Next page: add --data-urlencode "cursor=<pagination.next_cursor>" (stop when it is null).
curl -sS --fail --retry 3 -G "https://api.handlehaul.com/v1/instagram/search/users" \
  -H "X-Api-Key: $HANDLEHAUL_API_KEY" \
  --data-urlencode "q=natgeo"
Generated from the OpenAPI spec (2026-12-02); every sample was syntax-checked and run against a local mock serving the response below. Language guides: Python, Node.js, PHP, Go, Ruby, cURL.

Response

A list in data, with pagination.next_cursor and has_more, and meta with what the call cost. Example values, from the API docs. Lists are cut to two rows here.

200 · application/json
{
  "data": [
    {
      "id": "787132",
      "username": "natgeo",
      "full_name": "National Geographic",
      "is_private": false,
      "is_verified": true,
      "profile_pic_url": "https://scontent.cdninstagram.com/…"
    }
  ],
  "pagination": {
    "next_cursor": null,
    "has_more": false,
    "page_size": 1
  },
  "meta": {
    "request_id": "req_…",
    "cached": false,
    "cache_age_seconds": 0,
    "credits_charged": 1,
    "credits_remaining": 26944.5
  }
}

Cost, cache and limits

  • 1 credit per page. At $1.40 to $0.80 per 1,000 calls; the samples stop after 3 pages, so one run costs 3 credits at most. Cache hits, failed calls and 429 answers are free; meta.credits_charged says what each call cost.
  • Cache. Answers are cached for 15 minutes. Add fresh=true to force a live call (billed).
  • Speed. Over your plan's requests-per-second limit the API answers 429 rate_limited with Retry-After; the samples wait that long and retry.
  • Testing. A kd_test_ key returns sample data in this exact shape at no cost, so you can run the code before you spend anything.

Things to know

  • About 40 results at most per search: that is Instagram's own cap. Narrow the query for better matches.
  • q takes 1 to 64 characters.
  • Store the id of the account you pick and use it in later calls.

Next steps

Instagram search accounts API: questions

How many results does Instagram user search return?
About 40 at most per search, which is Instagram's own cap. Narrow the query for better matches.
How do I get the user id for an exact Instagram username?
Use GET /v1/instagram/users/by-username/{username}: data.id is the numeric id. Search is for names when you don't know the exact handle.

Run it on real data

One key for Instagram and TikTok. $1.40 to $0.80 per 1,000 calls; failed calls and cache hits are free.

Want to test first? Sandbox keys are free and unlimited, with sample data in the live schema.