Samurai Proxies Documentation
Complete reference for proxy usage, authentication, protocols, code examples, and country coverage. Everything you need to integrate proxies with your tools.
Quickstart
Register
Go to /sign-up and create an account. Verify your email with the OTP code sent to you.
Get your proxy key
After signing in, go to your dashboard. Your proxy key (starts with sam-) is shown in your allocation details.
Connect
Use any HTTP/SOCKS5 client. Your proxy endpoint is samuraiproxy.net:8081. The username is your routing string (e.g. res-us) and the password is your proxy key.
# Quick test — see your exit IP
curl -x "http://res-us:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
https://httpbin.org/ipProxy types
7 proxy types are available. Each type determines how IPs are assigned and rotated. The type is the first part of your username.
| Code | Name | Description |
|---|---|---|
res | Residential (Rotating) | Rotates IP on every request. Best for scraping and general use. |
res_sc | Residential (State/City) | Target a specific country, state, and city with rotating residential IPs. |
res_ls | Residential (Long Session) | Hold the same IP for extended sessions up to 1 hour. |
stc | Static ISP Residential | ISP-grade static IPs that don't rotate. Great for accounts and automation. |
stc_sc | Static ISP (State/City) | Static ISP IPs targeted to a specific state and city. |
mob | Mobile | Real mobile carrier IPs (3G/4G/5G). Highest trust scores. |
dc | Datacenter | Fast datacenter IPs. Cheapest bandwidth, best for speed-critical tasks. |
Use any as the country code to get a random location. Use gb or uk interchangeably for United Kingdom.
Authentication
Every proxy request requires authentication. Your proxy key (starts with sam-) is your password. The username determines the proxy type, country, and routing options.
# HTTP / HTTPS proxy
Proxy-Authorization: Basic base64(username:proxy_key)
# SOCKS5
username = routing_string (e.g. res-us)
password = proxy_key (e.g. sam-abc123...)
# Example
curl -x "http://res-us:sam-your-key@samuraiproxy.net:8081" https://httpbin.org/ipUsername format
The username controls routing. The password is always your proxy key.
Basic country targeting
{type}-{country}
res-any # Residential rotating, random country
res-us # Residential rotating, United States
stc-nl # Static ISP, Netherlands
mob-uk # Mobile, United Kingdom
dc-de # Datacenter, GermanySticky session (same IP for multiple requests)
{type}-{country}-sid-{session_id}
res-us-sid-123456789 # Same IP while session is alive
stc-jp-sid-987654321 # Static sticky session
mob-any-sid-123456789 # Mobile sticky session
dc-any-sid-123456789 # Datacenter sticky sessionState / City targeting
{type}_sc-{country}_{city}
{type}_sc-{country}_{state}_{city}
res_sc-nl_amsterdam # Residential, Amsterdam
stc_sc-nl_amsterdam # Static ISP, Amsterdam
res_sc-us_california_losangeles # Residential, LA
res_sc-us_new_york_newyork # Residential, NYC
stc_sc-us_texas_dallas # Static ISP, Dallas
res_sc-us_florida_miami # Residential, MiamiState and city names are lowercase, no spaces. Multi-word names use underscores (e.g. new_york).
Long Session ID (LSID)
res-{country}-Lsid-{id}-TTL-{seconds}
res-us-Lsid-875078898-TTL-3600 # Long session, up to 1 hour
res-any-Lsid-123456789-TTL-1800 # Global, 30 minutesSessions persist for the specified TTL (60–3600 seconds).
ASN targeting
res-{country}-asn-{number}
res-af-asn-55330 # Afghanistan, specific network
res-us-asn-14615 # United States, specific networkTarget a specific ISP or network by ASN number. ASN targeting is country-scoped and cannot be combined with session ID.
Supported protocols
Use the proxy endpoint samuraiproxy.net:8081. The same endpoint accepts all supported proxy protocols; your client chooses the protocol.
| Protocol | Description |
|---|---|
| HTTP | Standard HTTP proxy with CONNECT tunneling for HTTPS sites. |
| HTTPS (CONNECT) | CONNECT tunnel for HTTPS targets. Most common use case. |
| SOCKS5 | Full SOCKS5 with username/password auth. Best compatibility. |
Code examples
cURL
# HTTP proxy
curl -x "http://res-us:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
https://httpbin.org/ip
# SOCKS5
curl --socks5-hostname "res-us:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
https://httpbin.org/ip
# Sticky session
curl -x "http://res-us-sid-123456789:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
https://httpbin.org/ip
# State / City
curl -x "http://res_sc-us_california_losangeles:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
https://httpbin.org/ip
# Long session (LSID, 1 hour)
curl -x "http://res-us-Lsid-875078898-TTL-3600:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
http://httpbin.org/ipPython (requests)
import requests
PROXY_KEY = "sam-your-proxy-key"
ENDPOINT = "samuraiproxy.net:8081"
# Rotating residential US
proxies = {
"http": f"http://res-us:{PROXY_KEY}@{ENDPOINT}",
"https": f"http://res-us:{PROXY_KEY}@{ENDPOINT}",
}
r = requests.get("https://httpbin.org/ip", proxies=proxies)
print(r.json())
# Sticky session
proxies = {
"http": f"http://res-us-sid-123456789:{PROXY_KEY}@{ENDPOINT}",
"https": f"http://res-us-sid-123456789:{PROXY_KEY}@{ENDPOINT}",
}
r = requests.get("https://httpbin.org/ip", proxies=proxies)
print(r.json())Node.js (undici / fetch)
import { ProxyAgent } from "undici";
const PROXY_KEY = "sam-your-proxy-key";
const ENDPOINT = "samuraiproxy.net:8081";
const agent = new ProxyAgent(
`http://res-us:${PROXY_KEY}@${ENDPOINT}`
);
const res = await fetch("https://httpbin.org/ip", {
dispatcher: agent,
});
console.log(await res.json());Go (net/http)
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
proxyURL, _ := url.Parse("http://res-us:sam-your-proxy-key@samuraiproxy.net:8081")
client := &http.Client{
Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
}
resp, _ := client.Get("https://httpbin.org/ip")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}PHP (cURL)
<?php
$ch = curl_init("https://httpbin.org/ip");
curl_setopt($ch, CURLOPT_PROXY, "samuraiproxy.net:8081");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "res-us:sam-your-proxy-key");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
curl_close($ch);C# / .NET (HttpClient)
using System.Net;
using System.Net.Http;
var proxy = new WebProxy("http://samuraiproxy.net:8081")
{
Credentials = new NetworkCredential("res-us", "sam-your-proxy-key"),
};
var handler = new HttpClientHandler { Proxy = proxy };
using var client = new HttpClient(handler);
Console.WriteLine(await client.GetStringAsync("https://httpbin.org/ip"));Environment variables
export HTTP_PROXY="http://res-us:YOUR_PROXY_KEY@samuraiproxy.net:8081"
export HTTPS_PROXY="http://res-us:YOUR_PROXY_KEY@samuraiproxy.net:8081"
export ALL_PROXY="socks5://res-us:YOUR_PROXY_KEY@samuraiproxy.net:8081"
# Now any CLI tool that reads these vars will use the proxy
curl https://httpbin.org/ip
wget -qO- https://httpbin.org/ipSessions
Sticky sessions append -sid-SESSION_ID to the username to reuse the same IP across multiple requests. The session stays alive as long as traffic flows through it.
Long Session ID (LSID) keeps the same IP for up to 1 hour. Set TTL between 60 and 3600 seconds.
# Sticky session — same IP for multiple requests
curl -x "http://res-us-sid-123456789:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
https://httpbin.org/ip
# Long session — same IP for up to 1 hour
curl -x "http://res-us-Lsid-875078898-TTL-3600:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
https://httpbin.org/ipUse a fresh random session ID per logical session to avoid cross-customer collisions. Session IDs range from 10000 to 999999999.
Web Scraper API
Scrape any website through our proxy network directly from your dashboard or via API. Returns clean HTML, markdown, text, or structured JSON.
API endpoint
POST /api/scraper/scrape
Content-Type: application/json
Cookie: samurai_session=YOUR_SESSION_COOKIE
{
"url": "https://example.com",
"format": "markdown",
"proxyType": "res-us",
"selector": "h1, .title"
}Parameters
| Field | Type | Description |
|---|---|---|
| url | string (required) | Target URL to scrape. |
| format | html | markdown | text | json | Output format. Default: html. |
| proxyType | string | Proxy routing string (e.g. res-us, res-uk). Default: res-us. |
| selector | string (optional) | CSS selector to extract specific elements. Works with html and json formats. |
Response
{
"url": "https://example.com",
"status": 200,
"title": "Example Domain",
"content": "# Example Domain
This domain...",
"format": "markdown",
"selector": null,
"proxyType": "res-us",
"exitIp": null,
"latency": 3456,
"contentLength": 1234
}Code examples
import requests
r = requests.post(
"https://samuraiproxy.net/api/scraper/scrape",
json={
"url": "https://news.ycombinator.com",
"format": "json",
"selector": ".titleline > a",
"proxyType": "res-us"
},
cookies={"samurai_session": "YOUR_COOKIE"}
)
print(r.json())const r = await fetch(
"https://samuraiproxy.net/api/scraper/scrape",
{
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({
url: "https://news.ycombinator.com",
format: "markdown",
proxyType: "res-us"
})
}
);
console.log(await r.json());Error codes
The proxy returns standard HTTP status codes for all rejections.
| Code | Meaning | What to do |
|---|---|---|
200 | OK / Connection established | Request succeeded. CONNECT tunnels open here. |
400 | Bad Request | Malformed request line or unsupported method. |
403 | Forbidden | Target is private/loopback (SSRF), restricted by policy, or your data limit is exhausted. |
407 | Proxy Authentication Required | Missing or wrong credentials. Username is your routing string (e.g. res-us); password is your proxy key. |
408 | Request Timeout | Client request body did not arrive in time. Retry with a fresh connection. |
429 | Too Many Requests | Per-user concurrent-connection cap hit. Slow down or upgrade. |
502 | Bad Gateway | Upstream connection failed. Retry; if persistent, check the country/type combo. |
503 | Service Unavailable | Service temporarily busy. Backoff and retry. |
504 | Gateway Timeout | Upstream took too long to respond. Retry; the target may be slow or blocking proxy traffic. |
SOCKS5 reply codes follow RFC 1928: 0x00 success, 0x02 connection not allowed (403/407 equivalent), 0x03 network unreachable, 0x04 host unreachable, 0x05 connection refused, 0x06 TTL expired, 0x08 address type not supported.
Limits & fair use
| Parameter | Value | Notes |
|---|---|---|
| Concurrent connections | 50 per user | Max 500 total across all users. |
| DNS resolution | At exit node | Targets forwarded as hostnames so DNS resolves in the exit country. |
| Long-session hold | ~60 minutes | Token-bound sessions can stay stable for about an hour. |
| Sticky session (SID) | 10000–999999999 | Numeric session IDs. |
| Connection timeout | 15 seconds | Upstream connection must establish within 15s. |
| Idle timeout | 120 seconds | Connections with no data flow are closed. |
| Restricted destinations | RFC1918 / loopback | Requests to private IP ranges and cloud metadata are refused (SSRF protection). |
Best practices
Pick the right product
Use res for general scraping, stc for accounts that need a stable identity, mob for highest trust scores, and dc for speed-critical tasks.
Use sticky sessions for logged-in flows
Anything requiring session continuity (cookies, OAuth, multi-step forms) should use res-{country}-sid-{N}. Reuse the same N for every request in the same browsing context.
Backoff on 502 / 504, not on 403
Upstream errors are transient — exponential backoff with jitter (250ms → 500ms → 1s) typically recovers within 2 retries. 403 means policy denial; retrying won't help.
Match country to the target
Most anti-bot systems weight source country heavily. Scraping a UK site from a US IP raises risk score. Align exit country with target audience.
Don't hammer one IP
Even with sticky sessions, sending 1000 requests/second from one IP gets you blacklisted. Spread load across many session IDs — that's what the rotating pool is for.
Pre-warm important sessions
If a session must hold a specific IP for an hour, fire a low-cost request through it every 60–90 seconds. Idle sessions can rotate out; constant traffic anchors them.
FAQ
Why is the same hostname returning different IPs on every call?
By default, residential, mobile, and datacenter proxies rotate the exit IP on every request. If you need the same IP across multiple calls, use res-{country}-sid-{N} where N is any integer from 10000 to 999999999.
How long does a sticky session last?
Sticky sessions stay bound to one IP as long as you keep sending traffic. A long idle gap (typically more than 5–10 minutes) can cause the IP to recycle. Keep a periodic low-cost request flowing to hold the IP longer.
Why am I getting 407 Proxy Authentication Required?
The proxy password is your proxy key (starts with sam-). Double-check you're using the correct key from your dashboard, and that the username is a valid routing string (e.g. res-us).
Why is my request blocked with 403?
Three reasons: (1) the target hostname resolves to a private IP range and the SSRF filter refuses; (2) the target domain is restricted by policy; (3) your data limit is exhausted.
Does HTTPS to the target still work through the proxy?
Yes — HTTPS targets use HTTP CONNECT to open an encrypted tunnel through the proxy, so the target traffic is end-to-end encrypted. The proxy never sees the plaintext of HTTPS bodies.
Can I use the proxy with browser automation (Playwright, Puppeteer, Selenium)?
Yes. Set the proxy at launch as http://username:proxy_key@samuraiproxy.net:8081. Use a sticky SID per browser instance so cookies persist with the same IP.
What happens when I run out of data?
Active connections drain to completion; new connections receive 403 Forbidden. Top up your allocation from the dashboard to resume immediately.
Do you support concurrent connections from multiple machines?
Yes. Up to 50 concurrent connections per user from any number of source IPs. Each connection counts independently toward your data usage.
Country coverage
203 countries available for residential, static ISP, and mobile proxy types. Use the 2-letter country code in your username. Use any for random location.
North America
27 countriesUSUnited StatesCACanadaMXMexicoPRPuerto RicoGTGuatemalaHNHondurasSVEl SalvadorNINicaraguaCRCosta RicaPAPanamaBZBelizeCUCubaJMJamaicaHTHaitiDODominican RepublicTTTrinidad and TobagoBSBahamasBBBarbadosAGAntigua and BarbudaDMDominicaGDGrenadaLCSaint LuciaAWArubaBMBermudaGPGuadeloupeMQMartiniqueTCTurks and CaicosEurope
45 countriesUKUnited KingdomDEGermanyFRFranceNLNetherlandsITItalyESSpainSESwedenNONorwayDKDenmarkFIFinlandPLPolandATAustriaBEBelgiumCHSwitzerlandPTPortugalIEIrelandCZCzech RepublicRORomaniaHUHungaryGRGreeceBGBulgariaHRCroatiaSKSlovakiaSISloveniaRSSerbiaUAUkraineBYBelarusLTLithuaniaLVLatviaEEEstoniaISIcelandLULuxembourgMTMaltaALAlbaniaBABosnia and HerzegovinaMEMontenegroMKNorth MacedoniaMDMoldovaADAndorraMCMonacoSMSan MarinoLILiechtensteinGGGuernseyGIGibraltarFOFaroe IslandsAsia
50 countriesJPJapanKRSouth KoreaCNChinaTWTaiwanHKHong KongMOMacaoSGSingaporeMYMalaysiaTHThailandVNVietnamIDIndonesiaPHPhilippinesINIndiaBDBangladeshPKPakistanLKSri LankaNPNepalKHCambodiaLALaosMMMyanmarBNBruneiMNMongoliaKGKyrgyzstanKZKazakhstanUZUzbekistanTJTajikistanTMTurkmenistanAZAzerbaijanGEGeorgiaAMArmeniaTRTurkeyCYCyprusILIsraelJOJordanLBLebanonIQIraqIRIranSASaudi ArabiaAEUnited Arab EmiratesQAQatarKWKuwaitBHBahrainOMOmanYEYemenSYSyriaAFAfghanistanBTBhutanMVMaldivesTLTimor LesteRURussiaSouth America
14 countriesBRBrazilARArgentinaCLChileCOColombiaPEPeruVEVenezuelaECEcuadorUYUruguayPYParaguayBOBoliviaGYGuyanaSRSurinameGFFrench GuianaFKFalkland IslandsAfrica
53 countriesZASouth AfricaNGNigeriaEGEgyptKEKenyaGHGhanaMAMoroccoTNTunisiaDZAlgeriaETEthiopiaTZTanzaniaUGUgandaRWRwandaSNSenegalCIIvory CoastCMCameroonAOAngolaMZMozambiqueMGMadagascarZMZambiaZWZimbabweBWBotswanaNANamibiaMUMauritiusGAGabonCGCongoMLMaliBFBurkina FasoNENigerTDChadSDSudanSSSouth SudanSOSomaliaDJDjiboutiEREritreaLYLibyaMWMalawiLSLesothoSZEswatiniSCSeychellesCVCape VerdeKMComorosGMGambiaGNGuineaGWGuinea-BissauGQEquatorial GuineaBJBeninTGTogoSLSierra LeoneLRLiberiaCFCentral African RepublicBIBurundiSTSao Tome and PrincipeMRMauritaniaOceania
13 countriesAUAustraliaNZNew ZealandFJFijiPGPapua New GuineaNCNew CaledoniaPFFrench PolynesiaVUVanuatuWSSamoaTOTongaPWPalauNRNauruTVTuvaluASAmerican SamoaSamurai Proxies — Documentation v2
Go to dashboard