Which IP-check URL your bot should call, and how often
2026-11-04 · Bazyl

After this post your bot will call one IP-check URL at the two moments that matter and skip it everywhere else. The thing most bot code gets wrong is frequency: checking the IP on every request, which on a rotating line tells you nothing and on a sticky line spends data to hear the same answer again.
The check has three jobs. Prove the login works. Prove the session holds. Prove the exit sits in the country you asked for. Nothing more.
The URL should return the IP as plain text, over HTTPS
Pick an echo that answers with the address and nothing else, so the bot compares two
strings instead of parsing a page. https://api.ipify.org returns the IP.
https://ipinfo.io/country returns two letters. Both are what the scripts on this blog
already use.
HTTPS is the important half. Port 2115 is an HTTP proxy, and an https:// target goes
through a CONNECT tunnel, the same way the store's own pages do. An http:// check
skips that path, so it can pass while the tunnel your task needs fails. Check over the
road the task will drive on.
Keep two echo hosts in the config, not one. If an echo goes down mid-session you want a fallback, not a task that thinks its proxy died.
Two checks when a sticky session starts, one before payment
A sticky line carries a -sess- token, and the same session id keeps the same exit.
So the useful checks are few, and each has a decision attached:
- At session start, call the echo twice. Same IP both times means the session holds.
- At session start, call the country echo once. It has to match the store.
- Before the payment step, call the echo once more and compare it with the IP you saved at the start. Different means the home connection behind that exit went away. Restart the task on a new session id.
That is three calls per task, plus one. Here it is in Python, runnable as written with
requests installed once you put in your own login and password:
import requests
PROXY = "http://basl_7k2m9x4z-cc-us-sess-k4mz61pq-ttl-60:[email protected]:2115"
P = {"http": PROXY, "https": PROXY}
ECHOES = ["https://api.ipify.org", "https://icanhazip.com"]
def exit_ip():
for url in ECHOES: # a fallback echo, so one dead echo isn't a dead task
try:
return requests.get(url, proxies=P, timeout=20).text.strip()
except requests.RequestException:
continue
raise SystemExit("no echo answered through the proxy: read the gateway's E-line")
start = exit_ip()
if exit_ip() != start:
raise SystemExit("not sticky: build a new -sess- id")
country = requests.get("https://ipinfo.io/country", proxies=P, timeout=20).text.strip()
if country != "US":
raise SystemExit(f"exit in {country}: check the -cc- token")
# ... the task runs here ...
if exit_ip() != start:
raise SystemExit("IP changed mid-task: restart on a new session id")
print("exit held:", start)
The sticky line above is the bot developers page format: one login, every token on the username, the password carrying nothing.
On a rotating line, an IP check describes only itself
A line without a -sess- token rotates: a new IP on every request. Ask it for its IP and
you learn which exit served the check. The next request goes out somewhere else.
So a monitor on a rotating line doesn't need a per-request check. What it can use is a
sample at startup: five calls to the country echo, all five answering with the -cc-
country. That proves the targeting is right for the whole pool of exits the monitor will
draw from. Then leave it alone. The sticky vs rotating post
covers which task belongs on which kind of line.
Measure what a check costs, then multiply
Every request through the proxy is traffic on your balance, handshake included. A single check is small, so the cost hides in frequency. Measure one instead of guessing:
curl -s -o /dev/null -w 'body bytes: %{size_download} total time: %{time_total}s\n' \
-x "http://USER-cc-us-sess-k4mz61pq-ttl-60:[email protected]:2115" \
https://api.ipify.org
The body is a few dozen bytes; the TLS handshake around it is the bigger part, and curl's body count doesn't include it. As a made-up example, say a full check costs 6 KB on the wire and a bot runs 40 tasks:
- Three checks per task: 40 × 3 × 6 KB = 720 KB. Nothing.
- A check every 5 seconds for 2 hours: 40 × 1,440 × 6 KB = 345.6 MB, about a third of a gigabyte spent asking the same question.
One GB is 1,000 MB here, everywhere. The second bullet is a bot that pays for a heartbeat.
When the check fails, read the line, not the timeout
A failed check is the cheapest diagnosis you'll get, because the gateway says why in one line with the status code. The bot should log that line instead of a generic "proxy error":
E53 login not ready yet(503): a brand-new login warms up for a minute or two. Wait.E01 invalid proxy login(407): the pair doesn't match, often a token on the password.E20 no exit for this targeting(460): a city or ISP token with no free exit right now. Widen it yourself; it never falls back.E50 exit failed, retry with a new session(502): new-sess-id, then retry.E21 target not allowed(403): the gateway won't open that target. If it's your echo, switch echoes.E02 no data left on this login(402): the balance is spent and retries won't help.
The warm-up post covers the first case in detail, and the docs list every code.
An idle tunnel closes after about 60 seconds
A tunnel with nothing on it for about 60 seconds is closed. A bot that opens a connection for the start-of-session check, waits five minutes, then reuses it, will hit a closed socket and might log it as a proxy failure.
It isn't one. Open a new connection with the same string: the session id still points at the same exit until its ttl runs out. Before payment, that fresh connection is also your third check.
The statistics page shows if you're checking too often
The dashboard's statistics page has a per-domain table of your top targets. Your echo host appears there like any other domain. If it sits near the top, above the store, the bot is spending more on checks than on work, and the fix is in your loop, not in the proxy.
Take the Python above, wire it into your task runner, and start from the strings on the bot developers page.
Common questions
- Which URL should a bot use to check its proxy IP?
- Any IP echo that answers with the address as plain text over HTTPS, such as api.ipify.org, plus one that answers with the two-letter country, such as ipinfo.io/country. HTTPS matters because it goes through the same CONNECT tunnel as the store traffic, so the check tests the path the task will use.
- How often should a bot check its proxy IP?
- On a sticky line, twice when the session starts (the same IP both times, in the right country) and once before the payment step. On a rotating line, not per request at all: every request gets a new IP, so the answer describes the check and nothing after it.
- What does it mean when the IP check fails through the proxy?
- Read the one line the gateway sends back. E53 means a brand-new login is still warming up, E50 means retry on a new session id, E20 means the targeting has no free exit right now and never widens on its own, E02 means the balance is spent. Each code has one fix.
- Does an IP check use data?
- Yes, every request through the proxy is billed traffic, the TLS handshake included. A check is small, but a check every few seconds on every task adds up. Measure one with curl's size_download and multiply by your own task count.