Session Control

Establishing session

The session ID parameter allows you to keep the same IP address to run multiple requests. To reuse the same IP multiple times, use sessid parameter after username with randomly created alphanumeric string, for example, sessid-abcde12345.

The standard session time is 10 minutes or up to 60s of inactivity (no requests). After that, a new IP address is assigned automatically. To adjust desired session time please refer to Session time.

For example, your initial query with sessid-abcde12345 assigned proxy IP address 1.1.1.1. As long as you keep sending new requests with the same session ID and that IP address is online and available, the system will route your queries through 1.1.1.1. If you stop sending requests for 60 seconds or the IP address is no longer online, the system will assign a new proxy IP. Your next query with sessid-abcde12345 will be routed through a different IP address e.g. 1.1.1.2.

Credentials list example:

Example represents a list of credentials that establish different sessions.

customer-USERNAME-sessid-iqwcp:PASSWORD
customer-USERNAME-sessid-tevab:PASSWORD
customer-USERNAME-sessid-6drwn:PASSWORD
customer-USERNAME-sessid-7eh7g:PASSWORD
customer-USERNAME-sessid-z7cao:PASSWORD

Code example

In this example we are using German IP with sessid-abcde12345 in the username with the first request. All following requests will keep the same German IP with further queries:

curl -x pr.oxylabs.io:7777 -U "customer-USERNAME-cc-DE-sessid-abcde12345:PASSWORD" https://ip.oxylabs.io/location

Session time

The sesstime parameter goes together with sessid, and allows you to prolong the session above 10 minutes or set a particular time for it. This parameter can be set for up to 30 minutes.

Session time parameter does not ensure that all your queries are finished by the end of the session. The session will expire within the time limit set, even if requests are not finished.

Credentials list example:

Example represents a list of credentials that establish different sessions with different sessions time (minutes).

customer-USERNAME-sessid-iqwcp-sesstime-5:PASSWORD
customer-USERNAME-sessid-tevab-sesstime-12:PASSWORD
customer-USERNAME-sessid-6drwn-sesstime-30:PASSWORD
customer-USERNAME-sessid-7eh7g-sesstime-6:PASSWORD
customer-USERNAME-sessid-z7cao-sesstime-16:PASSWORD

Code example

We chose the same German IP as in the previous example, this time we are adding sessidstring and sesstime parameter for 7 minutes:

curl -x pr.oxylabs.io:7777 -U "customer-USERNAME-cc-DE-sessid-abcde12345-sesstime-7:PASSWORD" https://ip.oxylabs.io/location

To set up sticky proxy entry nodes, learn more here.

Last updated