Session behaviour
Choose rotating, sticky, or static continuity and manage sticky-session lifetime.
Choose how long connection identity should persist
Session behaviour controls continuity; it does not change the selected proxy
type or geographic target. Send only a value returned in session_types for
the current proxy type.
| Session type | Behaviour | Use when |
|---|---|---|
rotating | The exit address may change between requests. Rotation is not guaranteed on every request. | Requests are independent and broad distribution is useful. |
sticky | Related requests retain connection continuity for an accepted lifetime. | A multi-request flow needs a consistent address temporarily. |
static | The assigned endpoint remains stable while the allocation is active. | The options endpoint explicitly offers a fixed allocation. |
Configure a sticky session
Read sticky_session.lifetime_minutes from the options response. It contains
the current minimum, maximum, and default for the selected proxy type. Do not
hard-code those limits.
{
"proxy_type": "residential",
"session_type": "sticky",
"session_id": "catalog_check_1",
"lifetime_minutes": 30,
"country": "GB",
"protocol": "http"
}session_id is optional. When supplied, it must contain 1–25 letters, numbers,
or underscores. Hyphens and spaces are not accepted. Send session_id and
lifetime_minutes only for sticky sessions.
The create response returns the accepted session_id, lifetime_minutes, and
port. Store those values with the short-lived workflow state; do not extract
them from the returned proxy username.
Release a sticky session early
When early release is available, send the returned session ID and port:
curl --fail-with-body --silent --show-error \
-X PUT 'https://api.raspbytes.com/api/v1/proxy/proxies/release_sticky_session/' \
-H "X-API-Key: $RASPBYTES_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"proxy_type": "residential",
"session_id": "catalog_check_1",
"port": 10000
}'Early release is not available for every proxy connection. If it is unavailable,
stop using the connection and allow it to expire at the accepted lifetime. Never
reuse a sticky session ID concurrently for unrelated workflows.
Updated 16 days ago

