Signup comes with $1 in credit. No subscription needed.Claim your $1

Tools / Instagram / API

Call Instagram post data from a Python script with requests

From Python, the call is a single requests.post to https://api.routergrowth.com/v1/run with your key in the Authorization header and a body naming social.posts, the platform and the handle. The JSON that comes back holds the posts, the run_id and what was charged, ready for a DataFrame or a CSV.

Real run: 5 records $0.004025 per post social.posts MCP · REST · CLI

Ask your agent

Write a Python script that pulls the last 20 Instagram posts for each handle in brands.csv and saves them to posts.csv.

Connect RouterGrowth once, then ask in plain words. New workspaces start with $1 of credit. Get a key or read the setup guide.

A real run

What does it return?

One call to social.posts (social posts & content), run through RouterGrowth on October 19, 2026. These are the first rows it returned; fields that name a person are masked.

5records returned
15.2 sto answer
$0.020125charged for the run
created_attextlikesrepliesviewsis_video
2026-06-09Meet Vanilla Bean, our newest limited-edition flavor of ceramic cookware. A warm, never-boring neutral, it’s a classic for a reason. Don’t…1561289False
2025-09-30✨ Meet the newest member of the Wonder Oven family: the Pro ✨All the wonder you love - air frying, steam infusion, non-toxic materials - no…58201708False
2026-04-13Something’s in the air… a new way to cook your grains. Launching tomorrow, 4/14.328973085297True

Five posts from the public Our Place account, as the script would receive them: product launches with like, reply and view counts.

Step by step

How do you do it?

  1. Put the key in the environment

    Store ROUTERGROWTH_API_KEY as an environment variable and send it as Authorization: Bearer. No Meta app, no OAuth flow.

  2. Post the run

    requests.post to /v1/run with a JSON body: capability social.posts, input with platform, handle and limit, and routing.max_cost as a ceiling.

  3. Read result.posts

    Loop over response.json()['result']['posts']. Each item has url, text, created_at and engagement with likes, replies and views.

  4. Send an Idempotency-Key

    Add the header on retries so a script that runs twice does not pay twice for the same request.

Price

What does it cost?

List prices on Instagram, read from the catalog when this page was built. The exact figure is quoted before every run, and a monthly plan lowers it.

$0.004025per post
$0.002minimum for a call that returns results
$0when the call finds nothing

In practice

What do you ask it?

You describe the job; the agent picks the calls, shows the price and runs them.

Write a Python script that pulls the last 20 Instagram posts for each handle in brands.csv and saves them to posts.csv.

Extend the script: for every post with more than 500 replies, fetch the comments and count the questions.

Connect

How do you connect it?

One MCP server for Claude, ChatGPT, Claude Code, Codex and Cursor, or the same call over the CLI and REST with the input above.

MCP server
claude mcp add --transport http routergrowth https://api.routergrowth.com/mcp
CLI
npm install -g routergrowth && routergrowth setup
routergrowth run -c social.posts -i '{"platform": "instagram", "handle": "ourplace", "limit": 5}'
REST
curl -X POST https://api.routergrowth.com/v1/run \
  -H "Authorization: Bearer $ROUTERGROWTH_API_KEY" \
  -d '{"capability": "social.posts", "input": {"platform": "instagram", "handle": "ourplace", "limit": 5}}'

Worth knowing

What should you know first?

One endpoint for every network

The same /v1/run call reads TikTok, LinkedIn or YouTube posts by changing platform. The record shape stays the same.

Synchronous by default

A short run returns its result in the response. Longer runs return a run_id to poll at /v1/runs/<id>.

Not the Graph API

There is no Instagram SDK to install and no Meta token. RouterGrowth reads public posts independently of Meta.

FAQ

Questions about instagram api python

Is there a Python SDK?

Not needed. The REST call works with requests or httpx, and the CLI covers shell scripts.

What does the script get back?

A JSON object with run_id, status, billing and result.posts. Each post has id, url, text, created_at, author, engagement and is_video.

How do I keep a script from overspending?

Put routing.max_cost in each request. A run whose quote is above it is refused before it bills.

Can I run it on a schedule?

Yes. Cron or any scheduler can call the same endpoint; for repeated reads, watch returns only what changed since the last call.

More on Instagram

Related pages

Reading this as an agent? This page as markdown: /tools/instagram/api-python.md

One key. Every network.

Connect your agent once. The first calls run on the $1 that comes with signup.