Sticky Sessions

To reuse the same proxy across multiple requests, use the session_number parameter by setting it equal to a unique integer for every session you want to maintain (e.g. session_number=123). Requests that share the same session number will continue using the same proxy. To create a new session, simply set the session_number parameter with a new integer to the API. The session value can be any integer. Sessions expire 15 minutes after the last usage.

  • API REQUEST

curl --request GET \
  --url 'https://api.scraperapi.com?api_key=API_KEY&session_number=123&url=https://example.com/'
  • ASYNC REQUEST

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
        "apiKey": "API_KEY",
        "url": "https://example.com/",
        "apiParams": {
          "session_number": "123"
        }
      }' \
  "https://async.scraperapi.com/jobs"
  • PROXY MODE

curl --proxy 'http://scraperapi.session_number=123:[email protected]:8001' \
  -k \
  'https://example.com/'

Last updated