Rotating Gateway Proxies
Rotating gateway proxies are shared gateway endpoints that route traffic through upstream providers based on the options you send with the request. Use the exact rotating HTTP/SOCKS endpoints shown in your account.
Unlike assigned/static endpoints, rotating gateways support request-level routing controls through structured usernames and HTTP targeting headers. The exact endpoint values are account-specific and should be copied from Portal → Rotating Gateway IPs.
Supported today: Use your base username for default routed traffic, or append structured controls forsession,duration,provider(dcorres), andgeo-country. HTTP also supports routing headers. Charges are usage-based and deducted from your account balance.
Find your endpoint
- Open Portal → Proxy IPs.
- Find the Rotating Gateway IPs section.
- Copy the HTTP and SOCKS5 endpoints shown for your account.
| Mode | Host | Port |
|---|---|---|
| Rotating HTTP endpoint | <ROTATING_HTTP_ENDPOINT> | Portal-assigned |
| Rotating SOCKS5 endpoint | <ROTATING_SOCKS_ENDPOINT> | Portal-assigned |
Authentication & control model
Default routed usage
Use your username and API key directly when you want the gateway defaults. With no extra controls, each request can take a different route.
http://USERNAME:API_KEY@<ROTATING_HTTP_ENDPOINT>Structured username controls
Append structured controls to the username when you need to choose a sticky session, session lifetime, provider type, or country on either HTTP or SOCKS5.
USERNAME--session-SESSION_ID--duration-SECONDS--provider-dc|res--geo-country-CC:API_KEYHow to choose between base username, controls, and headers
- Use the base username only when you just want routed traffic and do not care which exit route the next request uses.
- Use structured username controls when you want one copyable auth string that works on both HTTP and SOCKS5.
- Use HTTP headers when your client already handles proxy auth separately and you need HTTP-only inputs such as city, ISP, or ASN targeting.
Common combinations
USERNAME--provider-dc:API_KEYUSERNAME--provider-res--geo-country-us:API_KEYUSERNAME--session-checkout-flow-42--duration-90--provider-res--geo-country-us:API_KEYLegacy sticky suffix compatibility
The legacy sticky suffix still works for compatibility, but the structured v1 grammar is the preferred customer-facing format because it exposes all supported inputs explicitly.
USERNAME-sessioncheckout42:API_KEYUsername-control inputs and allowed values
| Parameter | Syntax | Example |
|---|---|---|
| session (HTTP + SOCKS5) | --session-SESSION_ID | checkout-flow-42 |
| duration (HTTP + SOCKS5) | --duration-SECONDS | 90 |
| provider (HTTP + SOCKS5) | --provider-dc | --provider-res | dc or res |
| geo-country (HTTP + SOCKS5) | --geo-country-CC | us |
sessionaccepts letters, numbers,_, and-, with a maximum of 64 characters.durationmust be a positive integer in seconds.providersupports onlydcandresin the structured username grammar. Mobile is not a valid structured provider value today.geo-countrymust be a 2-letter country code such asus,gb, orde.- You can combine these controls in any order after the base username, but each control can only appear once.
Recommended pattern: Start with the smallest set of controls you need. If you only need country targeting, use--geo-country-CC; if you need sticky behavior too, add--session-...and--duration-....
HTTP header options and when to use them
HTTP requests can also use headers when that is more convenient for your client. This is also where city, ISP, and ASN targeting live today.
| Parameter | Syntax | Example |
|---|---|---|
| Sticky session | X-Session-ID | checkout-flow-42 |
| Session duration | X-Session-Duration | 90 |
| Country | X-Target-Geo | US |
| City (HTTP only) | X-Target-City | NewYork |
| ISP (HTTP only) | X-Target-ISP | Comcast |
| ASN (HTTP only) | X-Target-ASN | AS7922 |
| Provider type | X-Provider-Type | residential |
- Headers are for HTTP requests. SOCKS5 clients should use structured username controls instead.
- City, ISP, and ASN targeting are available in headers, not in the structured username grammar.
- Header provider values use the full words such as
datacenterandresidential, while username controls use the short formsdcandres.
Routing controls quick lookup
| Parameter | Syntax | Example |
|---|---|---|
| Keep one sticky route | --session-SESSION_ID | checkout-flow-42 |
| Expire that sticky route | --duration-SECONDS | 90 |
| Force datacenter or residential | --provider-dc | --provider-res | res |
| Limit route to one country | --geo-country-CC | us |
| Target city / ISP / ASN | HTTP headers | X-Target-City / ISP / ASN |
Code examples
curl
# Default routed usage
curl -x "http://<USERNAME>:<API_KEY>@<ROTATING_HTTP_ENDPOINT>" "https://ip.ninjasproxy.com/"
# Country-only route
curl -x "http://<USERNAME>--geo-country-us:<API_KEY>@<ROTATING_HTTP_ENDPOINT>" "https://ip.ninjasproxy.com/"
# Datacenter route
curl -x "http://<USERNAME>--provider-dc:<API_KEY>@<ROTATING_HTTP_ENDPOINT>" "https://ip.ninjasproxy.com/"
# Sticky residential US route for 90 seconds
curl -x "http://<USERNAME>--session-checkout-flow-42--duration-90--provider-res--geo-country-us:<API_KEY>@<ROTATING_HTTP_ENDPOINT>" "https://ip.ninjasproxy.com/"
# Header fallback on HTTP when you need city / ISP / ASN controls
curl -x "http://<USERNAME>:<API_KEY>@<ROTATING_HTTP_ENDPOINT>" -H "X-Session-ID: checkout-flow-42" -H "X-Session-Duration: 90" -H "X-Provider-Type: residential" -H "X-Target-Geo: US" -H "X-Target-City: NewYork" "https://ip.ninjasproxy.com/"SOCKS5 sticky session
curl --socks5-hostname "<ROTATING_SOCKS_ENDPOINT>" --proxy-user "<USERNAME>--session-checkout-flow-42--duration-90--provider-res--geo-country-us:<API_KEY>" "https://ip.ninjasproxy.com/"Python
import requests
proxy = "http://<USERNAME>--session-cart-1--duration-120--provider-res--geo-country-us:<API_KEY>@<ROTATING_HTTP_ENDPOINT>"
response = requests.get(
"https://ip.ninjasproxy.com/",
proxies={"http": proxy, "https": proxy},
timeout=20,
)
print(response.text.strip())Next Steps
- Authentication — credential and whitelist setup
- Rate limits — connection reuse, retries, and concurrency
- curl integration — fastest path for debugging gateway requests
- API Reference — account and endpoint APIs
