To reuse the same proxy for multiple requests, simply 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). This will allow you to continue using the same proxy for each request with that session number. 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.


require 'net/http'
require 'json'
params = {
  :api_key => "APIKEY",
  :url => "",
  :session_number => 123
uri = URI('')
uri.query = URI.encode_www_form(params)
website_content = Net::HTTP.get(uri)

require 'httparty'
HTTParty::Basement.default_options.update(verify: false)
response = HTTParty.get('', {
  http_proxyaddr: "",
  http_proxyport: "8001",
  http_proxyuser: "scraperapi.session_number=123",
  http_proxypass: "APIKEY"
results = response.body
puts results 
  • SDK Method

# remember to install the library: gem install scraperapi
require "scraper_api"
client ="APIKEY")
result = client.get("", session_number: 123).raw_body
puts result

Last updated