Skip to main content

SOCKS5 Proxy

The ScrapeOps Residential Proxy Aggregator supports the SOCKS5 protocol as an alternative to the standard HTTP proxy connection. SOCKS5 is useful for applications and tools that require or prefer SOCKS5 connections over HTTP proxies.

The SOCKS5 endpoint uses a different port from the standard HTTP proxy:

  • Proxy: residential-proxy.scrapeops.io
  • Port: 8282
  • Username: scrapeops (with optional parameters)
  • Password: YOUR_API_KEY
socks5h vs socks5

Use the socks5h:// scheme to have DNS resolution performed by the proxy server rather than locally. This is recommended to avoid DNS leaks and ensure your requests are fully routed through the proxy.


Usage

To connect via SOCKS5, use the socks5h:// protocol scheme with port 8282:


curl --proxy "socks5h://scrapeops:YOUR_API_KEY@residential-proxy.scrapeops.io:8282" "https://ipinfo.io/json"

All advanced functionality parameters (country geotargeting, sticky sessions, mobile IPs, etc.) work with SOCKS5 in the same way as the HTTP proxy — by appending them to the username separated by periods.

For example, to use SOCKS5 with US country geotargeting:


curl --proxy "socks5h://scrapeops.country=us:YOUR_API_KEY@residential-proxy.scrapeops.io:8282" "https://ipinfo.io/json"


Code Examples

Python (requests + PySocks)

To use SOCKS5 with Python requests, install the pysocks package:

pip install requests[socks]

import requests

proxies = {
'http': 'socks5h://scrapeops:YOUR_API_KEY@residential-proxy.scrapeops.io:8282',
'https': 'socks5h://scrapeops:YOUR_API_KEY@residential-proxy.scrapeops.io:8282'
}

response = requests.get('https://ipinfo.io/json', proxies=proxies)
print(response.json())

With country geotargeting:


import requests

proxies = {
'http': 'socks5h://scrapeops.country=us:YOUR_API_KEY@residential-proxy.scrapeops.io:8282',
'https': 'socks5h://scrapeops.country=us:YOUR_API_KEY@residential-proxy.scrapeops.io:8282'
}

response = requests.get('https://ipinfo.io/json', proxies=proxies)
print(response.json())

Node.js (axios + socks-proxy-agent)

npm install axios socks-proxy-agent

const axios = require('axios');
const { SocksProxyAgent } = require('socks-proxy-agent');

const agent = new SocksProxyAgent('socks5h://scrapeops:YOUR_API_KEY@residential-proxy.scrapeops.io:8282');

axios.get('https://ipinfo.io/json', { httpAgent: agent, httpsAgent: agent })
.then(response => console.log(response.data));

cURL with Parameters

You can combine SOCKS5 with any of the supported advanced parameters:


# SOCKS5 with sticky session
curl --proxy "socks5h://scrapeops.sticky_session=42:YOUR_API_KEY@residential-proxy.scrapeops.io:8282" "https://ipinfo.io/json"

# SOCKS5 with mobile IP
curl --proxy "socks5h://scrapeops.mobile=true:YOUR_API_KEY@residential-proxy.scrapeops.io:8282" "https://ipinfo.io/json"

# SOCKS5 with country + city geotargeting
curl --proxy "socks5h://scrapeops.country=ie.city=dublin:YOUR_API_KEY@residential-proxy.scrapeops.io:8282" "https://ipinfo.io/json"