SurSolver

BlogProxies for CAPTCHA Solving: Sticky Sessions and IP Matching

Proxies for CAPTCHA Solving: Sticky Sessions and IP Matching

· Updated · 9 min read

Which task types need your proxy, how to keep one exit IP for the whole flow, how to send the proxy to createTask, and how to find out why a proxy fails before it costs you tasks. The proxy is not a universal requirement — most types solve without one — so the first skill is knowing which kind of task you are in.

When a task needs your proxy

The proxies guide sorts every type into one of three modes:

  • Required. Cloudflare Challenge, Vercel, Akamai SBSD, CaptchaFox, DataDome and PerimeterX have no proxyless name. A proxyless name for any of them answers ERROR_TYPE_NOT_SUPPORTED.
  • Optional. reCAPTCHA v2 and v3 (standard and Enterprise), Turnstile, FriendlyCaptcha, Prosopo, GeeTest and MTCaptcha. The …TokenProxyLess name never needs a proxy. The proxy-capable …Token name does: sending it without proxy details is rejected with ERROR_INVALID_REQUEST.
  • None. Altcha, AWS WAF Challenge, Akamai _abck, Akamai BMP, Castle Android, Kasada and Shape need no caller proxy. Both accepted names work, and a supplied proxy is not used.

If a type offers a proxyless name, start there. A proxy helps only where the receiving site ties the result to the IP that earned it, and the symptom is specific: a valid-looking token is refused, while the same flow in your own browser works. If the solve itself fails, a proxy is not the fix.

For the required types the contract is solve/replay consistency: the task's proxy is the exit the solve runs from, and the request that carries the result has to present that same exit with the task's userAgent. That is a property you control end to end, which is exactly why these types take your proxy instead of shared infrastructure.

One exit IP for the whole flow

For the cookie types the flow has four steps: load the page and trigger the block, create the task, receive the solution, replay it. The proxy in the task is the IP the solve runs from, so every request you make yourself must leave from the same address. The Cloudflare challenge guide puts it plainly: cf_clearance is bound to the exit IP and the user agent, and a rotating proxy makes Cloudflare treat you as cookieless again. Cloudflare Challenge with Playwright runs all four steps through one proxy, in a browser and from a plain HTTP client.

Token types behave the same when a site checks the IP. CaptchaFox is the documented widget case: its token is tied to the IP that solved it, and its guide names invalid-ip-match as the failure its server-side verification reports when the submit comes from another address (CaptchaFox guide).

One sticky proxy session: the blocked GET, the createTask call and the replayed GET all leaving from the same exit IP

Sticky or rotating

A rotating gateway hands out a different exit IP per request or per interval. A sticky session keeps one IP for a period. For anything that must match, rotating turns "same IP" into a coin flip, so use a sticky session or a static address.

How you pin a session is specific to your proxy provider; look for "sticky session" in its documentation. The solver guides that discuss sessions give the ballpark: the Cloudflare Challenge guide asks for a static or sticky session kept for at least about three minutes, and the CaptchaFox guide for at least five per solve. Size the session to cover the block, the solve and every replayed request; interactive challenges take longer than managed ones.

Keep one session per flow: its own IP, its own user agent, its own cookies. Do not share a pinned IP between unrelated flows on the same site, and do not change anything mid-flow.

Choose the proxy class

No provider is ranked here, and the API does not require a class — but the target's edge has opinions, and the classes behave differently:

  • Datacenter. Cheap and fast, and the addresses are public knowledge: anti-bot vendors commonly refuse datacenter ranges outright. The proxies guide treats this as the default expectation; treat datacenter exits as a fit for low-protection targets and smoke tests.
  • Residential. Addresses that look like home users. For the required types this is the usual working class, held in a sticky session for the whole flow.
  • Static ISP. A residential-class address that does not rotate, so there is no session to pin — the simplest fit for the required types.
  • Mobile. The least-flagged addresses, typically the reserve for targets that keep refusing residential exits.

Match the country to the site's audience and to the Accept-Language you send, and test the combination against your target: class advice is a starting point, not a verdict. The surest way to need less of this is to pick a proxyless task type when the target allows one.

Send the proxy to createTask

task.proxy accepts only http:// and socks5://. Without a scheme, host:port uses HTTP. https:// and socks4:// are rejected with ERROR_INVALID_REQUEST before charging, rather than reaching the manager and failing with 400 ERR_FLOW_INVALID:

snippet.txt
http://user:password@203.0.113.10:8000
socks5://user:password@203.0.113.10:1080
user:password@203.0.113.10:8000
203.0.113.10:8000

A string with exactly four colon-separated parts is always read as user:password:host:port. Many providers hand out host:port:user:password instead, and that string is not rejected when it happens to parse the other way. 203.0.113.10:8000:user:12345 becomes user 203.0.113.10, password 8000, host user, port 12345. The task is accepted, charged, and run through the wrong proxy.

The split fields avoid the problem because nothing depends on order. They are read only when task.proxy is absent or empty:

snippet.json
{
  "clientKey": "sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "task": {
    "type": "ReCaptchaV2Token",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36",
    "websiteURL": "https://example.com/login",
    "websiteKey": "6Le...",
    "proxyType": "http",
    "proxyAddress": "203.0.113.10",
    "proxyPort": 8000,
    "proxyLogin": "user",
    "proxyPassword": "password"
  }
}

proxyAddress and proxyPort go together; proxyType is http or socks5, defaulting to http when omitted. Other schemes are rejected, not converted to HTTP. proxyLogin and proxyPassword are optional. The proxy belongs to the task, not to the account: every createTask that needs one carries its own details.

This helper converts a host:port:user:password string into split fields, creates the task and polls every 3 seconds. The 180-second deadline is yours to choose; the docs state no maximum solve time.

solve.py
import time

import requests

API = 'https://api.sursolver.com'
POLL_SECONDS = 3
DEADLINE_SECONDS = 180
REQUEST_TIMEOUT_SECONDS = 30


def call(path: str, body: dict) -> dict:
    response = requests.post(f'{API}{path}', json=body, timeout=REQUEST_TIMEOUT_SECONDS)
    response.raise_for_status()  # HTTP 500 carries no errorId: a transport failure
    data = response.json()
    if data.get('errorId'):
        raise RuntimeError(f"{data['errorCode']}: {data['errorDescription']}")
    return data


def split_fields(raw: str) -> dict:
    """Turn host:port:user:password into the split proxy fields."""
    host, port, login, password = raw.split(':', 3)
    return {
        'proxyType': 'http',
        'proxyAddress': host,
        'proxyPort': int(port),
        'proxyLogin': login,
        'proxyPassword': password,
    }


def solve(raw_proxy: str) -> dict:
    key = 'sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    task = {
        'type': 'ReCaptchaV2Token',
        'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36',
        'websiteURL': 'https://example.com/login',
        'websiteKey': '6Le...',
        **split_fields(raw_proxy),
    }
    task_id = call('/createTask', {'clientKey': key, 'task': task})['taskId']
    deadline = time.monotonic() + DEADLINE_SECONDS
    while time.monotonic() < deadline:
        time.sleep(POLL_SECONDS)
        result = call('/getTaskResult', {'clientKey': key, 'taskId': task_id})
        if result['status'] == 'ready':
            return result['solution']
    raise TimeoutError(f'task {task_id} still processing after {DEADLINE_SECONDS}s')

IP-authenticated proxies

A bare host:port is how IP-allowlisted proxies are used: the proxy trusts a list of source addresses instead of a login. The SurSolver docs do not publish the addresses that solves run from, so you have no list to give your proxy provider. Use a proxy with username and password credentials, and ask support before you depend on an allowlist.

Test the proxy before you submit

A task is charged when it is accepted, and a task that finishes as failed automatically returns its original charge once. A dead proxy prevents a useful result. Check it from your own machine first. https://ip-echo.example/ip stands for any service that returns the caller's IP address; use one you trust:

snippet.powershell
$proxy = 'http://user:password@203.0.113.10:8000'
Invoke-RestMethod -Uri 'https://ip-echo.example/ip' -Proxy $proxy
Start-Sleep -Seconds 30
Invoke-RestMethod -Uri 'https://ip-echo.example/ip' -Proxy $proxy

Both answers should show the proxy's address, not yours, and they should match. If the second differs, the session is not sticky.

When a proxy fails

What you see Likely cause What to do
ERROR_INVALID_REQUEST from createTask Unparseable string, unknown scheme, missing or non-numeric port, or a proxy-capable name without a proxy Fix the named field. Nothing was created or charged.
Accepted, then ERROR_FAILED The solve failed; errorDescription carries the reason. The target may have blocked the proxy IP Submit a new task through a different proxy. It is a new charge.
ready, but the target refuses the result A different IP or user agent on replay, a rotating gateway, or a client whose TLS differs from a browser Replay from the same exit with task.userAgent. See headers and user agents.
DataDome challenge URL has t=bv The IP is banned at network level and solving cannot clear it Rotate the IP and trigger the block again; DataDome guide
Task ran through the wrong proxy A four-part string in the other order Use the split fields.

When blocks are frequent rather than occasional, the cause is usually your request pattern, not one proxy. Stop getting blocked while scraping covers that.

Prove it with one task

Check the proxy mode of your type in the proxies guide — the table there is the contract, and this post is the working notes for it. Send one createTask with the split fields, replay through the same exit with task.userAgent, and read Errors for what each failure means.

More articles