# HandleHaul API documentation URL: https://api.handlehaul.com/docs Give us a handle, we haul back everything. The HandleHaul API returns **public social data as clean JSON**: profiles, followers and following in real **newest-first** order, posts, reels, stories, highlights, comments, likers, hashtags, places, audio and search on Instagram, plus TikTok profiles, videos, followers, comments, transcripts, sounds, hashtags and search. One API key, cursor pagination, and you pay only for successful calls. - Base URL: `https://api.handlehaul.com/v1` - Auth: `X-Api-Key: kd_live_…` header ([Authentication](/docs/authentication)) - Sandbox: `kd_test_…` keys return realistic sample data, unlimited and free ([Sandbox](/docs/sandbox)). Every endpoint page has a **Try it** panel. - Price: **1 credit = 1 successful call**, +1 when we have to look up a username first (send numeric ids to skip it). Credit packs from $29, never expire, from $0.83 per 1,000 calls ([Pricing](/pricing)) - **Public data only.** Private accounts answer `private_account`, free. - AI agents: a hosted **MCP server** at `https://api.handlehaul.com/mcp` for Claude, Cursor, VS Code, Codex and more ([MCP server](/docs/mcp)), plus [llms.txt](/llms.txt) and a drop-in [AGENTS.md](/AGENTS.md) - Building with Lovable, Bolt, Replit, v0, Cursor or Claude Code? Use the ready prompt ([Build with AI tools](/docs/build-with-ai)) ## Quickstart 1. [Create an account](/signup) and confirm your email. Sandbox keys work at once. 2. Accounts that pass our automatic checks (business email, website) get 100 live test calls and can buy the two smaller packs right away. A person reviews the rest within a business day; approval opens the larger packs and more speed. See [account access](/docs/authentication#account-access). 3. Create a key under **API keys** in the dashboard (it is shown once) and call the API: ```bash # Who did @natgeo follow most recently? Newest first. curl "https://api.handlehaul.com/v1/users/natgeo/following" \ -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get( "https://api.handlehaul.com/v1/users/natgeo/followers", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30, ) r.raise_for_status() body = r.json() newest = body["data"][0] # position 1 = most recent follower print(newest["username"], body["meta"]["order"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/posts", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, pagination, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/following"); 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/following", 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"]) ``` ## Endpoints | Endpoint | What it returns | Docs | |---|---|---| | `GET /v1/users/by-username/{username}` | Profile by handle (includes the user id) | [User ID lookup](/docs/instagram-user-id-api) | | `GET /v1/users/{user}` | Profile by handle or id | [Profile API](/docs/instagram-profile-api) | | `GET /v1/users/{user}/followers` | Followers, newest first, 25 a page | [Followers API](/docs/instagram-followers-api) | | `GET /v1/users/{user}/following` | Following, newest first, ~200 a page | [Following API](/docs/instagram-following-api) | | `GET /v1/users/{user}/posts` | Recent posts | [Posts API](/docs/instagram-posts-api) | | `GET /v1/users/{user}/reels` | Reels with views | [Reels API](/docs/instagram-reels-api) | | `GET /v1/users/{user}/stories` · `/highlights` | Live stories and highlights | [Stories API](/docs/instagram-stories-api) | | `GET /v1/posts/{post}` · `/comments` · `/likers` | A post, its comments and likers | [Post API](/docs/instagram-post-api) | | `GET /v1/search/users?q=` | Accounts matching a name | [User search API](/docs/instagram-user-search-api) | | `GET /v1/hashtags/{tag}` · `/v1/places/{place}` · `/v1/audio/{audio}` | Hashtags, places and audio | [Hashtag API](/docs/instagram-hashtag-api) | | `GET /v1/resolve?url=` | Any Instagram link to ids (free) | [URL resolver](/docs/instagram-url-resolver) | | `GET /v1/tiktok/users/{user}` | TikTok profile by handle, id or secUid | [TikTok Profile API](/docs/tiktok-profile-api) | | `GET /v1/tiktok/users/{user}/posts` | TikTok videos and photo posts, newest first | [TikTok Posts API](/docs/tiktok-posts-api) | | `GET /v1/tiktok/users/{user}/followers` · `/following` | TikTok followers and following | [TikTok Followers API](/docs/tiktok-followers-api) | | `GET /v1/tiktok/posts/{post}` · `/comments` · `/transcript` | A TikTok post, its comments and its transcript | [TikTok Post API](/docs/tiktok-post-api) | | `GET /v1/tiktok/music/{music}` · `/v1/tiktok/hashtags/{tag}` | TikTok sounds and hashtags, with their posts | [TikTok Music API](/docs/tiktok-music-api) | | `GET /v1/tiktok/search?q=` | TikTok search: videos, users, sounds | [TikTok Search API](/docs/tiktok-search-api) | | `GET /v1/account` | Your balance, limits and key (free) | [Authentication](/docs/authentication#account-endpoint) | The sidebar lists every endpoint. `{user}` is a numeric id (cheapest) or a handle; all digits = an id, and `@12345` means an all-digit handle. Every success looks like `{ data, pagination?, meta }`, and `meta` always carries `request_id`, `cached`, `credits_charged` and `credits_remaining`. ## Machine-readable files - OpenAPI 3.1: [https://api.handlehaul.com/openapi.json](https://api.handlehaul.com/openapi.json) - For LLMs and agents: [/llms.txt](/llms.txt) and [/llms-full.txt](/llms-full.txt) - MCP server: `https://api.handlehaul.com/mcp`, server card at [/mcp/server-card](/mcp/server-card) ([setup guide](/docs/mcp)) - SDKs: `npm install handlehaul` (JavaScript and TypeScript) and `pip install handlehaul` (Python); see the [Python and JavaScript guide](/docs/instagram-api-python-javascript) - Source on GitHub: [handlehaul-mcp](https://github.com/handlehaul/handlehaul-mcp) (MCP setup), [handlehaul-js](https://github.com/handlehaul/handlehaul-js) (JavaScript and TypeScript SDK) and [handlehaul-python](https://github.com/handlehaul/handlehaul-python) (Python SDK) - Every docs page as Markdown: add `.md` to its URL, for example [/docs/instagram-followers-api.md](/docs/instagram-followers-api.md) ## FAQ ### What does "give us a handle" mean? Send a username (handle) or a numeric id. We return the public profile and everything public around it: followers, following, posts, reels, stories, comments and more. ### Does the HandleHaul API work on private accounts? No. Public data only. Private accounts answer `403 private_account`, and that call is free. ### Can AI agents use it? Yes. The hosted MCP server at https://api.handlehaul.com/mcp works with Claude Code, Claude Desktop, Cursor, VS Code Copilot, Codex, Windsurf and Gemini CLI. Tool calls cost the same as REST calls. See [MCP server](/docs/mcp). ### Do I need a social media login? No. You authenticate with a HandleHaul API key. The accounts you look up are never notified. --- # Authentication and API keys URL: https://api.handlehaul.com/docs/authentication Send your key in the `X-Api-Key` header on every request. Live keys start with `kd_live_`; sandbox keys start with `kd_test_`. ```bash curl "https://api.handlehaul.com/v1/account" -H "X-Api-Key: kd_live_YOUR_KEY" ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/account"); 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/account", 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"]) ``` ## How keys are protected - Each key carries more than 256 bits of randomness. - We store only a keyed hash (HMAC-SHA256 with a server-side secret). The full key is shown **once**, when you create it. The dashboard shows only the first characters. - **Rotate** issues a new key with the same name and settings. The old one stops at once, or after a grace period of up to 7 days so you can deploy the new one. - **Revoke** stops a key within seconds. - **IP allowlist:** limit a key to your servers' addresses or CIDR ranges (IPv4 or IPv6). Calls from anywhere else answer `403 ip_not_allowed`. - **Per-key limits:** give a key a lower requests-per-second limit or a monthly credit cap, for example for a staging server. - Keep keys on your server. Never ship them in a browser, a mobile app or a public repository. A live key sent from a web page still works, but the answer carries `meta.warning` and an `X-HandleHaul-Warning` header. Building with an AI tool? See [Build with AI tools](/docs/build-with-ai). ## Account access The docs, OpenAPI spec and pricing are public. Using the API needs a business account, which moves through these levels: | Level | How you get there | What you can do | |---|---|---| | Email confirmed, in review | You signed up; an automatic check needs a person to look | Unlimited sandbox (`kd_test_`) keys | | Limited | Automatic checks passed (verified business email, website, no blocklist hit) | Sandbox, 1 live key, 2 requests a second, the $29 and $99 packs, 100 live test calls | | Approved | A person reviewed your account (usually within one business day) | Up to 10 live keys, every pack, 10 to 30 requests a second depending on the largest pack you bought ([rate limits](/docs/rate-limits)) | Accounts that break the [acceptable use policy](/docs/acceptable-use) are suspended: every key answers `403 account_suspended` at once. **Live test calls** are spent only after your paid credits, at 1 request a second and up to 5 pages of any list. Going faster gives `429 promo_rate_limited` with `Retry-After` (not charged; wait and retry). Page 5+1 of a list gives `402 promo_limit`. When the test calls run out you get `402 insufficient_credits` with a link to buy a pack. ## Dashboard sign-in The dashboard uses one-time sign-in links sent by email (valid 15 minutes, single use). You can turn on **two-factor authentication** (any authenticator app) under **Settings → Two-factor** in the dashboard; you then get recovery codes to store safely. ## Account endpoint `GET /v1/account` is free and returns your credit balance, rate limits and this key's monthly spend. Use it as a health check for your integration. ```json { "data": { "plan": "payg", "pricing_version": 2, "status": "approved", "credits": { "total": 61480, "paid": 61480, "plan_allowance": 0, "prepaid": 61480, "free_test_calls": 0 }, "limits": { "requests_per_second": 10, "concurrent_requests": 25 }, "key": { "prefix": "kd_live_Ab12Cd", "name": "production", "mode": "live", "monthly_credit_limit": null, "credits_used_this_month": 1240 } }, "meta": { "request_id": "req_…", "credits_charged": 0 } } ``` - `credits.prepaid` is what your packs have left; `free_test_calls` are the live test calls from sign-up. `total` is both together. - `limits` is the speed of the whole account: it comes with the largest pack you have bought. - HandleHaul sells credit packs only, so `plan` is always `"payg"` and `plan_allowance` is always `0`. --- # Sandbox (test keys) URL: https://api.handlehaul.com/docs/sandbox Create a key with mode **Test** in the dashboard. Test keys work as soon as your email is confirmed, even while your account is in review. They start with `kd_test_`, return **realistic sample data in exactly the live schema** (stable cursors, every error case), are **unlimited and free**, and never fetch anything from Instagram. Responses carry `meta.sandbox: true` and the header `X-HandleHaul-Sandbox: true`. No account yet? Every endpoint page in these docs has a **Try it** panel that calls the same sandbox. Use special usernames to test your error handling: | Username | Answer | |---|---| | `private_anything` | `403 private_account` on lists and posts | | `ghost_anything` | `404 user_not_found` | | `hidden_anything` | `200` with an empty list and `meta.list_hidden: true` | | any other valid username | a made-up public account | Sandbox data is deterministic: the same request returns the same answer, so your tests stay stable. Sandbox keys are limited to 2 requests per second. --- # API reference URL: https://api.handlehaul.com/docs/reference Every endpoint of the HandleHaul API on one page: **54 routes**, all `GET`, all under `https://api.handlehaul.com/v1`. Send your key in the `X-Api-Key` header. A successful call costs the credits shown; failed calls, private or missing accounts and cache hits cost nothing. - **Identifiers.** `{user}` is a numeric id or a handle. A handle we have not looked up in the last 7 days adds 1 credit to a list call; ids never do ([Pricing](/pricing#handles-and-ids)). - **Lists** return `data`, `pagination.next_cursor` and `meta`; pass the cursor back to read the next page ([Pagination](/docs/pagination)). - **Errors** use one JSON shape with a stable `code` ([Errors](/docs/errors)). - **Machine-readable:** [OpenAPI 3.1](https://api.handlehaul.com/openapi.json) has every parameter and response schema. ## Instagram ### Users | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/users/by-username/{username}` | Profile by username | 1 | | `GET /v1/users/by-id/{id}` | Profile by user id | 1 | | `GET /v1/users/{user}` | Profile by username or id | 1 | | `GET /v1/users/{user}/followers` | Followers, newest first | 1 | | `GET /v1/users/{user}/following` | Following, newest first | 1 | | `GET /v1/users/{user}/posts` | Recent posts | 1 | | `GET /v1/users/{user}/reels` | Reels of an account, newest first (or most viewed) | 1 | | `GET /v1/users/{user}/tagged` | Posts the account is tagged in | 1 | | `GET /v1/users/{user}/reposts` | Posts the account reposted | 1 | | `GET /v1/users/{user}/stories` | Live stories (last 24 hours) | 1 | | `GET /v1/users/{user}/highlights` | Story highlights of an account | 1 | | `GET /v1/users/{user}/account-details` | When the account joined, its country and username changes | 1 | | `GET /v1/users/{user}/related` | Accounts similar to this one | 1 | ### Search | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/search/users` | Search accounts by name | 1 | | `GET /v1/search/hashtags` | Find hashtags | 1 | | `GET /v1/search/places` | Find places by name or near a point | 1 | | `GET /v1/search/audio` | Find songs and original audio | 1 | ### Posts | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/posts/stats` | Like, comment and view counts for up to 20 posts in one call | 1 | | `GET /v1/posts/{post}` | One post or reel by shortcode, id or URL | 1 | | `GET /v1/posts/{post}/comments` | Comments on a post | 1 | | `GET /v1/posts/{post}/likers` | Accounts that liked a post | 1 | ### Comments | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/comments/{comment}/replies` | Replies to a comment | 1 | | `GET /v1/comments/{comment}/likers` | Accounts that liked a comment | 1 | ### Stories | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/stories/{story}` | One story by id | 1 | ### Highlights | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/highlights/{highlight}` | The stories inside a highlight | 1 | ### Hashtags | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/hashtags/{tag}` | A hashtag and its post count | 1 | | `GET /v1/hashtags/{tag}/posts` | Top posts for a hashtag | 1 | ### Places | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/places/{place}` | A place: name, category, address, contact | 1 | | `GET /v1/places/{place}/posts` | Top or recent posts tagged at a place | 1 | ### Audio | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/audio/trending` | Trending audio on Reels | 1 | | `GET /v1/audio/{audio}` | A song or original audio | 1 | | `GET /v1/audio/{audio}/reels` | Reels that use an audio | 1 | ## TikTok | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/tiktok/users/{user}` | TikTok profile: bio, verified and private flags, follower, following, like and video counts | 1 | | `GET /v1/tiktok/users/{user}/posts` | Videos and photo posts of a TikTok account, newest first | 1 | | `GET /v1/tiktok/users/{user}/reposts` | Videos a TikTok account reposted | 1 | | `GET /v1/tiktok/users/{user}/liked` | Videos a TikTok account liked (when its liked list is public) | 1 | | `GET /v1/tiktok/users/{user}/followers` | Followers of a TikTok account | 1 | | `GET /v1/tiktok/users/{user}/following` | Accounts a TikTok account follows | 1 | | `GET /v1/tiktok/users/{user}/playlists` | Playlists of a TikTok account | 1 | | `GET /v1/tiktok/users/{user}/stories` | Live stories of a TikTok account | 1 | | `GET /v1/tiktok/users/{user}/suggested` | Accounts TikTok suggests alongside this one (one page) | 1 | | `GET /v1/tiktok/posts/{post}` | One TikTok video or photo post by id or URL | 1 | | `GET /v1/tiktok/posts/{post}/comments` | Comments on a TikTok post | 1 | | `GET /v1/tiktok/posts/{post}/transcript` | Transcript of a TikTok video from its auto-captions | 1 | | `GET /v1/tiktok/comments/{comment}/replies` | Replies to a TikTok comment | 1 | | `GET /v1/tiktok/music/{music}` | A TikTok sound: title, artist, duration and how many posts use it | 1 | | `GET /v1/tiktok/music/{music}/posts` | Posts that use a TikTok sound | 1 | | `GET /v1/tiktok/hashtags/{tag}` | A TikTok hashtag with its post and view counts | 1 | | `GET /v1/tiktok/hashtags/{tag}/posts` | Posts under a TikTok hashtag | 1 | | `GET /v1/tiktok/search` | Search TikTok: top videos, users, videos, photo posts, live streams or sounds | 1 | | `GET /v1/tiktok/post/transcript` | Transcript of a TikTok video, by url or id in the query | 1 | ## Account and utilities | Endpoint | What it returns | Credits | |---|---|---| | `GET /v1/resolve` | Instagram URL → type and ids (free) | 0 | | `GET /v1/status` | Service status (no key) | 0 | | `GET /v1/account` | Your balance and limits (free) | 0 | These three need no credits. `/v1/status` needs no key. --- # Build with AI tools URL: https://api.handlehaul.com/docs/build-with-ai You can build on the HandleHaul API without writing the code yourself. Give your AI tool the right file, paste one prompt, and it writes the integration. This page has everything it needs: - **A prompt** for app builders like Lovable, Bolt, Replit and v0 ([below](#the-prompt)) - **`AGENTS.md`**, a file for your repository that coding agents (Cursor, Codex, Copilot, Claude Code) read before they write code: [https://api.handlehaul.com/AGENTS.md](https://api.handlehaul.com/AGENTS.md) - **Every docs page as Markdown** in one file: [https://api.handlehaul.com/llms-full.txt](https://api.handlehaul.com/llms-full.txt), plus an index at [/llms.txt](https://api.handlehaul.com/llms.txt). Every page also has a `.md` version, and docs URLs answer in Markdown when a tool asks for `text/markdown`. - **The OpenAPI 3.1 spec**, for typed clients and code generators: [https://api.handlehaul.com/openapi.json](https://api.handlehaul.com/openapi.json) - **The MCP server**, if you want your assistant to call the API itself while you chat: [MCP server](/docs/mcp) ## Rule one: the key stays on the server Your `kd_live_` key spends your credits. **Anything that runs in the browser is public**: anyone can open the page, find the key in a minute and use your balance. AI app builders often put API calls straight into the page unless you tell them not to. So every app needs one small piece of server code between your page and the HandleHaul API: | Your page (public) | Your server code (private) | HandleHaul API | |---|---|---| | Asks your server: "following of natgeo" | Checks the request, adds `X-Api-Key` from a secret | Answers with JSON | Where that server code lives depends on the tool: | Tool | Server code | Where the key goes | |---|---|---| | Lovable | A Supabase Edge Function (or Lovable Cloud) | Secrets, named `HANDLEHAUL_API_KEY` | | Bolt | A Supabase Edge Function, or a server route in the project | Secrets or environment variables | | Replit | A small Express or Flask backend in the Repl | Secrets tool (`HANDLEHAUL_API_KEY`) | | v0 / Next.js | A route handler, for example `app/api/handlehaul/route.ts` | Environment variable in your Vercel project | | Your own repo (Cursor, Claude Code, Codex) | Your existing backend | `.env` file, never committed | **We help you notice.** If a live key is sent from a web page (the request carries a browser `Origin` header), the answer still works, but it carries `meta.warning` and an `X-HandleHaul-Warning` header telling you to move the call to your server. Test keys never get the warning. Two more guards, both in the dashboard under **API keys**: - **IP allowlist:** limit the live key to your server's addresses. A leaked key then answers `403 ip_not_allowed` everywhere else. - **Monthly credit cap per key:** the most a key can ever spend in a month. ## Start with a test key Create a **Test** key first (it starts with `kd_test_`). It returns realistic sample data in the exact live schema, costs nothing and never calls Instagram ([Sandbox](/docs/sandbox)). Let the AI build and debug the whole app on the test key, then swap in a live key as the secret when it works. Nothing else changes. ## The prompt Paste this into Lovable, Bolt, Replit, v0 or any coding agent. Change the first line to what you want to build. ```text Build: . Use the HandleHaul API for the Instagram data. - Docs for AI (read first): https://api.handlehaul.com/llms-full.txt - OpenAPI spec: https://api.handlehaul.com/openapi.json - Base URL: https://api.handlehaul.com/v1 - Auth: header X-Api-Key with the key from a server-side secret named HANDLEHAUL_API_KEY. Rules: 1. Never call https://api.handlehaul.com/v1 from browser code and never put the key in frontend code, the repo or logs. Create a server function (Supabase Edge Function, API route or backend endpoint) that adds the X-Api-Key header and calls HandleHaul. The page only calls that function. 2. The server function only allows the endpoints this app needs and checks the input (Instagram usernames match ^[A-Za-z0-9._]{1,30}$). It is not an open proxy. 3. Lists are paged: pass pagination.next_cursor back as ?cursor= for the next page, stop when it is null. Each page costs credits, so only fetch the pages the app shows. 4. followers and following are newest first: position 1 is the most recent follow. 5. Errors come as {"error": {"code", "message"}}. Show a friendly message for private_account, user_not_found, insufficient_credits and rate_limited (wait for the Retry-After header). Failed calls are free. 6. Send the numeric user id instead of the username when you have it: a username lookup costs 1 extra credit. 7. I will start with a kd_test_ key (sample data, free). Do not hard-code sample usernames or data from it. ``` ## Server code examples If your tool asks how the server part should look, these are the shapes to aim for. Both only allow the following list and check the username first. A **Supabase Edge Function** (Lovable, Bolt). Set the secret with `supabase secrets set HANDLEHAUL_API_KEY=kd_test_…` or in the Supabase dashboard, then call it from the page with `supabase.functions.invoke("handlehaul-following", { body: { username } })`: ```typescript // supabase/functions/handlehaul-following/index.ts const cors = { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "authorization, x-client-info, apikey, content-type", }; Deno.serve(async (req) => { if (req.method === "OPTIONS") return new Response("ok", { headers: cors }); const { username } = await req.json(); if (typeof username !== "string" || !/^[A-Za-z0-9._]{1,30}$/.test(username)) { return Response.json({ error: "Invalid username" }, { status: 400, headers: cors }); } const r = await fetch(`https://api.handlehaul.com/v1/users/${username}/following`, { headers: { "X-Api-Key": Deno.env.get("HANDLEHAUL_API_KEY")! }, }); return new Response(await r.text(), { status: r.status, headers: { ...cors, "Content-Type": "application/json" }, }); }); ``` A **Next.js route handler** (v0, Vercel, your own Next.js app). Add `HANDLEHAUL_API_KEY` under the project's environment variables; the page calls `/api/handlehaul/following?username=natgeo`: ```typescript // app/api/handlehaul/following/route.ts export async function GET(req: Request) { const username = new URL(req.url).searchParams.get("username") ?? ""; if (!/^[A-Za-z0-9._]{1,30}$/.test(username)) { return Response.json({ error: "Invalid username" }, { status: 400 }); } const r = await fetch(`https://api.handlehaul.com/v1/users/${username}/following`, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY! }, cache: "no-store", }); return Response.json(await r.json(), { status: r.status }); } ``` If the app is public, add your own sign-in or a per-visitor limit in front of these functions too: otherwise strangers can spend your credits through your app. ## Coding agents in your repository Cursor, Claude Code, Codex, GitHub Copilot and Windsurf work best with the docs in the repository itself. Save our `AGENTS.md` next to your code: ```bash curl -o AGENTS.md https://api.handlehaul.com/AGENTS.md ``` Already have an `AGENTS.md`? Save ours as `docs/handlehaul-api.md` and add one line to yours: `HandleHaul API rules: see docs/handlehaul-api.md`. **Claude Code** reads `CLAUDE.md`: add the line `@AGENTS.md` (or `@docs/handlehaul-api.md`) to it. The file holds the base URL, auth, the key rules above, every endpoint with its price, pagination, errors and the sandbox, so the agent does not have to guess. Then ask for what you want, for example *"Add a nightly job that saves who @natgeo followed since yesterday, using the HandleHaul API as described in AGENTS.md."* To give the agent the full reference in a single chat, paste the link `https://api.handlehaul.com/llms-full.txt` or the `.md` URL of one page (every docs page has **Copy page** and **Open in ChatGPT / Claude** at the top). ## Check what the AI built Before you go live, check these five things (or ask the AI to check them for you): 1. Search the built site for `kd_live_` and `kd_test_`: no match in any file the browser loads. In the browser's developer tools, the Network tab shows no request to `api.handlehaul.com`. 2. The key comes from a secret or environment variable, not a string in the code, and `.env` is in `.gitignore`. 3. The server function refuses endpoints the app does not use and bad usernames. 4. The app stops at `next_cursor: null` and does not loop through every page on each visit. 5. Errors show a message, not a blank page: try `private_anything` and `ghost_anything` with your test key ([Sandbox](/docs/sandbox)). ## FAQ ### Can I use the HandleHaul API with Lovable, Bolt, Replit or v0? Yes. Paste the prompt above, keep the key in the tool's secrets, and let the tool write a small server function (a Supabase Edge Function in Lovable or Bolt, a backend in Replit, a route handler in v0) that calls the API. ### Why can't my page call the API directly? It can technically, because the API allows browser requests for quick tests. But the key would be visible to every visitor, who could then spend your credits. Live keys sent from a web page get a `meta.warning` for that reason. Use a test key for in-browser experiments and a server function for real use. ### Which file should I give my AI tool? `https://api.handlehaul.com/llms-full.txt` for a chat, `https://api.handlehaul.com/AGENTS.md` for a repository, `https://api.handlehaul.com/openapi.json` for a code generator. The [MCP server](/docs/mcp) is for asking an assistant questions about Instagram accounts directly, not for building an app. ### Is there an SDK? Yes: `npm install handlehaul` for JavaScript and TypeScript and `pip install handlehaul` for Python ([guide](/docs/instagram-api-python-javascript); source: [handlehaul-js](https://github.com/handlehaul/handlehaul-js) and [handlehaul-python](https://github.com/handlehaul/handlehaul-python)). The API is also plain HTTPS and JSON with one header, so a few lines of `fetch` or `requests` work just as well, and the [OpenAPI spec](https://api.handlehaul.com/openapi.json) generates a typed client in any language. --- # Instagram User ID Lookup API URL: https://api.handlehaul.com/docs/instagram-user-id-api **Turn an Instagram username into its numeric user id** with one call. You get the id together with the full public profile (name, bio, counts, picture). Ids never change when an account renames itself, so store the id and use it in later calls, for example with [profile by id](/docs/instagram-profile-api). ``` GET https://api.handlehaul.com/v1/users/by-username/{username} ``` **Cost:** 1 credit per successful call (free if served from cache). Failed calls are free. ## Parameters | Parameter | In | Description | |---|---|---| | `username` | path | Instagram username, with or without `@`. Letters, digits, `.` and `_`, up to 30 characters. Always read as a username, even if it is all digits. | | `fresh` | query | `true` skips the cache and fetches live (full price). | ## Response ```json { "data": { "id": "25025320", "username": "instagram", "full_name": "Instagram", "is_private": false, "is_verified": true, "profile_pic_url": "https://scontent.cdninstagram.com/…/profile.jpg", "biography": "Bringing you closer to the people and things you love.", "external_url": "https://about.instagram.com", "category": "Product/service", "is_business": true, "profile_pic_url_hd": "https://scontent.cdninstagram.com/…", "counts": { "followers": 690000000, "following": 180, "posts": 7900 } }, "meta": { "request_id": "req_8Hn2…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26949 } } ``` `id` is a string because Instagram ids can be larger than 2^53. ## Examples ```bash curl "https://api.handlehaul.com/v1/users/by-username/instagram" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/by-username/instagram", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) user_id = r.json()["data"]["id"] ``` ```javascript const r = await fetch("https://api.handlehaul.com/v1/users/by-username/instagram", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data } = await r.json(); console.log(data.id); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/by-username/instagram"); 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/by-username/instagram", 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"]) ``` ## Errors | Status | Code | When | |---|---|---| | 404 | `user_not_found` | No account with that username (free) | | 400 | `invalid_request` | The username has characters Instagram does not allow | See all [error codes](/docs/errors). ## FAQ ### How do I find an Instagram user id from a username? Call `GET /v1/users/by-username/{username}` with your API key. The `data.id` field is the numeric Instagram user id. ### Does the user id change when someone changes their username? No. The numeric id stays the same for the life of the account, which is why it is the best key to store. --- # Instagram Profile API URL: https://api.handlehaul.com/docs/instagram-profile-api **Get a public Instagram profile as JSON**: bio, website, category, verified status, HD profile picture, and follower, following and post counts. ``` GET https://api.handlehaul.com/v1/users/by-username/{username} GET https://api.handlehaul.com/v1/users/by-id/{id} GET https://api.handlehaul.com/v1/users/{user} # username or id ``` All three return the same profile. Use **by-id** when you stored ids (ids survive renames), **by-username** when you have a handle, and `{user}` when you accept either. **Cost:** 1 credit per successful call (free from cache). Profiles are cached for 60 seconds. ## Parameters | Parameter | In | Description | |---|---|---| | `username` | path | by-username: an Instagram username (`natgeo`), always read as a username. | | `id` | path | by-id: a numeric Instagram user id (`787132`). | | `user` | path | `{user}` route: a username or a numeric id. All digits = an id; write `@12345` (or add `by=username`) for an all-digit username. No lookup credit here: the lookup is the call. | | `fresh` | query | `true` skips the cache. Same as the header `Cache-Control: no-cache`. | ## Response ```json { "data": { "id": "787132", "username": "natgeo", "full_name": "National Geographic", "is_private": false, "is_verified": true, "profile_pic_url": "https://scontent.cdninstagram.com/…", "biography": "Experience the world through the eyes of our photographers.", "external_url": "https://www.nationalgeographic.com", "category": "Media/news company", "is_business": true, "profile_pic_url_hd": "https://scontent.cdninstagram.com/…", "counts": { "followers": 280000000, "following": 160, "posts": 30500 } }, "meta": { "request_id": "req_Zt0q…", "cached": true, "cache_age_seconds": 141, "credits_charged": 0.5, "credits_remaining": 26948.5 } } ``` Private accounts return their public profile fields with `is_private: true`; their lists and posts are not available. ## Examples ```bash curl "https://api.handlehaul.com/v1/users/by-username/natgeo" -H "X-Api-Key: $HANDLEHAUL_API_KEY" curl "https://api.handlehaul.com/v1/users/by-id/787132" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests p = requests.get("https://api.handlehaul.com/v1/users/natgeo", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30).json()["data"] print(p["counts"]["followers"]) ``` ```javascript const { data } = await (await fetch("https://api.handlehaul.com/v1/users/natgeo", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, })).json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/by-username/natgeo"); 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/by-username/natgeo", 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 get someone's Instagram follower count with an API? Call `GET /v1/users/by-username/{username}`. The follower count is in `data.counts.followers`, next to `following` and `posts`. ### How fresh is the profile data? Answers are cached for 60 seconds (a cached answer is free) and `meta.cache_age_seconds` tells you the age. Pass `fresh=true` for a live fetch. ### Can I get an Instagram profile by user id? Yes: `GET /v1/users/by-id/{id}` returns the same profile for a numeric user id. --- # Instagram Followers API URL: https://api.handlehaul.com/docs/instagram-followers-api **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.handlehaul.com/v1/users/{user}/followers ``` **Cost:** 1 credit per page of up to 25 accounts (free from cache), about $0.058 to $0.033 per 1,000 rows. Failed calls 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. | | `by` | query | Optional. `username` or `id`: says which one `user` is, instead of guessing from the digits. | | `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. | ## 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.handlehaul.com/v1/users/natgeo/followers" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests H = {"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]} url, params, rows = "https://api.handlehaul.com/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.handlehaul.com/v1/users/natgeo/followers"); if (cursor) url.searchParams.set("cursor", cursor); const body = await (await fetch(url, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY } })).json(); rows.push(...body.data); cursor = body.pagination.next_cursor; } while (cursor && rows.length < 100); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/followers"); 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/followers", 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"]) ``` ## 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. --- # Instagram Following API URL: https://api.handlehaul.com/docs/instagram-following-api **List the accounts a public Instagram profile follows, newest first**: see who it followed most recently. Pages hold about 200 accounts, so one call usually covers weeks of new follows. ``` GET https://api.handlehaul.com/v1/users/{user}/following ``` **Cost:** 1 credit per page of up to about 200 accounts (free from cache), about $0.007 to $0.004 per 1,000 rows. Failed calls 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)). Since Instagram's September 2026 update, the following list in the app is no longer shown newest first. This endpoint returns it in real reverse-chronological order and says so in `meta.order`. ## 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. | | `by` | query | Optional. `username` or `id`: says which one `user` is, instead of guessing from the digits. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `strict_order` | query | `true`: refuse (free) rather than return a list that is not newest first. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "position": 1, "id": "6860189", "username": "new_friend", "full_name": "New Friend", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…" } ], "pagination": { "next_cursor": "Qm9v…opaque…", "has_more": true, "page_size": 200 }, "meta": { "request_id": "req_…", "order": "newest_first", "list_hidden": false, "cached": false, "cache_age_seconds": 0, "credits_charged": 2, "credits_remaining": 26945.5 } } ``` A page can occasionally be one row short; never report a missing row as an unfollow on its own. See [newest-first order](/docs/newest-first-order). ## Examples ```bash curl "https://api.handlehaul.com/v1/users/natgeo/following" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/natgeo/following", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) for row in r.json()["data"][:10]: print(row["position"], row["username"]) ``` ```javascript const body = await (await fetch("https://api.handlehaul.com/v1/users/natgeo/following", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, })).json(); const latest = body.data.slice(0, 10).map((u) => u.username); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/following"); 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/following", 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 see who someone recently followed on Instagram with an API? Call `GET /v1/users/{username}/following`. The list is newest first, so the first rows are the accounts they followed most recently. ### Why is Instagram's own following list not in order any more? Instagram changed the in-app order in September 2026. The HandleHaul API still returns Instagram's real reverse-chronological order and labels each response with `meta.order`. ### How do I detect new follows over time? Call the endpoint on a schedule and compare the top of the list with your last result. Treat an account as unfollowed only after it is missing from several calls in a row. Code: [Detect new followers and follows](/docs/detect-new-instagram-followers-api). --- # Instagram Posts API URL: https://api.handlehaul.com/docs/instagram-posts-api **Get a public account's recent posts**, newest first: link, date, type (photo, video or carousel), caption, and like, comment and view counts. ``` GET https://api.handlehaul.com/v1/users/{user}/posts ``` **Cost:** 1 credit per page (free from cache). About 12 posts a page. 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. | | `by` | query | Optional. `username` or `id`: says which one `user` is, instead of guessing from the digits. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "3500000000000000001", "shortcode": "C9xYzAbCdEf", "url": "https://www.instagram.com/p/C9xYzAbCdEf/", "taken_at": "2026-11-27T18:04:11.000Z", "media_type": "carousel", "caption": "Weekend dump", "counts": { "likes": 1204, "comments": 37, "views": null }, "thumbnail_url": "https://scontent.cdninstagram.com/…" } ], "pagination": { "next_cursor": null, "has_more": false, "page_size": 12 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26945.5 } } ``` `counts.views` is set for videos and `null` otherwise. A count Instagram hides comes back as `null`. ## Examples ```bash curl "https://api.handlehaul.com/v1/users/natgeo/posts" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests posts = requests.get("https://api.handlehaul.com/v1/users/natgeo/posts", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30).json()["data"] avg_likes = sum(p["counts"]["likes"] or 0 for p in posts) / max(len(posts), 1) ``` ```javascript const { data: posts } = await (await fetch("https://api.handlehaul.com/v1/users/natgeo/posts", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, })).json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/posts"); 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/posts", 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 get an Instagram account's latest posts with an API? Call `GET /v1/users/{username}/posts`. Posts come newest first with URL, date, caption and engagement counts. --- # Instagram User Search API URL: https://api.handlehaul.com/docs/instagram-user-search-api **Find Instagram accounts by name or username.** Returns matching users (id, username, name, verified and private flags, picture). Instagram caps a search at about 40 results. ``` GET https://api.handlehaul.com/v1/search/users?q={query} ``` **Cost:** 1 credit per page (free from cache). ## Parameters | Parameter | In | Description | |---|---|---| | `q` | query | What to search for, 1 to 64 characters. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```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 } } ``` ## Examples ```bash curl -G "https://api.handlehaul.com/v1/search/users" --data-urlencode "q=national geographic" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests users = requests.get("https://api.handlehaul.com/v1/search/users", params={"q": "coffee roasters"}, headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30).json()["data"] ``` ```javascript const url = new URL("https://api.handlehaul.com/v1/search/users"); url.searchParams.set("q", "coffee roasters"); const { data } = await (await fetch(url, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY } })).json(); ``` ## FAQ ### 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. --- # Instagram Reels API URL: https://api.handlehaul.com/docs/instagram-reels-api **Get the reels of a public Instagram account**, newest first or sorted by views, with play counts, likes, comments, the video URL, duration and the audio each reel uses. ``` GET https://api.handlehaul.com/v1/users/{user}/reels GET https://api.handlehaul.com/v1/audio/{audio}/reels ``` - `GET /v1/users/{user}/reels`: Reels of an account (about 12 a page) - `GET /v1/audio/{audio}/reels`: Reels that use an audio (see the [Audio API](/docs/instagram-audio-api)) **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. | | `sort` | query | `recent` (default) or `views` (most viewed first). | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "8648737465156945468", "shortcode": "HgGfObOSsY8", "url": "https://www.instagram.com/reel/HgGfObOSsY8/", "taken_at": "2026-11-28T11:56:05.000Z", "media_type": "reel", "caption": "studio aurora · sample post 1", "counts": { "likes": 1335, "comments": 68, "views": 7344 }, "thumbnail_url": "https://scontent.cdninstagram.com/…/8648737465156945468.jpg", "video_url": "https://scontent.cdninstagram.com/…/8648737465156945468.mp4", "duration_seconds": 7, "owner": { "id": "8452629168", "username": "aurora.luna30", "full_name": "Aurora Luna", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…/8452629168.jpg" }, "location": { "id": "588975479", "name": "pixel Café" }, "audio": { "id": "7902057293122027", "title": "ivy mila", "artist": "river kai" }, "carousel": null } ], "pagination": { "next_cursor": "Ym9v…sealed…", "has_more": true, "page_size": 12 }, "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/reels?sort=views" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/natgeo/reels?sort=views", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() top = max(r.json()["data"], key=lambda m: m["counts"]["views"] or 0) print(top["url"], top["counts"]["views"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/reels?sort=views", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data } = await res.json(); console.log(data.map((m) => [m.url, m.counts.views])); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/reels?sort=views"); 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/reels?sort=views", 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 get the view count of Instagram reels with an API? Call `GET /v1/users/{username}/reels`. Each reel has `counts.views` (plays), `counts.likes` and `counts.comments`. Add `sort=views` to get the most viewed first. ### Can I get the audio used in a reel? Yes. Each reel carries an `audio` object (id, title, artist). Use the id with `GET /v1/audio/{id}/reels` to find other reels with the same sound. --- # Instagram Stories API URL: https://api.handlehaul.com/docs/instagram-stories-api **Get the live stories of a public Instagram account** (the last 24 hours) with image or video URLs, the time each was posted and when it expires. Viewing through the API never shows up in the account's viewer list. ``` GET https://api.handlehaul.com/v1/users/{user}/stories GET https://api.handlehaul.com/v1/stories/{story} ``` - `GET /v1/users/{user}/stories`: All live stories of an account - `GET /v1/stories/{story}`: One story by id (expired stories answer `404`) **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. | | `story` | path | Numeric story id (from a story URL or a stories list). | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "4169566713557935031", "taken_at": "2026-11-28T12:00:00.000Z", "expires_at": "2026-11-29T12:00:00.000Z", "media_type": "photo", "thumbnail_url": "https://scontent.cdninstagram.com/…/4169566713557935031.jpg", "video_url": null, "duration_seconds": null, "owner": { "id": "4555656181", "username": "sage_sage52", "full_name": "Sage Sage", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…/4555656181.jpg" } } ], "pagination": { "next_cursor": null, "has_more": false, "page_size": 4 }, "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/stories" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/natgeo/stories", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() for s in r.json()["data"]: print(s["media_type"], s["taken_at"], s["video_url"] or s["thumbnail_url"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/stories", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: stories } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/stories"); 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/stories", 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 ### Does the account see that I viewed their story? No. Stories are fetched by HandleHaul, not by your Instagram account, so you never appear in the viewer list. ### How fresh are stories? Stories are cached for 5 minutes. Pass `fresh=true` for a live fetch. --- # Instagram Graph API vs third-party data APIs URL: https://api.handlehaul.com/docs/instagram-graph-api-vs-data-api **Short answer:** the official Instagram Graph API is built for managing **your own** professional accounts (publishing, comments, messages, insights). It does **not** return the followers or following list of another account, and even for your own account it gives the follower *count* and audience insights, not the list of usernames. Third-party data APIs such as the HandleHaul API read **public** data for any public account, including its followers and following lists, newest first. > **Definition:** the *Instagram Graph API* (the Instagram Platform) is Meta's official API for Business and Creator accounts that have authorized your app. A *third-party Instagram data API* is an independent service, not affiliated with Meta, that returns publicly visible Instagram data for any public account through its own API key. ## Side by side | | Instagram Graph API (official) | HandleHaul API (third-party data API) | |---|---|---| | Whose data | Professional accounts that authorized your app; basic public fields of other Business and Creator accounts | Any public account | | Another account's followers list | No | Yes, newest first, 25 a page | | Another account's following list | No | Yes, newest first, about 200 a page | | Your own followers list | No (count and audience insights only) | Yes, if the account is public | | Profiles, posts and reels of other accounts | Business and Creator accounts only, basic fields | Any public account | | Stories, highlights, comments, likers of other accounts | No | Yes, public ones | | Publish posts, reply to comments, send messages | Yes | No (read-only) | | Private accounts | Only your own, once authorized | No | | What you need | Meta developer app, professional account, permissions (App Review for most) | One API key | | Price | No per-call fee; rate limited | $1.45 to $0.83 per 1,000 successful calls; failed and cached calls are not billed | ## When to use which - **Use the Graph API** to run your own or your clients' accounts: schedule posts, moderate comments, answer messages, read insights. Only the official API can write to Instagram. - **Use a data API** to read public data about accounts you do not manage: who a creator followed recently, a competitor's newest followers, the posts under a hashtag, the reels using a sound. - Many products use **both**: the Graph API for the accounts their customers connect, and a data API for everyone else. ## The call the Graph API can't make Who did a public account follow most recently? With the HandleHaul API it is one request: ```bash curl "https://api.handlehaul.com/v1/users/natgeo/following" \ -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/natgeo/following", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) for row in r.json()["data"][:10]: print(row["position"], row["username"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/following", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); console.log(meta.order, data.slice(0, 10).map((r) => r.username)); // "newest_first" ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/following"); 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/following", 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"]) ``` No Instagram login, no Meta app and no App Review: the account you look up is never notified. See the [Following API](/docs/instagram-following-api) and [Followers API](/docs/instagram-followers-api). ## What a data API can't do either - **Private accounts:** only the account owner and approved followers can see them. The HandleHaul API answers `403 private_account` (not billed). - **Follow dates:** Instagram does not publish when a follow happened, to anyone. The HandleHaul API gives the order (newest first), never a guessed date ([Newest-first order](/docs/newest-first-order)). - **Writing:** a data API cannot post, like, follow or send messages. Use data APIs for legitimate work on public data: read our [acceptable-use policy](/docs/acceptable-use). ## FAQ ### Can the Instagram Graph API get the followers list of an account? No. The official Graph API returns follower counts and audience insights for professional accounts that authorized your app, but not the list of followers, and nothing for accounts you do not manage beyond basic fields of Business and Creator accounts. A third-party data API such as the HandleHaul API returns the followers list of any public account, newest first. ### Can the official Instagram API show who someone follows? No. No official endpoint returns another account's following list. The HandleHaul API does, with GET /v1/users/{user}/following, newest first. ### Is the Instagram Basic Display API still available? No. Meta shut down the Basic Display API on December 4, 2024. The official option today is the Graph API for professional accounts. ### Is a third-party Instagram data API official? No. Third-party data APIs are independent services, not affiliated with Meta. The HandleHaul API covers public accounts and publicly visible data only, and its [acceptable-use policy](/docs/acceptable-use) rules out stalking, harassment and reselling personal data. ### Which should I use for a follower tracking app? A data API. A follow tracker needs other accounts' following and followers lists in order, which the Graph API does not return. See [Build a follow tracker app](/docs/instagram-follower-tracker-api). --- # Instagram Highlights API URL: https://api.handlehaul.com/docs/instagram-highlights-api **List the story highlights of a public Instagram account** (title, cover image, number of stories) and **get the stories inside each highlight** with their image or video URLs. ``` GET https://api.handlehaul.com/v1/users/{user}/highlights GET https://api.handlehaul.com/v1/highlights/{highlight} ``` - `GET /v1/users/{user}/highlights`: Highlights of an account - `GET /v1/highlights/{highlight}`: The stories inside one highlight **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. | | `highlight` | path | Numeric highlight id (from the highlights list). | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "30247747834927280", "title": "Travel", "item_count": 4, "cover_url": "https://scontent.cdninstagram.com/…/hl-3500000000000000123-0.jpg" } ], "pagination": { "next_cursor": null, "has_more": false, "page_size": 5 }, "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/highlights" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/natgeo/highlights", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() for hl in r.json()["data"]: print(hl["id"], hl["title"], hl["item_count"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/highlights", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: highlights } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/highlights"); 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/highlights", 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 download Instagram highlights with an API? Call `GET /v1/users/{username}/highlights` for the list, then `GET /v1/highlights/{id}` for each highlight: every story has a `video_url` or `thumbnail_url`. --- # Who someone recently followed (API) URL: https://api.handlehaul.com/docs/who-someone-recently-followed-api **Short answer:** call `GET https://api.handlehaul.com/v1/users/{user}/following`. The HandleHaul API returns the accounts a public Instagram profile follows in **real newest-first order**: `position: 1` is the account it followed most recently, and the first page holds the newest ~200 follows. One page costs 1 credit (about $1.45 to $0.83 per 1,000 credits), plus 1 the first time we look up a username (send the numeric id to skip it), so checking an account once a day costs well under a cent. ```bash curl "https://api.handlehaul.com/v1/users/natgeo/following" \ -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```json { "data": [ { "position": 1, "id": "1234567890", "username": "new_friend", "full_name": "New Friend", "is_private": false, "is_verified": false, "profile_pic_url": "https://…" }, { "position": 2, "id": "2345678901", "username": "coffee.place", "full_name": "Coffee Place", "is_private": false, "is_verified": true, "profile_pic_url": "https://…" } ], "pagination": { "next_cursor": "Ym9v…", "has_more": true, "page_size": 200 }, "meta": { "order": "newest_first", "cached": false, "credits_charged": 2, "credits_remaining": 26941 } } ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/following"); 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/following", 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"]) ``` ## Why the order matters Instagram's app no longer shows a following list newest first, and shows someone else's followers in a personal order. Most scraping APIs return those lists in that unspecified order, so "the top of the list" says nothing about what is new. The HandleHaul API labels every list with `meta.order`; with `strict_order=true` you never get anything but `newest_first` (see [Newest-first order](/docs/newest-first-order)). ## Instagram does not share follow dates No API can tell you the exact time of a follow, because Instagram does not publish it. Two honest ways to date follows: 1. **Order only:** the first rows of the list are the newest. Good for "the last 20 accounts they followed". 2. **Snapshots:** save the first page once a day. Accounts that appear at the top and were not in yesterday's snapshot are that day's new follows. ```python import json, os, pathlib, requests USER = "natgeo" snap = pathlib.Path(f"{USER}-following.json") r = requests.get( f"https://api.handlehaul.com/v1/users/{USER}/following", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30, ) r.raise_for_status() today = [row["username"] for row in r.json()["data"]] before = set(json.loads(snap.read_text())) if snap.exists() else set(today) new = [u for u in today if u not in before] print("New follows since last check:", new) snap.write_text(json.dumps(today)) ``` ```javascript import { readFile, writeFile } from "node:fs/promises"; const user = "natgeo"; const res = await fetch(`https://api.handlehaul.com/v1/users/${user}/following`, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data } = await res.json(); const today = data.map((r) => r.username); const before = new Set(JSON.parse(await readFile(`${user}.json`, "utf8").catch(() => JSON.stringify(today)))); console.log("New follows:", today.filter((u) => !before.has(u))); await writeFile(`${user}.json`, JSON.stringify(today)); ``` A page can occasionally come back one row short, so never treat a single missing row as an unfollow: confirm on the next check. To read past page one when many new follows arrived, see [Detect new followers and follows](/docs/detect-new-instagram-followers-api); to save the whole list, [Export to CSV](/docs/export-instagram-following-csv). ## From an AI assistant Connect the [HandleHaul MCP server](/docs/mcp) to Claude, Cursor, VS Code or Codex and ask *"Who did @natgeo follow most recently?"*. The assistant calls `get_following` and lists the newest follows, at the same price as the REST call. ## FAQ ### How do I see who someone recently followed on Instagram with an API? Call GET /v1/users/{user}/following on the HandleHaul API. It returns the public account's following list newest first, so position 1 is the most recent follow. The first page covers the newest ~200 accounts and costs 1 credit. ### Can I get the date someone followed an account? No API can, because Instagram does not publish follow dates. Save the first page of the list once a day and compare: accounts that are new at the top are that day's follows. ### Does this work for private accounts? No. The HandleHaul API covers public accounts only. A private account answers private_account, and that call is free. ### How do I see an account's newest followers instead? Call GET /v1/users/{user}/followers. It returns followers newest first, 25 a page. See the [Followers API](/docs/instagram-followers-api). --- # Build an Instagram follow tracker app (API) URL: https://api.handlehaul.com/docs/instagram-follower-tracker-api **Short answer:** an Instagram follow tracker needs two calls, `GET /v1/users/{user}/following` and `GET /v1/users/{user}/followers`, made on a schedule. The HandleHaul API returns both lists in **real newest-first order** (`position: 1` is the most recent follow), so the first page of each list is all a tracker has to read, and anything at the top that was not there last time is new. > **Definition:** a follow tracker (or recent-follows tracker) is an app that shows which accounts a public Instagram profile followed most recently, and which accounts followed it most recently, and tells its users when the top of either list changes. ## The two calls | Call (`GET /v1…`) | Rows a page | Credits | Shows | |---|---|---|---| | `/users/{user}/following` | ~200 | 1 | Who the profile followed most recently | | `/users/{user}/followers` | 25 | 1 | Who most recently followed the profile | | `/users/by-username/{name}` | 1 | 1 | Once per profile: its id, name and counts | Cached answers cost nothing, and live data is cached for 60 seconds, so two of your users opening the same profile within a minute cost one call. Failed calls are not billed. ```bash curl "https://api.handlehaul.com/v1/users/natgeo/following" \ -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests H = {"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]} following = requests.get("https://api.handlehaul.com/v1/users/natgeo/following", headers=H, timeout=30).json() followers = requests.get("https://api.handlehaul.com/v1/users/natgeo/followers", headers=H, timeout=30).json() print("Followed most recently:", [r["username"] for r in following["data"][:5]]) print("Newest followers:", [r["username"] for r in followers["data"][:5]]) ``` ```javascript const headers = { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }; const get = (path) => fetch(`https://api.handlehaul.com/v1${path}`, { headers }).then((r) => r.json()); const [following, followers] = await Promise.all([ get("/users/natgeo/following"), get("/users/natgeo/followers"), ]); console.log(following.data.slice(0, 5).map((r) => r.username)); console.log(followers.data.slice(0, 5).map((r) => r.username)); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/following"); 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/following", 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"]) ``` ## How a tracker is put together 1. **Add a profile.** Look the username up once with `GET /v1/users/by-username/{username}` and store the numeric `id`. Send the id from then on: a username we have to look up costs 1 extra credit per call. 2. **Check on a schedule.** A worker reads the first page of `following` and `followers` for each tracked profile, for example once an hour. Check a busy profile more often and a quiet one less often. 3. **Compare with the last check.** Rows at the top that were not in your last snapshot are new. Stop at the first row you already know. The details are in [Detect new followers](/docs/detect-new-instagram-followers-api). 4. **Show the list newest first.** Keep the API's order. There is nothing to sort and no follow date to guess, because Instagram does not publish follow dates. 5. **Keep the key on your server.** The browser or mobile app calls your backend, and only the backend calls the HandleHaul API ([Build with AI tools](/docs/build-with-ai) has a ready server route). A server route for step 5, in Node.js: ```javascript import express from "express"; const app = express(); const LISTS = new Set(["following", "followers"]); app.get("/api/track/:user/:list", async (req, res) => { const { user, list } = req.params; if (!LISTS.has(list) || !/^[A-Za-z0-9._]{1,30}$/.test(user)) return res.status(400).end(); const r = await fetch(`https://api.handlehaul.com/v1/users/${user}/${list}`, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); res.status(r.status).json(await r.json()); }); app.listen(3000); ``` ## What a tracked profile costs One check reads one page of each list: 1 + 1 = **2 credits**. Checked every hour, that is 48 credits a day and 1,440 credits a month, about **$2.09 a month per tracked profile** at the smallest pack's price of $1.45 per 1,000 credits. Several users tracking the same profile share the same calls, and cached answers cost nothing. Packs are on [Pricing](/pricing). ## Rules worth keeping - **Public accounts only.** A private account answers `403 private_account`, and that call is not billed. - **A missing row is not an unfollow.** A page can now and then come back one row short. Confirm over several checks before you tell anyone an account left ([Newest-first order](/docs/newest-first-order)). - **Hidden lists.** Some public profiles hide a list: you get an empty page with `meta.list_hidden: true`. Show "this list is hidden", not "no follows". - Read the [acceptable-use policy](/docs/acceptable-use): no stalking, harassment or reselling personal data. ## FAQ ### What API do Instagram follow tracker apps use? Trackers need another account's following and followers lists in order, which the official Instagram Graph API does not return. The HandleHaul API returns both lists newest first: GET /v1/users/{user}/following and GET /v1/users/{user}/followers, where position 1 is the most recent follow. ### How often should a follow tracker check a profile? Once an hour is a good default. Live data is cached for 60 seconds, so checking more often than once a minute returns the cached answer, which costs nothing but holds no new rows. ### How much does it cost to track one Instagram account? About 2 credits per check (one following page plus one followers page). Checked every hour, that is 1,440 credits a month, about $2.09 at the smallest pack's price of $1.45 per 1,000 credits. ### Do I need the whole following list to see new follows? No. The lists are newest first, so new follows are always at the top of page one. Read deeper pages only when more new rows arrived since the last check than fit on one page. --- # Detect new followers and follows with an API URL: https://api.handlehaul.com/docs/detect-new-instagram-followers-api **Short answer:** to detect new followers or new follows, call `GET /v1/users/{user}/followers` (or `/following`), and keep the rows that sit **above the first account you already saw** last time. The HandleHaul API returns both lists newest first, so new accounts are always at the top: one page per check is enough, however big the account is. > **Definition:** *newest-first diffing* compares only the top of a list sorted by follow time (newest first) with the last snapshot. *Full-list diffing* downloads the entire list in an unspecified order and compares it with the previous full copy. Both find new rows; only the first costs the same for a small and a huge account. ## Diff the full list or read the top? Most Instagram scraping APIs return follower lists in an unspecified order, so the only way to find new followers is to download everything and compare sets. With newest-first lists you read the top page and stop: | Account size | Diff the full list | Newest first: read the top | |---|---|---| | 1,000 followers | 40 pages, 40 credits ($0.06) | 1 page, 1 credit ($0.00) | | 100,000 followers | 4,000 pages, 4,000 credits ($5.80) | 1 page, 1 credit ($0.00) | | 1,000,000 followers | 40,000 pages, 40,000 credits ($58.00) | 1 page, 1 credit ($0.00) | Cost at the smallest pack's price of $1.45 per 1,000 credits, 25 followers per page. Following pages hold about 200 accounts for 1 credit, so the gap is the same there. ## The algorithm 1. Read page one of the list. 2. Walk down from `position: 1`. Every account that is **not** in your last snapshot is new. Stop at the first account that **is** in it. 3. If you reach the end of the page without meeting a known account, more new accounts arrived than fit on one page: read the next page (`?cursor=` with `pagination.next_cursor`) and keep walking. Cap it, for example at 5 pages. 4. Save the ids from this page as the new snapshot. Compare by `id`, not `username`: usernames can change, ids never do. Keep the whole last page as the snapshot rather than one "last seen" account, so that one account leaving does not break the comparison. ```bash curl "https://api.handlehaul.com/v1/users/natgeo/followers" \ -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import json, os, pathlib, requests API = "https://api.handlehaul.com/v1" H = {"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]} def new_rows(user, kind="followers", max_pages=5): snap = pathlib.Path(f"{user}-{kind}.json") known = set(json.loads(snap.read_text())) if snap.exists() else None new, cursor, first_page = [], None, None for _ in range(max_pages): params = {"cursor": cursor} if cursor else {} r = requests.get(f"{API}/users/{user}/{kind}", headers=H, params=params, timeout=30) r.raise_for_status() body = r.json() if first_page is None: first_page = body["data"] if known is None: break # first run: just take a snapshot hit = next((i for i, row in enumerate(body["data"]) if row["id"] in known), None) new += body["data"] if hit is None else body["data"][:hit] cursor = body["pagination"]["next_cursor"] if hit is not None or not cursor: break snap.write_text(json.dumps([row["id"] for row in first_page])) return new print([r["username"] for r in new_rows("natgeo")]) ``` ```javascript import { readFile, writeFile } from "node:fs/promises"; const API = "https://api.handlehaul.com/v1"; const headers = { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }; async function newRows(user, kind = "followers", maxPages = 5) { const file = `${user}-${kind}.json`; const known = await readFile(file, "utf8").then((t) => new Set(JSON.parse(t))).catch(() => null); const fresh = []; let cursor = null; let firstPage = null; for (let page = 0; page < maxPages; page++) { const qs = cursor ? `?cursor=${encodeURIComponent(cursor)}` : ""; const res = await fetch(`${API}/users/${user}/${kind}${qs}`, { headers }); const body = await res.json(); if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`); firstPage ??= body.data; if (!known) break; // first run: just take a snapshot const stop = body.data.findIndex((r) => known.has(r.id)); fresh.push(...(stop === -1 ? body.data : body.data.slice(0, stop))); cursor = body.pagination.next_cursor; if (stop !== -1 || !cursor) break; } await writeFile(file, JSON.stringify(firstPage.map((r) => r.id))); return fresh; } console.log((await newRows("natgeo")).map((r) => r.username)); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/followers"); 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/followers", 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"]) ``` The same function works for new follows: pass `"following"` instead of `"followers"`. ## Dating new rows Instagram does not publish when a follow happened, so no API can give a follow date. What you can record is *when you first saw* an account at the top: check on a schedule and store that time with each new row. Checked hourly, that is accurate to the hour. ## Unfollows are a different problem An account that leaves can sit anywhere in the list, so the top of the list does not show it. Spotting one needs the whole list, and a page can now and then come back one row short. Never report an unfollow from a single missing row: confirm it over several checks ([Newest-first order](/docs/newest-first-order)). ## FAQ ### How do I get notified when an Instagram account gets a new follower? Check GET /v1/users/{user}/followers on a schedule (for example hourly) and compare the top rows with your last snapshot. The list is newest first, so every account above the first one you already knew is a new follower. ### Do I have to download the whole follower list to find new followers? No. With a newest-first list the new followers are always on page one. You read more pages only when more new followers arrived since the last check than fit on one page (25 per page). ### How do I detect new accounts someone follows? Use the same comparison on GET /v1/users/{user}/following, which returns about 200 accounts a page, newest first, for 1 credit. See [Who someone recently followed](/docs/who-someone-recently-followed-api). ### Can the API tell me exactly when a follow happened? No. Instagram does not share follow dates. Record the time your check first saw the account at the top of the list instead. ### Should I compare usernames or ids? Ids. A username can change; the numeric id never does. Every row in the list carries both. --- # Export an Instagram following list to CSV URL: https://api.handlehaul.com/docs/export-instagram-following-csv **Short answer:** to export the accounts a public Instagram profile follows, call `GET /v1/users/{user}/following`, write each row of `data` to a CSV file, and repeat with `?cursor=` set to `pagination.next_cursor` until it is `null`. The HandleHaul API returns the list **newest first**, so row 1 of your CSV is the account they followed most recently. > **Definition:** a *following list export* is a file with one line per account a profile follows. Each line from the HandleHaul API carries `position` (1 = most recent follow), `id`, `username`, `full_name`, `is_verified`, `is_private` and `profile_pic_url`. ## What an export costs Each page holds about 200 accounts and costs 1 credit. Instagram lets an account follow at most 7,500 others, so even the largest export is a few dozen pages: | Accounts followed | Pages (about 200 each) | Credits | Cost at $1.45 per 1,000 credits | |---|---|---|---| | 500 | 3 | 3 | $0.00 | | 2,000 | 10 | 10 | $0.01 | | 7,500 | 38 | 38 | $0.06 | Failed calls are not billed. Repeating an export within 15 minutes reads later pages from cache, which costs nothing. ## One page with curl and jq ```sh curl "https://api.handlehaul.com/v1/users/natgeo/following" \ -H "X-Api-Key: $HANDLEHAUL_API_KEY" \ | jq -r '.data[] | [.position, .id, .username, .full_name, .is_verified] | @csv' > following.csv ``` ## The whole list in Python ```python import csv, os, requests API = "https://api.handlehaul.com/v1" H = {"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]} FIELDS = ["position", "id", "username", "full_name", "is_verified", "is_private", "profile_pic_url"] def export_following(user, path): cursor = None with open(path, "w", newline="", encoding="utf-8") as f: out = csv.DictWriter(f, fieldnames=FIELDS, extrasaction="ignore") out.writeheader() while True: params = {"cursor": cursor} if cursor else {} r = requests.get(f"{API}/users/{user}/following", headers=H, params=params, timeout=60) r.raise_for_status() body = r.json() out.writerows(body["data"]) cursor = body["pagination"]["next_cursor"] if not cursor: break export_following("natgeo", "natgeo-following.csv") ``` ## The whole list in Node.js ```javascript import { writeFile } from "node:fs/promises"; const API = "https://api.handlehaul.com/v1"; const FIELDS = ["position", "id", "username", "full_name", "is_verified", "is_private", "profile_pic_url"]; const cell = (v) => `"${String(v ?? "").replace(/"/g, '""')}"`; async function exportFollowing(user, file) { const lines = [FIELDS.join(",")]; let cursor = null; do { const qs = cursor ? `?cursor=${encodeURIComponent(cursor)}` : ""; const res = await fetch(`${API}/users/${user}/following${qs}`, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const body = await res.json(); if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`); for (const row of body.data) lines.push(FIELDS.map((k) => cell(row[k])).join(",")); cursor = body.pagination.next_cursor; } while (cursor); await writeFile(file, lines.join("\n") + "\n"); } await exportFollowing("natgeo", "natgeo-following.csv"); ``` Pages are read one after another, because each page needs the cursor from the one before. If you hit `429 rate_limited`, wait for the `Retry-After` header and repeat the same page ([Rate limits](/docs/rate-limits)). ## Exporting followers instead Swap `following` for `followers` in the URL. Follower pages hold 25 accounts for 1 credit each, newest first, so a full follower export of a big account takes many pages: read only as deep as you need ([Followers API](/docs/instagram-followers-api)). ## Things to know - **Public accounts only.** A private account answers `403 private_account` (not billed). - **Hidden lists:** some public accounts hide who they follow. You get an empty page with `meta.list_hidden: true`. - **No follow dates:** Instagram does not publish them. The `position` column is the order; to date new follows, export on a schedule and compare ([Detect new follows](/docs/detect-new-instagram-followers-api)). - **Spreadsheet tip:** keep the `id` column as text, or long ids lose digits in Excel and Google Sheets. ## FAQ ### How do I export someone's Instagram following list to CSV? Page through GET /v1/users/{user}/following on the HandleHaul API until pagination.next_cursor is null, and write each row (position, id, username, full_name, is_verified) to a CSV file. The rows are newest first, so the file is in follow order. ### How much does it cost to export a following list? About 200 accounts per page at 1 credit a page. The largest possible list, 7,500 accounts, is 38 pages. Failed calls are not billed. ### Is the exported list in chronological order? Yes. The HandleHaul API returns the following list newest first and says so in meta.order, so position 1 is the most recent follow. Instagram does not publish follow dates, so the file has the order but no dates. ### Can I export an Instagram followers list too? Yes, from GET /v1/users/{user}/followers, 25 accounts per page, newest first, 1 credit a page. ### Can I export the following list of a private account? No. The HandleHaul API covers public accounts only, and a private account answers private_account, which is not billed. --- # Instagram data API in Python and JavaScript URL: https://api.handlehaul.com/docs/instagram-api-python-javascript **Short answer:** from Python, call `requests.get("https://api.handlehaul.com/v1/users/{user}/following", headers={"X-Api-Key": key})`; from JavaScript or TypeScript, `fetch` the same URL with the same header. Every response is JSON shaped `{ data, pagination?, meta }`. To read more rows, pass `pagination.next_cursor` back as `?cursor=` until it is `null`. > **Official SDKs:** `npm install handlehaul` for JavaScript and TypeScript, `pip install handlehaul` for Python (source on GitHub: [handlehaul-js](https://github.com/handlehaul/handlehaul-js) and [handlehaul-python](https://github.com/handlehaul/handlehaul-python)). The plain HTTP examples on this page work the same with or without them. > **Definition:** the HandleHaul API is a REST API for public Instagram data: profiles, followers and following in newest-first order, posts, reels, stories, comments, hashtags and more. You authenticate with one API key in the `X-Api-Key` header; `kd_test_` keys return sample data at no cost and `kd_live_` keys return real data. ## Setup Keep the key in an environment variable, never in code. Start with a test key from the [dashboard](/dashboard#keys): it returns sample data in the live schema, so the same code works when you switch to a live key ([Sandbox](/docs/sandbox)). | | Python | JavaScript / TypeScript | |---|---|---| | Runtime | Python 3.8+ | Node.js 18+, Deno, Bun, Cloudflare Workers | | HTTP client | `pip install requests` | Built-in `fetch` | | Key | `os.environ["HANDLEHAUL_API_KEY"]` | `process.env.HANDLEHAUL_API_KEY` | | Types | Plain dicts | Generate from [openapi.json](https://api.handlehaul.com/openapi.json) | ## First call: a profile ```bash curl "https://api.handlehaul.com/v1/users/by-username/natgeo" \ -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get( "https://api.handlehaul.com/v1/users/by-username/natgeo", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30, ) r.raise_for_status() user = r.json()["data"] print(user["id"], user["username"], user["counts"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/by-username/natgeo", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const body = await res.json(); if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`); console.log(body.data.id, body.data.username, body.data.counts); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/by-username/natgeo"); 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/by-username/natgeo", 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"]) ``` Store `data.id`. Later calls that take `{user}` accept the numeric id, which skips the 1-credit username lookup. ## Paging through a list Lists such as followers and following are newest first and paged with an opaque cursor. Each page is one billed call, so stop as soon as you have what you need. ```python def pages(path, max_pages=10): cursor = None for _ in range(max_pages): r = requests.get(f"https://api.handlehaul.com/v1{path}", params={"cursor": cursor} if cursor else {}, headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() body = r.json() yield from body["data"] cursor = body["pagination"]["next_cursor"] if not cursor: break for row in pages("/users/natgeo/followers", max_pages=2): print(row["position"], row["username"]) ``` ```javascript async function* pages(path, maxPages = 10) { let cursor = null; for (let i = 0; i < maxPages; i++) { const qs = cursor ? `?cursor=${encodeURIComponent(cursor)}` : ""; const res = await fetch(`https://api.handlehaul.com/v1${path}${qs}`, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const body = await res.json(); if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`); yield* body.data; cursor = body.pagination.next_cursor; if (!cursor) break; } } for await (const row of pages("/users/natgeo/following", 1)) console.log(row.position, row.username); ``` ## Retries Retry only what can succeed later: `429` (wait for the `Retry-After` header, in seconds) and `502`, `503`, `504` (back off). Never retry `401`, `402`, `403` or `404`. Failed calls are not billed, so a retry costs nothing extra until it succeeds. ```python import time def get(path, tries=3): for attempt in range(tries): r = requests.get(f"https://api.handlehaul.com/v1{path}", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) if r.status_code == 429: time.sleep(int(r.headers.get("Retry-After", "1"))) elif r.status_code in (502, 503, 504): time.sleep(2 ** attempt) else: r.raise_for_status() return r.json() r.raise_for_status() ``` ```javascript async function get(path, tries = 3) { for (let attempt = 0; ; attempt++) { const res = await fetch(`https://api.handlehaul.com/v1${path}`, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY } }); const retry = res.status === 429 || [502, 503, 504].includes(res.status); if (!retry || attempt === tries - 1) { const body = await res.json(); if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`); return body; } const wait = res.status === 429 ? Number(res.headers.get("Retry-After") ?? 1) : 2 ** attempt; await new Promise((r) => setTimeout(r, wait * 1000)); } } ``` All error codes: [Errors](/docs/errors). Speed per pack: [Rate limits](/docs/rate-limits). ## TypeScript types Generate types for every endpoint from the OpenAPI 3.1 spec, for example with `openapi-typescript`: ```bash npx openapi-typescript https://api.handlehaul.com/openapi.json -o handlehaul-api.d.ts ``` Any OpenAPI generator works the same way for other languages. AI coding tools can read [AGENTS.md](https://api.handlehaul.com/AGENTS.md) for the rules and endpoints ([Build with AI tools](/docs/build-with-ai)). ## Keep the key on the server The API accepts browser requests for quick tests, but a live key in browser or mobile code is visible to every user, who could spend your credits. Call the API from your backend (a Python view, a Node.js route, a serverless function) and send only the result to the browser. ## FAQ ### Is there an official HandleHaul SDK for Python or JavaScript? Yes: `npm install handlehaul` for JavaScript and TypeScript and `pip install handlehaul` for Python ([guide](/docs/instagram-api-python-javascript); source: [handlehaul-js](https://github.com/handlehaul/handlehaul-js) and [handlehaul-python](https://github.com/handlehaul/handlehaul-python)). The API is also plain HTTPS and JSON with one header, so a few lines of `fetch` or `requests` work just as well, and the [OpenAPI spec](https://api.handlehaul.com/openapi.json) generates a typed client in any language. ### How do I call the Instagram followers API from Python? Send GET https://api.handlehaul.com/v1/users/{user}/followers with requests and the header X-Api-Key. The response's data array holds 25 followers, newest first; pass pagination.next_cursor as ?cursor= for the next page. ### How do I call the Instagram following API from JavaScript? fetch("https://api.handlehaul.com/v1/users/{user}/following", { headers: { "X-Api-Key": key } }) from server-side code. The response holds about 200 accounts a page, newest first, for 1 credit. ### Can I call the API from the browser? Only with a kd_test_ key, for experiments. A live key in browser code is visible to every visitor, and the response carries a meta.warning when that happens. Use a server route for real traffic. --- # Instagram Post API URL: https://api.handlehaul.com/docs/instagram-post-api **Get one Instagram post or reel by its URL, shortcode or id**: caption, images or video, carousel items, like, comment and view counts, location and audio. **Track engagement for up to 20 posts in a single call** with the stats route. ``` GET https://api.handlehaul.com/v1/posts/{post} GET https://api.handlehaul.com/v1/posts/stats?ids= ``` - `GET /v1/posts/{post}`: One post or reel - `GET /v1/posts/stats?ids=`: Like, comment and view counts for up to 20 posts (1 credit for the batch) **Cost:** 1 credit per successful call (free from cache). Failed calls and private accounts are free. ## Parameters | Parameter | In | Description | |---|---|---| | `post` | path | Post shortcode (`C9xYzAbCdEf`), numeric id, or a URL-encoded instagram.com/p/… or /reel/… link. | | `ids` | query | stats: 1 to 20 posts, comma-separated shortcodes or ids. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": { "id": "3500000000000000123", "shortcode": "DCSf3TJ3gB7", "url": "https://www.instagram.com/p/DCSf3TJ3gB7/", "taken_at": "2026-11-28T11:59:43.000Z", "media_type": "photo", "caption": "bloom river · sample post 1", "counts": { "likes": 915, "comments": 148, "views": null }, "thumbnail_url": "https://scontent.cdninstagram.com/…/8637327854758358242.jpg", "video_url": null, "duration_seconds": null, "owner": { "id": "6393149904", "username": "nomad.atelier17", "full_name": "Nomad Atelier", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…/6393149904.jpg" }, "location": { "id": "958349030", "name": "ivy Café" }, "audio": null, "carousel": null }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/posts/C9xYzAbCdEf" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() p = r.json()["data"] print(p["media_type"], p["counts"], p["caption"][:80]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: post } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf"); 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/posts/C9xYzAbCdEf", 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 get Instagram post data from a URL? URL-encode the link and pass it as `{post}`, or pass the shortcode from the URL. The id is worked out locally, so there is no extra call. ### How do I track likes on many posts cheaply? Use `GET /v1/posts/stats?ids=a,b,c` with up to 20 posts: one call, one credit, the like, comment and view counts of each. --- # MCP server (Claude, Cursor, VS Code, Codex) URL: https://api.handlehaul.com/docs/mcp The HandleHaul API has a **hosted MCP server** at `https://api.handlehaul.com/mcp`. Add it to your AI assistant and ask in plain words: *"Who did @natgeo follow most recently?"*, *"Show the newest followers of @nasa"*, *"Get the last 5 reels of @bbcnews with views"*. The assistant calls the HandleHaul tools and answers from live public Instagram and TikTok data. - **URL:** `https://api.handlehaul.com/mcp` (streamable HTTP, stateless; no install, nothing runs on your machine) - **Auth:** your HandleHaul API key in `X-Api-Key: kd_live_…` or `Authorization: Bearer kd_live_…` ([get a key](/signup)) - **Price:** the same as the REST API. Each tool call is one API call: 1 credit, a following page of about 200 accounts included, from $0.83 per 1,000 credits, nothing for a cache hit or an error; +1 when a username has to be looked up, so let the assistant pass numeric ids ([Pricing](/pricing)) - **Sandbox:** a `kd_test_…` key returns sample data at no cost. Start with one to try the setup. - **On GitHub:** setup guide and registry metadata (`server.json`) at [github.com/handlehaul/handlehaul-mcp](https://github.com/handlehaul/handlehaul-mcp). The server itself is hosted, so there is nothing to run. - **Public accounts only.** Every answer carries `meta.credits_charged` and `meta.credits_remaining`, so the assistant can tell you what a question cost. Tool calls share your account's [rate limits](/docs/rate-limits), credit balance and per-key monthly caps with your REST calls, and show up in your dashboard usage like any other request. ## Claude Code ```bash claude mcp add --transport http handlehaul https://api.handlehaul.com/mcp \ --header "X-Api-Key: $HANDLEHAUL_API_KEY" --scope user ``` `--scope user` makes it available in every project. To share it with a team in a repository, put it in `.mcp.json` and let each person set `HANDLEHAUL_API_KEY` in their environment: ```json { "mcpServers": { "handlehaul": { "type": "http", "url": "https://api.handlehaul.com/mcp", "headers": { "X-Api-Key": "${HANDLEHAUL_API_KEY}" } } } } ``` Then ask: *"Use handlehaul to list the 20 accounts @natgeo followed most recently."* Type `/mcp` in Claude Code to check the connection. ## Claude Desktop and claude.ai **Custom connector** (where your plan offers request headers): Settings → Connectors → **Add custom connector**, URL `https://api.handlehaul.com/mcp`, authentication **No sign-in**, then under **Request headers** add `x-api-key` with your key (or `authorization` with `Bearer kd_live_…`). **Config file** (works on every plan, needs Node.js): add this to `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`) and restart Claude Desktop. It runs the open-source `mcp-remote` bridge, which forwards to our hosted server. ```json { "mcpServers": { "handlehaul": { "command": "npx", "args": ["-y", "mcp-remote", "https://api.handlehaul.com/mcp", "--header", "X-Api-Key:${HANDLEHAUL_API_KEY}"], "env": { "HANDLEHAUL_API_KEY": "kd_live_your_key" } } } } ``` ## Cursor `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project): ```json { "mcpServers": { "handlehaul": { "url": "https://api.handlehaul.com/mcp", "headers": { "X-Api-Key": "${env:HANDLEHAUL_API_KEY}" } } } } ``` ## VS Code (GitHub Copilot) `.vscode/mcp.json`. VS Code asks for the key once and stores it securely: ```json { "inputs": [ { "type": "promptString", "id": "handlehaul-key", "description": "HandleHaul API key", "password": true } ], "servers": { "handlehaul": { "type": "http", "url": "https://api.handlehaul.com/mcp", "headers": { "X-Api-Key": "${input:handlehaul-key}" } } } } ``` Open Copilot Chat in **Agent** mode and pick the HandleHaul tools. ## OpenAI Codex `~/.codex/config.toml`: ```toml [mcp_servers.handlehaul] url = "https://api.handlehaul.com/mcp" bearer_token_env_var = "HANDLEHAUL_API_KEY" ``` Or from the command line: `codex mcp add handlehaul --url https://api.handlehaul.com/mcp --bearer-token-env-var HANDLEHAUL_API_KEY`. ## Windsurf `~/.codeium/windsurf/mcp_config.json`: ```json { "mcpServers": { "handlehaul": { "serverUrl": "https://api.handlehaul.com/mcp", "headers": { "X-Api-Key": "${env:HANDLEHAUL_API_KEY}" } } } } ``` ## Gemini CLI ```bash gemini mcp add --transport http --header "X-Api-Key: $HANDLEHAUL_API_KEY" -s user handlehaul https://api.handlehaul.com/mcp ``` ## ChatGPT and the OpenAI API ChatGPT's own connector screen (developer mode) only accepts servers with OAuth sign-in or no sign-in, so it cannot send a HandleHaul API key yet. From code, the **OpenAI Responses API** can use the server directly: ```python from openai import OpenAI import os client = OpenAI() resp = client.responses.create( model="gpt-5", tools=[{ "type": "mcp", "server_label": "handlehaul", "server_url": "https://api.handlehaul.com/mcp", "headers": {"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, "require_approval": "never", }], input="Who did @natgeo follow most recently? List 10, newest first.", ) print(resp.output_text) ``` ## Claude API (MCP connector) ```bash curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: mcp-client-2025-11-20" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-5-5", "max_tokens": 1500, "mcp_servers": [{ "type": "url", "url": "https://api.handlehaul.com/mcp", "name": "handlehaul", "authorization_token": "'"$HANDLEHAUL_API_KEY"'" }], "tools": [{ "type": "mcp_toolset", "mcp_server_name": "handlehaul" }], "messages": [{ "role": "user", "content": "Show the 10 newest followers of @nasa." }] }' ``` The connector sends the token as `Authorization: Bearer`, which the HandleHaul server accepts. ## Any other MCP client Use the streamable HTTP transport with the URL `https://api.handlehaul.com/mcp` and one header, `X-Api-Key` or `Authorization: Bearer`. The server is stateless: every request is a plain JSON-RPC `POST`, there is no session to keep and no SSE stream to hold open. Server metadata (an MCP server card) is at [https://api.handlehaul.com/mcp/server-card](https://api.handlehaul.com/mcp/server-card). ## Tools | Tool | What it does | Credits | |---|---|---| | `get_profile` | Public Instagram profile for a username or numeric user id: full name, bio, external link, category, verified and private flags, follower / following / post counts, profile picture and the numeric user id. | 1 | | `get_following` | Accounts that a public Instagram account follows, in Instagram's real newest-first order: position 1 is the account they followed most recently. | 1 | | `get_followers` | Accounts that follow a public Instagram account, newest follower first: position 1 is the most recent follower. | 1 | | `get_posts` | Posts of a public Instagram account, newest first, about 12 per page: shortcode, URL, date, type, caption, like / comment / view counts and thumbnail. | 1 | | `search_users` | Find Instagram accounts by name or username (up to about 40 results). | 1 | | `get_reels` | Reels of a public Instagram account, newest first (sort "recent") or most viewed (sort "views"), about 12 per page, with view counts and video URLs. | 1 | | `get_tagged_posts` | Posts in which a public Instagram account is tagged, about 12 per page. | 1 | | `get_reposts` | Posts a public Instagram account reposted, about 12 per page. | 1 | | `get_stories` | Stories a public Instagram account posted in the last 24 hours, with media URLs and expiry times. | 1 | | `get_highlights` | Story highlights of a public Instagram account (id, title, item count, cover). | 1 | | `get_account_details` | When an Instagram account joined (month and year), its country and how many times it changed username. | 1 | | `get_similar_accounts` | Accounts Instagram considers similar to this one (up to about 80). | 1 | | `get_post_stats` | Like, comment and view counts for 1 to 20 posts in one call. | 1 | | `get_post` | One Instagram post or reel by shortcode, numeric id or instagram.com URL: caption, date, counts, media URLs, owner, location and audio. | 1 | | `get_comments` | Comments on an Instagram post, top first (sort "top") or newest first (sort "newest"), about 15 per page. | 1 | | `get_post_likers` | Accounts that liked an Instagram post, about 100 per page. | 1 | | `get_comment_replies` | Replies to a comment. | 1 | | `get_comment_likers` | Accounts that liked a comment. | 1 | | `get_story` | One Instagram story by numeric id. | 1 | | `get_highlight_stories` | The stories inside one story highlight (ids come from get_highlights). | 1 | | `search_hashtags` | Find Instagram hashtags matching a word, with post counts. | 1 | | `search_places` | Find Instagram places (locations) by name, or near a point with lat and lng. | 1 | | `search_audio` | Find songs and original audio used in Reels. | 1 | | `get_hashtag` | One Instagram hashtag and its post count. | 1 | | `get_hashtag_posts` | Top posts for an Instagram hashtag. | 1 | | `get_place` | One Instagram place: name, category, address, city, coordinates, phone and website. | 1 | | `get_place_posts` | Top (sort "top") or most recent (sort "recent") posts tagged at an Instagram place. | 1 | | `get_trending_audio` | Audio trending on Instagram Reels right now. | 1 | | `get_audio` | One song or original audio: title, artist, duration and how many reels use it. | 1 | | `get_audio_reels` | Reels that use a given song or original audio. | 1 | | `tiktok_get_profile` | Public TikTok profile for a handle, numeric id or secUid: nickname, bio, link, region, verified and private flags, follower / following / like / video counts, avatar, the numeric id and the secUid. | 1 | | `tiktok_get_posts` | Videos and photo posts of a public TikTok account, newest first, about 16 per page: caption, date, duration, cover, view / like / comment / share / save counts, music and hashtags. | 1 | | `tiktok_get_reposts` | Videos a public TikTok account reposted, up to 30 per page. | 1 | | `tiktok_get_liked` | Videos a TikTok account liked. | 1 | | `tiktok_get_followers` | Accounts that follow a public TikTok account, about 30 per page, each with its follower and video counts. | 1 | | `tiktok_get_following` | Accounts that a public TikTok account follows, about 30 per page. | 1 | | `tiktok_get_playlists` | Public playlists of a TikTok account: id, name, video count and cover. | 1 | | `tiktok_get_stories` | Stories a TikTok account has up right now. | 1 | | `tiktok_get_suggested` | Accounts TikTok suggests alongside this one (up to about 30, one page). | 1 | | `tiktok_get_post` | One TikTok video or photo post by numeric id or tiktok.com URL: caption, date, duration, cover, media URL, counts, author, music, hashtags and whether it has captions. | 1 | | `tiktok_get_comments` | Top-level comments on a TikTok post, in TikTok's order, about 20 per page, with author, like count and reply count. | 1 | | `tiktok_get_transcript` | Transcript of a TikTok video from TikTok's captions: full text plus timed segments, and the caption languages available. | 1 | | `tiktok_get_comment_replies` | Replies to a TikTok comment. | 1 | | `tiktok_get_music` | One TikTok sound (song or original audio) by id or tiktok.com/music URL: title, artist, duration, cover and how many posts use it. | 1 | | `tiktok_get_music_posts` | Posts that use a given TikTok sound, up to 30 per page. | 1 | | `tiktok_get_hashtag` | One TikTok hashtag by name: its id, post count and view count. | 1 | | `tiktok_get_hashtag_posts` | Posts under a TikTok hashtag, up to 30 per page. | 1 | | `tiktok_search` | Search TikTok by keyword. | 1 | | `resolve_instagram_url` | Turn any instagram.com link (profile, post, reel, story, highlight, hashtag, place or audio) into its type, ids and the tool to call next. | 0 | | `get_balance` | Your HandleHaul API credit balance, rate limits and this key's usage this month. | 0 | Lists come in pages. The assistant passes `pagination.next_cursor` back as `cursor` for the next page, and each page is billed, so ask for what you need ("the first page", "the 50 most recent"). Two built-in prompts help in clients that show them (in Claude Code they appear as `/mcp__handlehaul__recent_follows` and `/mcp__handlehaul__new_followers`). ## FAQ ### Is there an Instagram MCP server that returns followers and following newest first? Yes. The HandleHaul MCP server's `get_following` and `get_followers` tools return a public account's lists in Instagram's real newest-first order: `position` 1 is the most recent follow, and `meta.order` is `"newest_first"`. ### Does the MCP server cost extra? No. A tool call costs the same as the REST call behind it, and errors are free. A `kd_test_` key returns sample data at no cost. ### Can the assistant see private accounts? No. The server only covers public accounts and publicly visible data. A private account answers `private_account`, and that call is free. ### Do I need to install anything? No for Claude Code, Cursor, VS Code, Codex, Windsurf and Gemini CLI: they connect to the hosted URL directly. The Claude Desktop config-file route uses `npx mcp-remote`, which needs Node.js. ### How do I limit what an assistant can spend? Create a separate key for the assistant in the dashboard and give it a monthly credit cap. Calls past the cap answer `key_quota_exceeded` for free. --- # Instagram Comments API URL: https://api.handlehaul.com/docs/instagram-comments-api **Get the comments on a public Instagram post**, top or newest first, with author, text, time, like count and reply count. Then **read the replies to any comment** and **who liked it**. ``` GET https://api.handlehaul.com/v1/posts/{post}/comments GET https://api.handlehaul.com/v1/comments/{comment}/replies?post= GET https://api.handlehaul.com/v1/comments/{comment}/likers ``` - `GET /v1/posts/{post}/comments`: Comments on a post (about 15 a page) - `GET /v1/comments/{comment}/replies?post=`: Replies to a comment - `GET /v1/comments/{comment}/likers`: Accounts that liked a comment **Cost:** 1 credit per successful call (free from cache). Failed calls and private accounts are free. ## Parameters | Parameter | In | Description | |---|---|---| | `post` | path | Post shortcode (`C9xYzAbCdEf`), numeric id, or a URL-encoded instagram.com/p/… or /reel/… link. | | `sort` | query | comments: `top` (default) or `newest`. | | `comment` | path | Numeric comment id. | | `post` | query | replies: the post the comment belongs to (shortcode or id). | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "782890015575457736", "text": "Love this!", "created_at": "2026-11-28T12:00:00.000Z", "like_count": 76, "reply_count": 0, "author": { "id": "6899639575", "username": "studio.atelier21", "full_name": "Studio Atelier", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…/6899639575.jpg" } } ], "pagination": { "next_cursor": "Ym9v…sealed…", "has_more": true, "page_size": 15 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/comments?sort=newest" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/comments?sort=newest", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() for c in r.json()["data"]: print(c["author"]["username"], c["text"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/comments?sort=newest", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: comments, pagination } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/comments?sort=newest"); 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/posts/C9xYzAbCdEf/comments?sort=newest", 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 scrape Instagram comments with an API? Call `GET /v1/posts/{shortcode}/comments` and follow `pagination.next_cursor`. Each comment includes the author, text, time, like count and reply count. --- # Newest-first order URL: https://api.handlehaul.com/docs/newest-first-order The HandleHaul API returns followers and following in **Instagram's real reverse-chronological order**: `position: 1` is the most recent follow, and positions keep counting across pages. ## Why this matters Since Instagram's September 2026 update, the following list in the app is no longer newest first, and someone else's followers are shown in a personal order. Getting the real order is the hard part, and the reason the API exists. ## meta.order Every list response says which order it has: | Value | Meaning | |---|---| | `newest_first` | Instagram's reverse-chronological order | | `unspecified` | On a rare call only a list in another order was available | Pass `strict_order=true` to never receive an `unspecified` list: you get a free `503 order_unavailable` instead and can retry a little later. A cursor keeps the order of the page that issued it. ## No follow dates Instagram does not share when a follow happened, with anyone. Responses give the order, never a follow time. To know *when* a new follow appeared, call the endpoint on a schedule and record when an account first shows up at the top. ## A missing row is not an unfollow Now and then a list call comes back **one row short**: one account is missing and the rest stay in order. Never treat an account that is missing from a single call as an unfollow. Confirm it is still missing on several later calls before you act on it. ## Hidden lists Some public accounts hide their follower or following list from everyone. You then get `200` with an empty page and `meta.list_hidden: true`: the page is empty, the list is not. --- # Instagram Post Likers API URL: https://api.handlehaul.com/docs/instagram-likers-api **Get the accounts that liked a public Instagram post**: about 100 likers per call, with usernames, names, verified and private flags. ``` GET https://api.handlehaul.com/v1/posts/{post}/likers ``` - `GET /v1/posts/{post}/likers`: Accounts that liked a post **Cost:** 1 credit per successful call (free from cache). Failed calls and private accounts are free. ## Parameters | Parameter | In | Description | |---|---|---| | `post` | path | Post shortcode (`C9xYzAbCdEf`), numeric id, or a URL-encoded instagram.com/p/… or /reel/… link. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "3421754784", "username": "coffee_nora9", "full_name": "Coffee Nora", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…/3421754784.jpg" } ], "pagination": { "next_cursor": null, "has_more": false, "page_size": 100 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/likers" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/likers", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() usernames = [u["username"] for u in r.json()["data"]] ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/likers", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: likers } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/posts/C9xYzAbCdEf/likers"); 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/posts/C9xYzAbCdEf/likers", 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 ### Can I get every like on a post? Instagram shows a sample of about 100 recent likers per post; the API returns what Instagram shows. Use `counts.likes` from the [Post API](/docs/instagram-post-api) for the total. --- # Pagination URL: https://api.handlehaul.com/docs/pagination List endpoints return `pagination.next_cursor`, `pagination.has_more` and `pagination.page_size`. Pass the cursor back as `?cursor=` for the next page; `next_cursor: null` is the end. | Endpoint | Rows per page | |---|---| | followers | up to 25 | | following | about 200 | | posts | about 12 | | search | up to 40 in total | - Cursors are **opaque, encrypted and signed**. Do not parse, build or edit them: a changed cursor answers `400 invalid_cursor`. - A cursor works only for the endpoint and account that issued it. - `position` keeps counting across pages. - Each page is one call (1 credit). The newest rows are on page one, so walk only as deep as you need. --- # Caching URL: https://api.handlehaul.com/docs/caching **A cached answer is free.** You only pay for live calls. How long an answer stays in the cache depends on how fast it changes: | Data | Cached for | |---|---| | Profiles, and the first page of every list (followers, following, posts, reels, stories, highlights, comments, likers, hashtag and place posts) | **60 seconds** | | Later pages of a list (when you pass a `cursor`), searches, hashtags, places, audio, account details, similar accounts | 15 minutes | - **Polling for new follows?** Ask once a minute or less often and every answer is live. The short cache only catches retries and identical calls that arrive at the same moment. - Later pages stay cached longer so walking one list with `cursor` stays consistent from page to page. - When an identical request is already in flight, yours waits for it instead of fetching again. That answer is also free. - The response tells you what you got: header `X-HandleHaul-Cache: HIT` or `MISS`, plus `meta.cached`, `meta.cache_age_seconds` and `meta.credits_charged` (0 for a cache hit). - Need it live right now? Add `?fresh=true` or send `Cache-Control: no-cache`. That call is billed as a normal live call. - Nothing from Instagram is stored longer than the cache lifetime. --- # Instagram Tagged Posts API URL: https://api.handlehaul.com/docs/instagram-tagged-posts-api **List the posts a public account is tagged in**, and **the posts it reposted**: useful for creator research and brand mentions. ``` GET https://api.handlehaul.com/v1/users/{user}/tagged GET https://api.handlehaul.com/v1/users/{user}/reposts ``` - `GET /v1/users/{user}/tagged`: Posts the account is tagged in - `GET /v1/users/{user}/reposts`: Posts the account reposted **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. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "1222430285318392596", "shortcode": "BD28d4nFQsU", "url": "https://www.instagram.com/p/BD28d4nFQsU/", "taken_at": "2026-11-28T11:56:20.000Z", "media_type": "photo", "caption": "ivy cedar · sample post 1", "counts": { "likes": 7054, "comments": 48, "views": null }, "thumbnail_url": "https://scontent.cdninstagram.com/…/1222430285318392596.jpg", "video_url": null, "duration_seconds": null, "owner": { "id": "7146293651", "username": "wren.studio56", "full_name": "Wren Studio", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…/7146293651.jpg" }, "location": { "id": "973420649", "name": "olive Café" }, "audio": null, "carousel": null } ], "pagination": { "next_cursor": "Ym9v…sealed…", "has_more": true, "page_size": 12 }, "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/tagged" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/natgeo/tagged", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() brands = {p["owner"]["username"] for p in r.json()["data"] if p["owner"]} ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/tagged", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: tagged } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/tagged"); 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/tagged", 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 who tagged a brand on Instagram? Call `GET /v1/users/{brand}/tagged`. Each post includes its `owner`, so you can see which accounts tagged the brand. --- # Errors URL: https://api.handlehaul.com/docs/errors Errors use HTTP status codes and a stable `error.code`. **Failed calls are never charged**, and neither are our own `429` answers. Quote the `request_id` when you contact us. ```json { "error": { "code": "private_account", "message": "This account is private. The API only covers public accounts.", "request_id": "req_4kd9…", "docs": "https://api.handlehaul.com/docs/errors" } } ``` | Status | Code | Meaning | |---|---|---| | 401 | `missing_api_key` | Send your API key in the X-Api-Key header. | | 401 | `invalid_api_key` | This API key is not valid or has been revoked. | | 429 | `too_many_bad_keys` | Too many requests with invalid API keys from this address. Wait a minute. | | 403 | `account_suspended` | This account is suspended. Contact support@handlehaul.com. | | 403 | `account_closed` | This account was closed. Email support@handlehaul.com to reopen it. | | 403 | `account_rejected` | This account was not approved. Contact support@handlehaul.com if you think this is a mistake. | | 403 | `account_not_approved` | Your account is waiting for review. Sandbox (kd_test_) keys work now; live keys open once the account is approved. | | 402 | `promo_limit` | Free test calls cover only the first 5 pages of a list. Buy a credit pack to read further. | | 402 | `insufficient_credits` | Your account is out of credits. Buy a credit pack in the dashboard to continue. | | 429 | `key_quota_exceeded` | This key reached its monthly credit cap. Raise the cap in the dashboard or wait for next month. | | 429 | `rate_limited` | Too many requests per second. Slow down and retry after the Retry-After delay. | | 429 | `promo_rate_limited` | Free test calls run at 1 request per second. Retry after the Retry-After delay, or buy a credit pack for the full speed. | | 429 | `concurrency_limited` | Too many requests in flight at once. Wait for one to finish, then retry. | | 403 | `ip_not_allowed` | This API key cannot be used from your IP address. Check the key's IP allowlist. | | 403 | `purchase_locked` | New accounts can buy the two smallest packs first. Larger packs unlock after you use some credits. | | 400 | `invalid_request` | The request is not valid. | | 400 | `invalid_cursor` | This cursor is not valid for this endpoint. Start again without a cursor. | | 404 | `user_not_found` | No Instagram account with this username or id. | | 403 | `private_account` | This account is private. The API only covers public accounts. | | 503 | `order_unavailable` | A newest-first list is not available right now. Retry shortly, or call without strict_order. | | 502 | `upstream_unavailable` | Instagram data is temporarily unavailable. Retry in a moment; failed calls are free. | | 504 | `upstream_timeout` | Fetching this data took too long. Retry in a moment; failed calls are free. | | 503 | `platform_disabled` | This platform is not enabled yet. Failed calls are free. | | 503 | `service_busy` | We are at capacity right now. Retry after the Retry-After header (usually a few seconds); failed calls are free. | | 500 | `internal_error` | Something went wrong on our side. Retry in a moment. | ## Retrying Retry `429`, `502`, `503` and `504` with exponential backoff and jitter, honouring `Retry-After` when present. Do not retry `400`, `401`, `402`, `403` or `404`: the answer will not change. --- # Instagram Hashtag API URL: https://api.handlehaul.com/docs/instagram-hashtag-api **Get a hashtag's post count and its top posts**, and **search for hashtags** by keyword. ``` GET https://api.handlehaul.com/v1/hashtags/{tag} GET https://api.handlehaul.com/v1/hashtags/{tag}/posts GET https://api.handlehaul.com/v1/search/hashtags?q= ``` - `GET /v1/hashtags/{tag}`: A hashtag and its post count - `GET /v1/hashtags/{tag}/posts`: Top posts for a hashtag - `GET /v1/search/hashtags?q=`: Find hashtags **Cost:** 1 credit per successful call (free from cache). Failed calls and private accounts are free. ## Parameters | Parameter | In | Description | |---|---|---| | `tag` | path | Hashtag, with or without `#` (URL-encode `#` as `%23`). | | `q` | query | search: what to look for. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "1417859427809275745", "shortcode": "BOtP6MwAq9h", "url": "https://www.instagram.com/p/BOtP6MwAq9h/", "taken_at": "2026-11-28T11:56:42.000Z", "media_type": "photo", "caption": "cedar sage · sample post 1", "counts": { "likes": 1889, "comments": 32, "views": null }, "thumbnail_url": "https://scontent.cdninstagram.com/…/1417859427809275745.jpg", "video_url": null, "duration_seconds": null, "owner": { "id": "2664388851", "username": "pixel.kai4", "full_name": "Pixel Kai", "is_private": false, "is_verified": false, "profile_pic_url": "https://scontent.cdninstagram.com/…/2664388851.jpg" }, "location": { "id": "870424359", "name": "river Café" }, "audio": null, "carousel": null } ], "pagination": { "next_cursor": "Ym9v…sealed…", "has_more": true, "page_size": 12 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/hashtags/coffee/posts" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/hashtags/coffee/posts", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() for p in r.json()["data"]: print(p["url"], p["counts"]["likes"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/hashtags/coffee/posts", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: posts } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/hashtags/coffee/posts"); 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/hashtags/coffee/posts", 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 many posts does an Instagram hashtag have? Call `GET /v1/hashtags/{tag}`: `post_count` is the number Instagram shows. --- # Instagram Location API URL: https://api.handlehaul.com/docs/instagram-location-api **Find Instagram places by name or near a latitude and longitude**, get a place's name, category, address and contact, and **read its top or recent posts**. ``` GET https://api.handlehaul.com/v1/search/places?q=&lat=&lng= GET https://api.handlehaul.com/v1/places/{place} GET https://api.handlehaul.com/v1/places/{place}/posts ``` - `GET /v1/search/places?q=&lat=&lng=`: Find places - `GET /v1/places/{place}`: A place - `GET /v1/places/{place}/posts`: Top or recent posts at a place **Cost:** 1 credit per successful call (free from cache). Failed calls and private accounts are free. ## Parameters | Parameter | In | Description | |---|---|---| | `q` | query | search: a place name. | | `lat` | query | search: latitude (with lng). | | `lng` | query | search: longitude. | | `place` | path | Numeric place id. | | `sort` | query | posts: `top` (default) or `recent`. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "576929642", "name": "atelier Café", "category": "Coffee shop", "address": "10 cedar Street", "city": "Paris", "lat": 48.85, "lng": 2.35, "phone": null, "website": null } ], "pagination": { "next_cursor": null, "has_more": false, "page_size": 10 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/search/places?lat=48.8584&lng=2.2945" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/search/places?lat=48.8584&lng=2.2945", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() for p in r.json()["data"]: print(p["id"], p["name"], p["city"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/search/places?lat=48.8584&lng=2.2945", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: places } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/search/places?lat=48.8584&lng=2.2945"); 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/search/places?lat=48.8584&lng=2.2945", 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 get Instagram posts from a location? Find the place with `GET /v1/search/places`, then call `GET /v1/places/{id}/posts?sort=recent` for the newest posts tagged there. --- # Rate limits URL: https://api.handlehaul.com/docs/rate-limits Limits apply to your **account**, shared by all its keys, so extra keys never add speed. The speed comes with the largest credit pack you have bought: | Largest pack bought | Requests per second | Requests in flight | |---|---|---| | 20,000 credits ($29) | 10 | 25 | | 80,000 credits ($99) | 10 | 25 | | 250,000 credits ($249) | 20 | 50 | | 600,000 credits ($499) | 30 | 75 | | Other cases | Requests per second | Requests in flight | |---|---|---| | Scale | custom, 30 and up | custom | | Limited account (before review) | 2 | 5 | | Calls paid with live test calls | 1 | 1 | | Sandbox keys | 2 | 1 | - Every response carries `X-RateLimit-Limit` and `X-RateLimit-Remaining`. - Over the per-second limit you get `429 rate_limited` with `Retry-After`. Too many requests at once gives `429 concurrency_limited`. **Neither is charged.** - You can give a key a **lower** limit and a **monthly credit cap** in the dashboard, for example to keep a staging key from spending your balance. - Need more? A [larger pack](/pricing) raises the speed for good, or talk to us about Scale. --- # Instagram Audio API URL: https://api.handlehaul.com/docs/instagram-audio-api **Get a song or original audio from Instagram Reels**, **the reels that use it**, **what is trending**, and **search sounds** by name. ``` GET https://api.handlehaul.com/v1/audio/{audio} GET https://api.handlehaul.com/v1/audio/{audio}/reels GET https://api.handlehaul.com/v1/audio/trending GET https://api.handlehaul.com/v1/search/audio?q= ``` - `GET /v1/audio/{audio}`: A song or original audio - `GET /v1/audio/{audio}/reels`: Reels that use it - `GET /v1/audio/trending`: Trending audio - `GET /v1/search/audio?q=`: Find audio **Cost:** 1 credit per successful call (free from cache). Failed calls and private accounts are free. ## Parameters | Parameter | In | Description | |---|---|---| | `audio` | path | Numeric audio id (from a reel's `audio.id` or an audio URL). | | `q` | query | search: a song, artist or sound name. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": [ { "id": "1899325052268228", "title": "Cedar Leo", "artist": "Cedar River", "is_original": false, "duration_seconds": 179, "reel_count": 703000, "cover_url": "https://scontent.cdninstagram.com/…/audio-audio_trending:coffee:0.jpg" } ], "pagination": { "next_cursor": null, "has_more": false, "page_size": 15 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/audio/trending" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/audio/trending", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() for a in r.json()["data"]: print(a["title"], a["artist"], a["reel_count"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/audio/trending", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: trending } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/audio/trending"); 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/audio/trending", 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 trending Instagram sounds with an API? Call `GET /v1/audio/trending`. Each audio has a title, artist, duration and `reel_count`; use `GET /v1/audio/{id}/reels` to see the reels using it. --- # Instagram Similar Accounts API URL: https://api.handlehaul.com/docs/instagram-similar-accounts-api **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. --- # Instagram Account Details API URL: https://api.handlehaul.com/docs/instagram-account-details-api **Get Instagram's "About this account" details**: the month the account joined, the country it is based in, whether it is verified, and how many times it changed its username. Useful for spotting fake or recycled accounts. ``` GET https://api.handlehaul.com/v1/users/{user}/account-details ``` - `GET /v1/users/{user}/account-details`: "About this account" details **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": { "joined": "January 2021", "country": "Brazil", "is_verified": false, "former_username_count": 1 }, "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/account-details" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/users/natgeo/account-details", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) r.raise_for_status() d = r.json()["data"] print(d["joined"], d["country"], d["former_username_count"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/users/natgeo/account-details", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data: details } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/users/natgeo/account-details"); 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/account-details", 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 see when an Instagram account was created? Call `GET /v1/users/{username}/account-details`: `joined` is the month and year Instagram shows (for example "June 2017"). --- # Instagram URL Resolver URL: https://api.handlehaul.com/docs/instagram-url-resolver **Turn any Instagram link into its type and ids, free.** Profiles, posts, reels, stories, highlights, hashtags, places and audio links are all recognised, and a post shortcode is converted to its numeric media id. The answer also tells you which HandleHaul API route to call next. ``` GET https://api.handlehaul.com/v1/resolve?url={instagram_url} ``` **Cost:** free (no data is fetched). Needs an API key. ## Response ```json { "data": { "type": "post", "shortcode": "C9xYzAbCdEf", "id": "3500000000000000123", "api": "/v1/posts/C9xYzAbCdEf" }, "meta": { "request_id": "req_…", "credits_charged": 0 } } ``` `type` is one of `user`, `post`, `story`, `highlight`, `hashtag`, `place` or `audio`. ## Examples ```bash curl -G "https://api.handlehaul.com/v1/resolve" --data-urlencode "url=https://www.instagram.com/reel/C9xYzAbCdEf/" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/resolve", params={"url": "https://www.instagram.com/p/C9xYzAbCdEf/"}, headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=30) print(r.json()["data"]["id"]) ``` ```javascript const url = new URL("https://api.handlehaul.com/v1/resolve"); url.searchParams.set("url", "https://www.instagram.com/explore/tags/coffee/"); const { data } = await (await fetch(url, { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY } })).json(); ``` ## FAQ ### How do I convert an Instagram shortcode to a media id? Call `GET /v1/resolve?url=` with the post link: `id` is the numeric media id. The conversion is exact and costs nothing. --- # TikTok Profile API URL: https://api.handlehaul.com/docs/tiktok-profile-api **Get a public TikTok profile as JSON** from a handle, a numeric user id or a `secUid`: nickname, bio and link, verified and private flags, follower, following, like and video counts, avatar, and the account's `id` and `sec_uid` for the other TikTok endpoints. ``` GET https://api.handlehaul.com/v1/tiktok/users/{user} ``` **Cost:** 1 credit per successful call (free from cache, kept 60 seconds). Not found and failed calls are free. The profile call never adds lookup credits: it is the lookup. ## Parameters | Parameter | In | Description | |---|---|---| | `user` | path | TikTok handle (`mila.studio`, with or without `@`), numeric user id, or `secUid` (`MS4wLjABAAAA…`). All digits means an id; write `@12345` for a handle made only of digits. | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data` (same price). | ## Response ```json { "data": { "id": "6800603536904605282", "sec_uid": "MS4wLjABAAAAFjCNJUq7pGOuS6YC8bTNAHRKWqIShz6s9C1EkRYtfRk", "handle": "mila.studio", "nickname": "Mila Studio", "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6800603536904605282~c5_1080x1080.jpeg", "is_verified": false, "is_private": false, "url": "https://www.tiktok.com/@mila.studio", "counts": { "followers": 340593, "following": 913, "likes": 10558383, "videos": 933 }, "bio": "Sample TikTok profile for mila.studio.", "bio_link": null, "region": "US", "language": "en", "created_at": "2024-06-13T00:53:20.000Z" }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` - `counts` are exact. (Counts embedded in post lists, under `author.counts`, are rounded by TikTok on big accounts.) - `region`, `language` and `created_at` are filled when TikTok exposes them and are `null` otherwise. - Private accounts still return their profile, with `is_private: true`; their lists answer `private_account`. ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/users/mila.studio" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/users/mila.studio", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() p = r.json()["data"] print(p["handle"], p["counts"]["followers"], p["sec_uid"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/users/mila.studio", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/users/mila.studio"); 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/tiktok/users/mila.studio", 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 get TikTok follower counts with an API? Call `GET /v1/tiktok/users/{handle}`. `data.counts.followers` is the exact follower count; `likes` is the total likes the account received and `videos` its public post count. ### What is a secUid? TikTok's stable key for an account. Handles can change; the `secUid` and numeric `id` do not. Store `sec_uid` from the profile and send it to the list endpoints: it is the fastest identifier and never costs a lookup. --- # TikTok Posts API URL: https://api.handlehaul.com/docs/tiktok-posts-api **Get the posts of a public TikTok account**, newest first, with caption, date, duration, cover, media URL, view / like / comment / share / save counts, music and hashtags. The same post shape comes back for reposts, liked videos and stories. ``` GET https://api.handlehaul.com/v1/tiktok/users/{user}/posts GET https://api.handlehaul.com/v1/tiktok/users/{user}/reposts GET https://api.handlehaul.com/v1/tiktok/users/{user}/liked GET https://api.handlehaul.com/v1/tiktok/users/{user}/playlists GET https://api.handlehaul.com/v1/tiktok/users/{user}/stories ``` - `GET /v1/tiktok/users/{user}/posts`: videos and photo posts, newest first (about 16 a page) - `GET /v1/tiktok/users/{user}/reposts`: videos the account reposted (up to 30 a page) - `GET /v1/tiktok/users/{user}/liked`: videos the account liked. Most accounts hide this list: the page is then empty and `meta.list_hidden` is `true` - `GET /v1/tiktok/users/{user}/playlists`: public playlists (id, name, video count, cover) - `GET /v1/tiktok/users/{user}/stories`: stories up right now (often empty: stories expire) **Cost:** 1 credit per page (free from cache). Failed calls and private accounts are free. **Handles and ids:** list endpoints work on the account's `secUid`. Send a handle we have not looked up in the last 7 days and we look it up first, which adds **1 credit** (`meta.lookup_credits`, `X-Credits-Lookup`). A `secUid`, a numeric id, a handle we already know and later pages never pay it. Every profile and list item returns `id` and `sec_uid`: store them. ## Parameters | Parameter | In | Description | |---|---|---| | `user` | path | TikTok handle (`mila.studio`, with or without `@`), numeric user id, or `secUid` (`MS4wLjABAAAA…`). All digits means an id; write `@12345` for a handle made only of digits. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data` instead of our fields (same price). | ## Response ```json { "data": [ { "id": "7300004256287789000", "url": "https://www.tiktok.com/@mila.studio/video/7300004256287789000", "caption": "Sample post 1 by @mila.studio #luna #fyp", "created_at": "2026-11-30T00:53:20.000Z", "media_type": "video", "duration_seconds": 15, "cover_url": "https://p16-sign.tiktokcdn-us.com/…/cover/7300004256287789000.jpeg", "play_url": "https://v16-webapp-prime.tiktok.com/…/7300004256287789000.mp4", "images": null, "counts": { "views": 499242, "likes": 29955, "comments": 998, "shares": 499, "saves": 1498 }, "author": { "id": "6800603536904605282", "sec_uid": "MS4wLjABAAAAFjCNJUq7pGOuS6YC8bTNAHRKWqIShz6s9C1EkRYtfRk", "handle": "mila.studio", "nickname": "Mila Studio", "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6800603536904605282~c5_1080x1080.jpeg", "is_verified": false, "is_private": false, "url": "https://www.tiktok.com/@mila.studio", "counts": { "followers": 340593, "following": 913, "likes": 10558383, "videos": 933 } }, "music": { "id": "7200000000000000000", "title": "original sound", "artist": "Mila Studio", "is_original": true, "duration_seconds": 30, "cover_url": "https://p16-sign.tiktokcdn-us.com/…/music/7200000000000000000~c5_720x720.jpeg", "play_url": "https://v16-webapp-prime.tiktok.com/…/music/7200000000000000000.mp3", "post_count": null, "url": "https://www.tiktok.com/music/original-sound-7200000000000000000" }, "hashtags": [ "luna", "fyp" ], "mentions": [], "language": "en", "location": null, "has_captions": true, "is_ad": false } ], "pagination": { "next_cursor": "eyJ2…sealed…", "has_more": true, "page_size": 16 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` - `media_type` is `video` or `photo`; photo posts list their slides in `images` and have no `play_url`. - `play_url` is a short-lived TikTok media URL; TikTok's CDN may refuse it outside a browser. Use it promptly or fetch the post again. - `has_captions` tells you whether [the transcript endpoint](/docs/tiktok-transcript-api) will find text. - TikTok sometimes returns a short or empty page while `has_more` is still `true`: follow `next_cursor`, not the page size. ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/users/mila.studio/posts" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/users/mila.studio/posts", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() for p in r.json()["data"]: print(p["created_at"], p["counts"]["views"], p["url"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/users/mila.studio/posts", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/users/mila.studio/posts"); 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/tiktok/users/mila.studio/posts", 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 get all videos of a TikTok account? Call `GET /v1/tiktok/users/{user}/posts` and pass `pagination.next_cursor` back as `cursor` while `pagination.has_more` is `true`. Each page is one call. ### Why is the liked list empty? The account hides its liked videos (the default on TikTok). The call still answers, with `meta.list_hidden: true`. --- # TikTok Followers and Following API URL: https://api.handlehaul.com/docs/tiktok-followers-api **List who follows a public TikTok account and who it follows**, about 30 accounts a page, each with its handle, ids, avatar, verified flag and follower / video counts. Plus **similar accounts**: the ones TikTok suggests alongside it. ``` GET https://api.handlehaul.com/v1/tiktok/users/{user}/followers GET https://api.handlehaul.com/v1/tiktok/users/{user}/following GET https://api.handlehaul.com/v1/tiktok/users/{user}/suggested ``` - `GET /v1/tiktok/users/{user}/followers`: followers (about 30 a page) - `GET /v1/tiktok/users/{user}/following`: accounts it follows (about 30 a page) - `GET /v1/tiktok/users/{user}/suggested`: similar accounts (up to about 30, one page) **Cost:** 1 credit per page (free from cache). Failed calls and private accounts are free. **Handles and ids:** list endpoints work on the account's `secUid`. Send a handle we have not looked up in the last 7 days and we look it up first, which adds **1 credit** (`meta.lookup_credits`, `X-Credits-Lookup`). A `secUid`, a numeric id, a handle we already know and later pages never pay it. Every profile and list item returns `id` and `sec_uid`: store them. ## Parameters | Parameter | In | Description | |---|---|---| | `user` | path | TikTok handle (`mila.studio`, with or without `@`), numeric user id, or `secUid` (`MS4wLjABAAAA…`). All digits means an id; write `@12345` for a handle made only of digits. | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data` instead of our fields (same price). | ## Response ```json { "data": [ { "id": "6800816061066175854", "sec_uid": "MS4wLjABAAAAwqygALAganfhe4jZpzulcXsnpJBzOO7RGirtKtKB5Mk", "handle": "wren.wren16", "nickname": "Wren Wren", "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6800816061066175854~c5_1080x1080.jpeg", "is_verified": false, "is_private": false, "url": "https://www.tiktok.com/@wren.wren16", "counts": { "followers": 1360658, "following": 878, "likes": 42180398, "videos": 898 } } ], "pagination": { "next_cursor": "eyJ2…sealed…", "has_more": true, "page_size": 30 }, "meta": { "request_id": "req_…", "list_hidden": false, "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` - **Order:** in our checks TikTok returned followers most recent first, but TikTok does not promise an order and shares no follow dates, so we do not guarantee one (there is no `meta.order` on TikTok lists). - An account can hide its follow lists: the page is then empty and `meta.list_hidden` is `true`. - Lists are TikTok's snapshot at the time of the call; accounts join and leave while you page. ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/users/mila.studio/followers" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/users/mila.studio/followers", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() for u in r.json()["data"]: print(u["handle"], u["counts"]["followers"] if u["counts"] else None) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/users/mila.studio/followers", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/users/mila.studio/followers"); 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/tiktok/users/mila.studio/followers", 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 ### Can I get the full follower list of a big TikTok account? You can page through it with `next_cursor`, about 30 accounts per call. For very large accounts that is many calls; most uses read the first pages. ### How do I find accounts similar to a TikTok creator? `GET /v1/tiktok/users/{user}/suggested` returns the accounts TikTok recommends next to that profile, in one page. --- # TikTok Post API URL: https://api.handlehaul.com/docs/tiktok-post-api **Get one TikTok post as JSON** from its numeric id or its tiktok.com link: caption, date, duration, cover, media URL, counts, author, music, hashtags and mentions, and whether it has captions. ``` GET https://api.handlehaul.com/v1/tiktok/posts/{post} ``` **Cost:** 1 credit per successful call (free from cache). A post that does not exist answers `404 user_not_found` and is free. ## Parameters | Parameter | In | Description | |---|---|---| | `post` | path | Post id (`7300000000000000123`) or a URL-encoded `tiktok.com/@user/video/` or `/photo/` link. | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data` (same price). | ## Response ```json { "data": { "id": "7300000000000000123", "url": "https://www.tiktok.com/@river_wren29/video/7300000000000000123", "caption": "Sample post 124 by @river_wren29 #pixel #fyp", "created_at": "2026-07-30T00:53:20.000Z", "media_type": "video", "duration_seconds": 18, "cover_url": "https://p16-sign.tiktokcdn-us.com/…/cover/7300000000000000123.jpeg", "play_url": "https://v16-webapp-prime.tiktok.com/…/7300000000000000123.mp4", "images": null, "counts": { "views": 538234, "likes": 32294, "comments": 1076, "shares": 538, "saves": 1615 }, "author": { "id": "6804246811370395890", "sec_uid": "MS4wLjABAAAAsKNrxsBn-IUSma2viuD_ShtPMiRgkVWSjeDiJxNJZ2w", "handle": "river_wren29", "nickname": "River Wren", "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6804246811370395890~c5_1080x1080.jpeg", "is_verified": false, "is_private": false, "url": "https://www.tiktok.com/@river_wren29", "counts": { "followers": 579298, "following": 318, "likes": 17958238, "videos": 338 } }, "music": { "id": "7200000000000000000", "title": "original sound", "artist": "River Wren", "is_original": true, "duration_seconds": 30, "cover_url": "https://p16-sign.tiktokcdn-us.com/…/music/7200000000000000000~c5_720x720.jpeg", "play_url": "https://v16-webapp-prime.tiktok.com/…/music/7200000000000000000.mp3", "post_count": null, "url": "https://www.tiktok.com/music/original-sound-7200000000000000000" }, "hashtags": [ "pixel", "fyp" ], "mentions": [], "language": "en", "location": "US", "has_captions": true, "is_ad": false }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() p = r.json()["data"] print(p["caption"], p["counts"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123"); 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/tiktok/posts/7300000000000000123", 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 ### Can I pass the TikTok link instead of the id? Yes. URL-encode it into the path: `/v1/tiktok/posts/https%3A%2F%2Fwww.tiktok.com%2F%40user%2Fvideo%2F7300000000000000123`. --- # TikTok Comments API URL: https://api.handlehaul.com/docs/tiktok-comments-api **Get the comments on a TikTok post**, in TikTok's order, with author, text, time, like count and reply count, then **the replies to any comment**. ``` GET https://api.handlehaul.com/v1/tiktok/posts/{post}/comments GET https://api.handlehaul.com/v1/tiktok/comments/{comment}/replies?post= ``` - `GET /v1/tiktok/posts/{post}/comments`: top-level comments (about 20 a page) - `GET /v1/tiktok/comments/{comment}/replies?post=`: replies to one comment (about 3 a page; pass the post too) **Cost:** 1 credit per page (free from cache). Failed calls are free. A post with comments turned off answers an empty page. ## Parameters | Parameter | In | Description | |---|---|---| | `post` | path | comments: post id or URL-encoded tiktok.com post link. | | `comment` | path | replies: the comment `id`. | | `post` | query | replies: the post the comment belongs to (id or link). | | `cursor` | query | `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data`. | ## Response ```json { "data": [ { "id": "7300000000000010123", "text": "Sample comment 1", "created_at": "2026-11-30T00:53:20.000Z", "like_count": 50, "reply_count": 0, "author": { "id": "6801485827156468097", "sec_uid": "MS4wLjABAAAAv9cU4OWfsG8W8GpH25_ry1cATH53sVTiBeFOsovGJRQ", "handle": "aurora_cedar12", "nickname": "Aurora Cedar", "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6801485827156468097~c5_100x100.jpeg", "is_verified": false, "is_private": false, "url": "https://www.tiktok.com/@aurora_cedar12", "counts": null }, "post_id": "7300000000000000123", "parent_id": null } ], "pagination": { "next_cursor": "eyJ2…sealed…", "has_more": true, "page_size": 20 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` Only call replies when `reply_count` is above zero. On a reply, `parent_id` is the comment it answers. TikTok can repeat a few comments from one page on the next (we saw it in our checks): de-duplicate by `id` when you collect a whole thread. ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/comments" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/comments", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() for c in r.json()["data"]: print(c["author"]["handle"], c["like_count"], c["text"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/comments", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/comments"); 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/tiktok/posts/7300000000000000123/comments", 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 scrape TikTok comments with an API? Call `GET /v1/tiktok/posts/{post}/comments` and follow `pagination.next_cursor` while `has_more` is `true`. --- # TikTok Transcript API URL: https://api.handlehaul.com/docs/tiktok-transcript-api **Get the transcript of a TikTok video** from its captions (most of them auto-generated by TikTok): the full text, timed segments and the caption languages available. ``` GET https://api.handlehaul.com/v1/tiktok/posts/{post}/transcript GET https://api.handlehaul.com/v1/tiktok/post/transcript?url= ``` - `GET /v1/tiktok/posts/{post}/transcript`: by post id or URL-encoded link - `GET /v1/tiktok/post/transcript?url=` (or `?id=`): the same, with the link in the query **Cost:** 1 credit per successful call. **A video without captions still costs 1 credit** (we had to fetch the post to find out) and answers `available: false`. A transcript is kept 24 hours (1 hour when there were no captions yet, since TikTok can add them shortly after upload); repeats from cache are free. ## Parameters | Parameter | In | Description | |---|---|---| | `post` | path | Post id or URL-encoded tiktok.com video link. | | `url` / `id` | query | Alias route only: the video link, or its id. | | `lang` | query | Optional caption language code (`en`, `es`…). Default: the video's original language. | | `fresh` | query | `true` skips the cache. | ## Response ```json { "data": { "video_id": "7300000000000000123", "available": true, "language": "en", "languages": [ "en" ], "is_auto_generated": true, "text": "Hi, this is a sample caption. Post 0123 talks about coffee. Thanks for watching!", "segments": [ { "start": 0, "end": 1.58, "text": "Hi, this is a sample caption." }, { "start": 1.581, "end": 3.421, "text": "Post 0123 talks about coffee." }, { "start": 3.422, "end": 5, "text": "Thanks for watching!" } ] }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` - `start` and `end` are seconds from the start of the video. - `languages` lists every caption language the video has; ask for one with `lang`. If that language is missing, `available` is `false` and `languages` shows what exists. - Photo posts and videos without speech usually have no captions. `has_captions` on any post tells you in advance. ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/transcript" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/transcript", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() t = r.json()["data"] print(t["text"] if t["available"] else "no captions") ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/transcript", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/posts/7300000000000000123/transcript"); 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/tiktok/posts/7300000000000000123/transcript", 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 get the text of a TikTok video? Call `GET /v1/tiktok/post/transcript?url=`. `data.text` is the full transcript and `data.segments` the timed lines. ### Is this speech recognition? No: we read the captions TikTok publishes for the video. When TikTok has none, `available` is `false`. --- # TikTok Music API URL: https://api.handlehaul.com/docs/tiktok-music-api **Get a TikTok sound** (a song or an original audio) and **the posts that use it**. ``` GET https://api.handlehaul.com/v1/tiktok/music/{music} GET https://api.handlehaul.com/v1/tiktok/music/{music}/posts ``` - `GET /v1/tiktok/music/{music}`: title, artist, duration, cover, preview URL, number of posts using it - `GET /v1/tiktok/music/{music}/posts`: posts that use the sound (up to 30 a page) **Cost:** 1 credit per successful call (free from cache). An unknown sound answers `404` and is free. ## Parameters | Parameter | In | Description | |---|---|---| | `music` | path | Numeric sound id (`music.id` on any post) or a URL-encoded `tiktok.com/music/-` link. | | `cursor` | query | posts: `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data`. | ## Response ```json { "data": { "id": "7200000000000000001", "title": "Sample track", "artist": "Sample Artist", "is_original": false, "duration_seconds": 30, "cover_url": "https://p16-sign.tiktokcdn-us.com/…/music/7200000000000000001~c5_720x720.jpeg", "play_url": "https://v16-webapp-prime.tiktok.com/…/music/7200000000000000001.mp3", "post_count": 1200, "url": "https://www.tiktok.com/music/sample-track-7200000000000000001" }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/music/7200000000000000001/posts" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/music/7200000000000000001/posts", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() for p in r.json()["data"]: print(p["author"]["handle"], p["counts"]["views"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/music/7200000000000000001/posts", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/music/7200000000000000001/posts"); 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/tiktok/music/7200000000000000001/posts", 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 many videos use a TikTok sound? `GET /v1/tiktok/music/{id}` returns it in `data.post_count`. --- # TikTok Hashtag API URL: https://api.handlehaul.com/docs/tiktok-hashtag-api **Get a TikTok hashtag** with its post and view counts, and **the posts under it**. ``` GET https://api.handlehaul.com/v1/tiktok/hashtags/{tag} GET https://api.handlehaul.com/v1/tiktok/hashtags/{tag}/posts ``` - `GET /v1/tiktok/hashtags/{tag}`: id, name, description, post count, view count - `GET /v1/tiktok/hashtags/{tag}/posts`: posts under the hashtag (up to 30 a page) **Cost:** 1 credit per successful call (free from cache). An unknown hashtag answers `404` and is free. ## Parameters | Parameter | In | Description | |---|---|---| | `tag` | path | Hashtag name without `#` (`booktok`). For `/posts`, also the numeric `id` from the hashtag call; a name is looked up for you (no extra credit). | | `cursor` | query | posts: `pagination.next_cursor` from the previous page. | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data`. | ## Response ```json { "data": { "id": "5557519", "name": "booktok", "description": "", "post_count": 73117, "view_count": 1995200378, "url": "https://www.tiktok.com/tag/booktok" }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/hashtags/booktok/posts" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/hashtags/booktok/posts", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() for p in r.json()["data"]: print(p["url"], p["counts"]["views"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/hashtags/booktok/posts", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/hashtags/booktok/posts"); 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/tiktok/hashtags/booktok/posts", 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 get TikTok hashtag views? `GET /v1/tiktok/hashtags/{name}` returns `view_count` and `post_count`. --- # TikTok Search API URL: https://api.handlehaul.com/docs/tiktok-search-api **Search TikTok by keyword** for videos, accounts, photo posts, live streams or sounds. ``` GET https://api.handlehaul.com/v1/tiktok/search?q=&type= ``` **Cost:** 1 credit per page (free from cache, kept 15 minutes). ## Parameters | Parameter | In | Description | |---|---|---| | `q` | query | What to search for (1 to 100 characters). | | `type` | query | `top` (default), `users`, `videos`, `photo`, `live` or `music`. | | `region` | query | Optional 2-letter country code (default `US`). | | `cursor` | query | `pagination.next_cursor` from the previous page (keep `q`, `type` and `region` the same). | | `fresh` | query | `true` skips the cache. | | `raw` | query | `true` returns TikTok's own JSON in `data`. | What `data` holds depends on `type`: | `type` | Items | |---|---| | `users` | accounts (the TikTok user shape, with follower and like counts) | | `top` | the video results of TikTok's blended search (account cards are left out; use `users`) | | `videos`, `photo` | posts (the TikTok post shape) | | `live` | live streams: `id`, `title`, `viewer_count`, `cover_url`, `author` | | `music` | sounds (the TikTok sound shape) | ## Response ```json { "data": [ { "id": "6800349351199050453", "sec_uid": "MS4wLjABAAAAFLh-SwKoll0vQk30vGxgf5v9-2wK5VmzQXOonFd1x0s", "handle": "kai_ivy71", "nickname": "Kai Ivy", "avatar_url": "https://p16-sign.tiktokcdn-us.com/…/avatar/6800349351199050453~c5_100x100.jpeg", "is_verified": false, "is_private": false, "url": "https://www.tiktok.com/@kai_ivy71", "counts": { "followers": 1000, "following": null, "likes": 20000, "videos": null } } ], "pagination": { "next_cursor": "eyJ2…sealed…", "has_more": true, "page_size": 10 }, "meta": { "request_id": "req_…", "cached": false, "cache_age_seconds": 0, "credits_charged": 1, "credits_remaining": 26943 } } ``` ## Examples ```bash curl "https://api.handlehaul.com/v1/tiktok/search?q=coffee&type=users" -H "X-Api-Key: $HANDLEHAUL_API_KEY" ``` ```python import os, requests r = requests.get("https://api.handlehaul.com/v1/tiktok/search?q=coffee&type=users", headers={"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}, timeout=60) r.raise_for_status() for u in r.json()["data"]: print(u["handle"], u["nickname"]) ``` ```javascript const res = await fetch("https://api.handlehaul.com/v1/tiktok/search?q=coffee&type=users", { headers: { "X-Api-Key": process.env.HANDLEHAUL_API_KEY }, }); const { data, meta } = await res.json(); ``` ```php $ch = curl_init("https://api.handlehaul.com/v1/tiktok/search?q=coffee&type=users"); 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/tiktok/search?q=coffee&type=users", 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 TikTok accounts by name? Call `GET /v1/tiktok/search?q=&type=users`. Each result has the `handle`, `id` and `sec_uid` to use with the other TikTok endpoints. --- # Acceptable use URL: https://api.handlehaul.com/docs/acceptable-use The HandleHaul API covers **public accounts and publicly visible data only**. It is for product teams, agencies, researchers and AI agents working on their behalf: brand and competitor monitoring, creator research, analytics and reporting, and features in your own product. You may not use it to: - stalk, harass, threaten, intimidate or dox anyone, or monitor a private individual who would not reasonably expect it; - send spam or unsolicited messages to the accounts you look up, or feed contact lists for bulk outreach; - use, test, buy or sell login credentials, session cookies or other people's accounts, or connect the service to any account login; - try to reach private accounts or non-public data, share keys outside your organisation, or get around rate limits or credit charges; - build, enrich, sell or share databases of personal data, or resell raw API output as a data product of its own; - break any law that applies to you, including data-protection law (GDPR, CCPA and similar). You are the controller of the data you collect and need your own lawful basis. AI agents you connect (for example through the MCP server) act for you: these rules apply to what they do with your key. We review usage and suspend accounts that break these rules. Looking someone up never notifies them. Report abuse to [support@handlehaul.com](mailto:support@handlehaul.com). Full terms: [API terms](/terms). --- # Pricing URL: https://api.handlehaul.com/pricing **1 credit = 1 successful call.** Buy a pack once and use it whenever: credits never expire. Failed calls, our own rate-limit answers and cache hits are free, and every response shows what it cost in `meta.credits_charged`. Naming an account by a handle we have to look up first adds **1 credit** ([handles and ids](#handles-and-ids)). ## Credit packs | Pack | Price | Per 1,000 calls | Speed | |---|---|---|---| | 20,000 credits | $29 | $1.45 | 10 requests / second | | 80,000 credits | $99 | $1.24 | 10 requests / second | | 250,000 credits | $249 | $1.00 | 20 requests / second | | 600,000 credits | $499 | $0.83 | 30 requests / second | The speed comes with the largest pack you have bought and applies to the whole account (all keys together). ## Scale Millions of calls a month, more speed or invoicing: Scale contracts start **from $0.75 per 1,000 calls**. Use the form on this page or email support@handlehaul.com. ## What each call costs | Endpoint | Credits per successful call | From cache | |---|---|---| | Every data endpoint on Instagram and TikTok (profiles, followers, following, posts, reels, videos, stories, highlights, comments, likers, hashtags, places, audio and music, transcripts, search) | 1 | 0 | | account, status, resolve | 0 | 0 | ## Handles and ids Endpoints that take a user (`/v1/users/{user}/followers`, `/following`, `/posts`, `/reels`, `/tagged`, `/reposts`, `/stories`, `/highlights`, `/account-details`, `/related`) work on the account's **numeric id**. When you send a **handle**, we look the id up first: - **A handle we have not looked up in the last 7 days adds 1 credit** to that call (`meta.lookup_credits`, header `X-Credits-Lookup`). - **A numeric id never pays it**, and neither does a handle we already know, a later page of a list or the profile endpoint. - Every profile and list item returns the account's `id`: store it once and send ids from then on. ## Price per 1,000 rows List endpoints return many accounts per call, so compare list data per row: | List | Rows per request | Credits per request | Per 1,000 rows (smallest pack) | Per 1,000 rows (largest pack) | |---|---|---|---|---| | Following (about 200 per page, newest first) | 200 | 1 | $0.007 | $0.004 | | Followers (25 per page, newest first) | 25 | 1 | $0.058 | $0.033 | | Likers (about 100 per page) | 100 | 1 | $0.014 | $0.008 | | Comments (about 15 per page) | 15 | 1 | $0.097 | $0.055 | | Posts (about 12 per page) | 12 | 1 | $0.12 | $0.069 | ## Speed | Largest pack bought | Requests per second | Requests in flight | |---|---|---| | 20,000 credits ($29) | 10 | 25 | | 80,000 credits ($99) | 10 | 25 | | 250,000 credits ($249) | 20 | 50 | | 600,000 credits ($499) | 30 | 75 | Before a person has reviewed your account, live keys run at 2 requests a second. Live test calls run at 1 request a second. See [rate limits](/docs/rate-limits). ## FAQ ### How much does the HandleHaul API cost? Credit packs: $29 for 20,000 calls, $99 for 80,000, $249 for 250,000 and $499 for 600,000, from $1.45 down to $0.83 per 1,000 calls. Scale contracts start from $0.75 per 1,000. ### Do credits expire? No. Credits never expire. ### Am I charged for errors or cache hits? No. Only successful live calls cost credits. Errors, private accounts, missing accounts, our own 429 answers and cache hits are free. ### Why did a call cost one more credit? You named the account by a handle we had to look up first (`meta.lookup_credits: 1`). Send the numeric `id` from any profile or list result to skip it. ### Can I test before paying? Yes. Sandbox keys are unlimited and free, with sample data in the live schema. Verify a business email and you also get 100 live test calls on real data. ### Why can I only buy the two smaller packs at first? Accounts that pass our automatic checks can buy the $29 and $99 packs at once. The larger packs open after a person reviews the account, usually within one business day. --- # HandleHaul API terms URL: https://api.handlehaul.com/terms Last updated: 1 December 2026. Draft: the operating entity is still to be confirmed. These terms apply to your use of the HandleHaul API, its dashboard and its MCP server ("the service"), run by HandleHaul, operated by Oxynlabs, LLC, 131 Continental Dr, Suite 305, Newark, DE 19713, USA ("we"). Our [privacy policy](/privacy) explains what we keep about you. ## The service - The service returns data that platforms make publicly visible about public accounts. It never covers private accounts, never needs a social media login from you, and never notifies the accounts you look up. - We do not guarantee that every list is complete: a list call can occasionally miss a row, and platforms do not share follow dates. Do not treat a missing row as proof that someone unfollowed. - We may change prices with 30 days' notice. Credits you already bought keep their value. ## Accounts - You need an account to use live keys. Give accurate details and keep your keys secret; you are responsible for calls made with your keys. - We review new accounts. We may limit, suspend or close an account that gives false details or breaks these terms. ## Acceptable use Your use must follow the [acceptable use policy](/docs/acceptable-use). We may suspend or close an account that breaks it, with or without notice; unused credits on an account closed for abuse are not refunded. ## Billing - Only successful calls are charged: 1 credit per call, 1 more when we have to look up a handle. Failed calls, our own rate-limit answers and cache hits are free. - Credit packs are paid in advance and never expire. Card payments are processed by Stripe. - Scale contracts are agreed in writing and take precedence over this section. ## Your data We keep your email, billing records, an audit log of account changes and request logs (endpoint, status, the handle or id you asked for) for 90 days. For debugging and abuse prevention we also keep a full copy of each request and our response, with the calling IP address, for 14 days; it is never shared and is deleted automatically. Public data is kept only as long as its cache lifetime. Details: [privacy policy](/privacy). ## Changes to these terms We announce material changes by email at least 30 days before they apply to existing accounts. ## Availability and liability The service is provided as is, without a guaranteed uptime unless agreed in a Scale contract. Our liability is limited to the amount you paid us in the three months before the claim. ## Contact support@handlehaul.com --- # Privacy policy URL: https://api.handlehaul.com/privacy Last updated: 1 December 2026. Draft: the operating entity is still to be confirmed. This policy covers the HandleHaul API, its dashboard and its MCP server, run by HandleHaul, operated by Oxynlabs, LLC, 131 Continental Dr, Suite 305, Newark, DE 19713, USA. Questions: support@handlehaul.com. ## What we keep about you (our customers) - **Account:** your email, company, website, what you told us you are building, sign-in records and an audit log of account changes. - **Billing:** what you bought and when. Card details are handled by Stripe; we never see or store card numbers. - **Request logs:** endpoint, status, the handle or id you asked for and the credits charged, for 90 days. A full copy of each request and our response, with the calling IP address, for 14 days for debugging and abuse prevention, then deleted automatically. - **Email:** sign-in links, receipts and account alerts. Product-update emails can be turned off at any time. We use this to run the service, bill you, keep it secure and stop abuse. We do not sell it, and we share it only with the processors that run the service for us (hosting, email delivery, Stripe for payments) or when the law requires it. ## The public data we serve - The service returns data that platforms show publicly about public accounts. **No private accounts, no private messages, no logins.** - Answers are cached for a short time (about a minute for live data, up to 15 minutes for later pages) so repeated calls are fast and free, then deleted. - We do not build profiles of the people you look up, and looking someone up never notifies them. - If you are the owner of a public account and want to ask about data we served, email support@handlehaul.com. ## Your rights You can see and export your account data from the dashboard (Settings), change your email, and close your account. To ask for a copy or deletion of anything else, email support@handlehaul.com from your account email. We keep payment records as long as tax law requires. ## Changes We announce material changes by email before they apply.