Skip to content

Python library · Setup pages

instagrapi / Python

Point an instagrapi client at a mobile line, keep the session stable and respect the library's own warnings.

instagrapi talks to the private API from Python. Its maintainers caution about account risk with frequently changing IPs and position it for research rather than production; a stable Full Access line per account group, with TMPX managing the IP changes, is the least risky shape.

Proxy string

HTTP proxy URL

http://USER:PASS@HOST:PORT

SOCKS5 proxy URL

socks5://USER:PASS@HOST:PORT

Protocol. HTTP through the proxy URL form. SOCKS5 needs the socks extra of the requests library; keep DNS on the proxy with the socks5h scheme.

Setup steps

instagrapi / Python, step by step

  1. 1Install instagrapi and create a Client.
  2. 2Call set_proxy with the proxy URL before logging in.
  3. 3Log in once, dump the session settings to a file and reuse them; every fresh login is a new device to the platform.
  4. 4Keep one client per account and one line per account group; never move a session between lines.
  5. 5Handle challenge_required, feedback_required and please_wait_a_few_minutes by stopping, not by changing the IP.

IP rotation

When the IP changes

We manage IP rotation on every plan. Rotation links end on 10 December 2026; on Full Access you can choose your own IP change times.

TMPX manages IP rotation on every plan, so the client never calls a link to change the IP. Keep the proxy URL and the saved session stable between runs. When the exit changes, wait for the connection to settle, check the IP through the proxy, and only then continue; do not log in fresh on every change. Heavy IP churn is the pattern the library itself warns about.

from instagrapi import Client

PROXY = "http://USER:PASS@HOST:PORT"

cl = Client()
cl.set_proxy(PROXY)
cl.load_settings("session.json")  # reuse the device; do not log in fresh every run
cl.login("USERNAME", "PASSWORD")

The status link with the current IP is on the line's page in the portal and in the API documentation.

DNS, timezone and leaks

Keep the fingerprint on the line

  • IncludedSet the client's device settings, locale and timezone offset to the line's country before the first login, and keep them stable.
  • IncludedOne line per account group; sessions never move between lines.
  • IncludedSpace actions like a person; the library's delay settings exist for this.

Accounts per line

How many accounts on one line

Research and monitoring can share a line; account operation wants the growth or maintenance numbers.

Platformgrowthmaintenance
Instagram / Threads3 per line8 per line
Open the calculator

Verification checklist

Before the first account

  • IncludedA request through the proxy to an IP-checking API returns a mobile-carrier address in the line's country.
  • IncludedThe first login succeeds without a challenge.
  • IncludedThe session file reloads on the next run without a new login.

What each check proves is on the verification page.

Pitfalls

What goes wrong

  • Fresh logins on every run look like new devices; persist the session.
  • Changing the IP on every error makes things worse; most errors are rate or behaviour signals, not network ones.
  • Links from the portal are not proxy addresses. Only host, port, username and password go into the proxy fields.

Questions

instagrapi / Python and mobile lines

All setup pages

Platform ($54) works when the client only ever reaches Instagram. Full Access ($79) also covers the other sites a script tends to touch, such as IP checkers, which is why it is the recommendation here. Either way, keep one stable line per account group; TMPX manages IP changes on every plan.