Documentation

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

01

Register

Go to /sign-up and create an account. Verify your email with the OTP code sent to you.

02

Get your proxy key

After signing in, go to your dashboard. Your proxy key (starts with sam-) is shown in your allocation details.

03

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.

bash
# Quick test — see your exit IP
curl -x "http://res-us:YOUR_PROXY_KEY@samuraiproxy.net:8081" \
  https://httpbin.org/ip

Proxy types

7 proxy types are available. Each type determines how IPs are assigned and rotated. The type is the first part of your username.

CodeNameDescription
resResidential (Rotating)Rotates IP on every request. Best for scraping and general use.
res_scResidential (State/City)Target a specific country, state, and city with rotating residential IPs.
res_lsResidential (Long Session)Hold the same IP for extended sessions up to 1 hour.
stcStatic ISP ResidentialISP-grade static IPs that don't rotate. Great for accounts and automation.
stc_scStatic ISP (State/City)Static ISP IPs targeted to a specific state and city.
mobMobileReal mobile carrier IPs (3G/4G/5G). Highest trust scores.
dcDatacenterFast 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.

text
# 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/ip

Username format

The username controls routing. The password is always your proxy key.

Basic country targeting

text
{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, Germany

Sticky session (same IP for multiple requests)

text
{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 session

State / City targeting

text
{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, Miami

State and city names are lowercase, no spaces. Multi-word names use underscores (e.g. new_york).

Long Session ID (LSID)

text
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 minutes

Sessions persist for the specified TTL (60–3600 seconds).

ASN targeting

text
res-{country}-asn-{number}

res-af-asn-55330   # Afghanistan, specific network
res-us-asn-14615   # United States, specific network

Target 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.

ProtocolDescription
HTTPStandard HTTP proxy with CONNECT tunneling for HTTPS sites.
HTTPS (CONNECT)CONNECT tunnel for HTTPS targets. Most common use case.
SOCKS5Full SOCKS5 with username/password auth. Best compatibility.

Code examples

cURL

bash
# 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/ip

Python (requests)

python
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)

javascript
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)

go
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
<?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)

csharp
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

bash
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/ip

Sessions

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.

bash
# 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/ip

Use 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

bash
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

FieldTypeDescription
urlstring (required)Target URL to scrape.
formathtml | markdown | text | jsonOutput format. Default: html.
proxyTypestringProxy routing string (e.g. res-us, res-uk). Default: res-us.
selectorstring (optional)CSS selector to extract specific elements. Works with html and json formats.

Response

json
{
  "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

python
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())
javascript
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.

CodeMeaningWhat to do
200OK / Connection establishedRequest succeeded. CONNECT tunnels open here.
400Bad RequestMalformed request line or unsupported method.
403ForbiddenTarget is private/loopback (SSRF), restricted by policy, or your data limit is exhausted.
407Proxy Authentication RequiredMissing or wrong credentials. Username is your routing string (e.g. res-us); password is your proxy key.
408Request TimeoutClient request body did not arrive in time. Retry with a fresh connection.
429Too Many RequestsPer-user concurrent-connection cap hit. Slow down or upgrade.
502Bad GatewayUpstream connection failed. Retry; if persistent, check the country/type combo.
503Service UnavailableService temporarily busy. Backoff and retry.
504Gateway TimeoutUpstream 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

ParameterValueNotes
Concurrent connections50 per userMax 500 total across all users.
DNS resolutionAt exit nodeTargets forwarded as hostnames so DNS resolves in the exit country.
Long-session hold~60 minutesToken-bound sessions can stay stable for about an hour.
Sticky session (SID)10000–999999999Numeric session IDs.
Connection timeout15 secondsUpstream connection must establish within 15s.
Idle timeout120 secondsConnections with no data flow are closed.
Restricted destinationsRFC1918 / loopbackRequests 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 countries
USUnited States
CACanada
MXMexico
PRPuerto Rico
GTGuatemala
HNHonduras
SVEl Salvador
NINicaragua
CRCosta Rica
PAPanama
BZBelize
CUCuba
JMJamaica
HTHaiti
DODominican Republic
TTTrinidad and Tobago
BSBahamas
BBBarbados
AGAntigua and Barbuda
DMDominica
GDGrenada
LCSaint Lucia
AWAruba
BMBermuda
GPGuadeloupe
MQMartinique
TCTurks and Caicos

Europe

45 countries
UKUnited Kingdom
DEGermany
FRFrance
NLNetherlands
ITItaly
ESSpain
SESweden
NONorway
DKDenmark
FIFinland
PLPoland
ATAustria
BEBelgium
CHSwitzerland
PTPortugal
IEIreland
CZCzech Republic
RORomania
HUHungary
GRGreece
BGBulgaria
HRCroatia
SKSlovakia
SISlovenia
RSSerbia
UAUkraine
BYBelarus
LTLithuania
LVLatvia
EEEstonia
ISIceland
LULuxembourg
MTMalta
ALAlbania
BABosnia and Herzegovina
MEMontenegro
MKNorth Macedonia
MDMoldova
ADAndorra
MCMonaco
SMSan Marino
LILiechtenstein
GGGuernsey
GIGibraltar
FOFaroe Islands

Asia

50 countries
JPJapan
KRSouth Korea
CNChina
TWTaiwan
HKHong Kong
MOMacao
SGSingapore
MYMalaysia
THThailand
VNVietnam
IDIndonesia
PHPhilippines
INIndia
BDBangladesh
PKPakistan
LKSri Lanka
NPNepal
KHCambodia
LALaos
MMMyanmar
BNBrunei
MNMongolia
KGKyrgyzstan
KZKazakhstan
UZUzbekistan
TJTajikistan
TMTurkmenistan
AZAzerbaijan
GEGeorgia
AMArmenia
TRTurkey
CYCyprus
ILIsrael
JOJordan
LBLebanon
IQIraq
IRIran
SASaudi Arabia
AEUnited Arab Emirates
QAQatar
KWKuwait
BHBahrain
OMOman
YEYemen
SYSyria
AFAfghanistan
BTBhutan
MVMaldives
TLTimor Leste
RURussia

South America

14 countries
BRBrazil
ARArgentina
CLChile
COColombia
PEPeru
VEVenezuela
ECEcuador
UYUruguay
PYParaguay
BOBolivia
GYGuyana
SRSuriname
GFFrench Guiana
FKFalkland Islands

Africa

53 countries
ZASouth Africa
NGNigeria
EGEgypt
KEKenya
GHGhana
MAMorocco
TNTunisia
DZAlgeria
ETEthiopia
TZTanzania
UGUganda
RWRwanda
SNSenegal
CIIvory Coast
CMCameroon
AOAngola
MZMozambique
MGMadagascar
ZMZambia
ZWZimbabwe
BWBotswana
NANamibia
MUMauritius
GAGabon
CGCongo
MLMali
BFBurkina Faso
NENiger
TDChad
SDSudan
SSSouth Sudan
SOSomalia
DJDjibouti
EREritrea
LYLibya
MWMalawi
LSLesotho
SZEswatini
SCSeychelles
CVCape Verde
KMComoros
GMGambia
GNGuinea
GWGuinea-Bissau
GQEquatorial Guinea
BJBenin
TGTogo
SLSierra Leone
LRLiberia
CFCentral African Republic
BIBurundi
STSao Tome and Principe
MRMauritania

Oceania

13 countries
AUAustralia
NZNew Zealand
FJFiji
PGPapua New Guinea
NCNew Caledonia
PFFrench Polynesia
VUVanuatu
WSSamoa
TOTonga
PWPalau
NRNauru
TVTuvalu
ASAmerican Samoa

Samurai Proxies — Documentation v2

Go to dashboard