Skip to content

Sticky and rotating sessions

A proxy username without sid sends each request through a device chosen for it. With sid-<id>, every request that carries the same key goes to the same device, and rot says how long it stays there: rot-sticky while the device stays in the pool, or a window of minutes after which the session moves to another device. Both are parts of the username an agent already sends, described for the whole journey on Proxies for AI agents.

Updated Read as Markdown

Three ways to send requests

The three modes of a proxy username, from Proxy usernames and the edge's choice of device.
ModeIn the usernameWhere the requests goFits
No sessionno sidA device picked at random for each requestIndependent page fetches
Rotating sessionsid-<id> with rot-auto5, rot-auto10, rot-auto20 or rot-auto60One device for each window of that many minutes, then the next device for the keyLong jobs that should spread over devices in steps
Sticky sessionsid-<id> with rot-sticky, or rot-hard, which means the sameOne device while it stays in the poolSigned-in flows and anything that keeps state on the site
Sources read .

rot needs sid, and auto10 applies when a username has sid and no rot.

What is a session key?

A session key is the <id> in sid-<id>: lower case letters, digits and _, up to the length Proxy usernames gives. The key is part of the username, so no edge stores a session. Every edge ranks the devices for a key the same way, from the account, the other options in the username, the key and the time window, and so every edge picks the same device for the same session.

When does a rotating session move?

At the end of each window. The window of rot-auto5 to rot-auto60 is counted on the clock, from the Unix epoch, not from the session's first request. A session therefore moves at fixed times, and its first window can be shorter than the rest. rot-sticky has no window.

What happens when the device leaves?

A sticky session is a handle on one device while that device stays in the pool. When the device leaves, the session moves to the next device the ranking gives for its key, and requests leave from that device's network from then on, as the stated limits say.

When the device the edge chose is gone, full or closing before the stream opens, the edge tries another, and the attempt costs nothing. A username with failover-none asks for one attempt only: the request is refused rather than sent through a second device.

Which devices can a session reach?

Established devices first. A session reaches a new device that carries fallback supply only when no established device can serve its username, and keeps that device the same way: every edge ranks the fallback devices for a key as it ranks established ones. Once an established device can serve the username, the session moves to it. A username with or without a session, with or without iptype, carrier, asn, state and city, reaches a fallback device when no established device can serve it. A username with pin-device never does.

How do I make session usernames?

POST /app/api/proxy/spawn prints them for a signed-in account. Send rotation as a rot mode and a count, and each string gets its own session key. sessionPrefix names the keys, and save keeps the set on the account. With rotation set to none the answer is one username without a session.

sh
curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d '{"count": 10, "pool": "peer", "country": "de", "protocol": "http", "format": "url", "rotation": "sticky", "sessionPrefix": "job"}' https://coronium.ai/app/api/proxy/spawn

Each string in the answer holds {credential}, which the agent fills in from its own file, and {host} and {port} while the endpoint is closed. Without a session cookie the call is refused with 401 and sign_in_required. Two of the examples in Proxy usernames, for the example account there:

text
0123456789abcdef0123456789abcdef-peer-de
0123456789abcdef0123456789abcdef-peer-us-state-ca-sid-job_1-rot-sticky

The first picks any device in Germany for each request. The second keeps session job_1 on one device in California.

The builder spells a username from its parts: pool, country, state and city, one network key, session key, rotation, failover-none or a device of your own. It runs in the browser, sends nothing to the service, and answers with the username the edge accepts or the refusal the edge would send, in the selector's words for each rule; a value with a dash in it is refused whole, where the edge would name the piece it cannot read. It uses the example account of Proxy usernames; put your own account id in its place.

Your account id without dashes. The guide's example account is filled in.

Where the request leaves from

mbl, carrier modems, is recorded as demand and answered on_request.

Two lower case letters, or any.

Needs a country. Leave empty for any.

Needs a country. Leave empty for any.

Network, at most one

datacenter and isp are recorded as demand and answered on_request.

A carrier slug from the stock list. With a city, use the IP class instead.

Digits, no leading zero. With a city, use the IP class instead.

Session

Lower case letters, digits and _. Empty sends each request to any device.

How long a session stays on one device. It needs a session key.

Your own device

A device you named. It takes country any and no other key.

Accepted: 0123456789abcdef0123456789abcdef-peer-any. No session key: each request may leave from a different device.

Accepted. The username:

0123456789abcdef0123456789abcdef-peer-any

No session key: each request may leave from a different device.

When is a username refused? A username outside the grammar is refused with bad_options: the cause names the token, and the fix shows the username to send. The spawn call refuses sessionPrefix or save with rotation none, because a username without a session has no key to name. The full grammar, with every key and its values, is in Proxy usernames.

Can an account keep its sessions?

Yes. save stores a set of sessions under its prefix, and the stated limits give how many sets an account keeps and how large each can be. GET /app/api/proxy/sessions lists them, newest first, and POST /app/api/proxy/sessions/{prefix}/forget with confirm true removes one. Saved sessions have no traffic counters of their own: the statement counts traffic by day and country.

Which mode fits a job?

  • Send independent page fetches without sid, so each request goes through a device picked for it.
  • Use rot-sticky for a flow that signs in, fills a cart or keeps any state that the site ties to an address.
  • Use a rotating window for a long job that should move between devices at fixed times, and pick the window by how long one device should carry it.
  • Add failover-none when the job must know that its first device was not reached, instead of a second device taking the request.
  • Give each parallel worker its own key, so the workers spread over devices.

The words for these terms are in the glossary, and the cost of a job does not depend on the mode: Pay per GB charges the bytes alone. Connect your agent walks through the calls from sign-up to the first proxy string.