Node.js Integration
Node.js clients should use the exact HTTP or SOCKS endpoint shown in the portal. Build the proxy URL from your username, API key, and the account-specific endpoint you copied.
Use the exact endpoint shown in Portal → Proxy IPs or Rotating Gateway IPs. Public docs intentionally use placeholders like <HTTP_ENDPOINT> because live host/port values are account-specific.fetch + proxy-agent
import { ProxyAgent } from "proxy-agent"
const agent = new ProxyAgent("http://<USERNAME>:<API_KEY>@<HTTP_ENDPOINT>")
const response = await fetch("https://ip.ninjasproxy.com/", {
dispatcher: agent,
})
console.log((await response.text()).trim())axios
import axios from "axios"
const proxyUrl = new URL("http://<USERNAME>:<API_KEY>@<HTTP_ENDPOINT>")
const response = await axios.get("https://ip.ninjasproxy.com/", {
proxy: {
protocol: proxyUrl.protocol.replace(":", ""),
host: proxyUrl.hostname,
port: Number(proxyUrl.port),
auth: {
username: proxyUrl.username,
password: proxyUrl.password,
},
},
timeout: 20000,
})
console.log(response.data)Playwright
import { chromium } from "playwright"
const browser = await chromium.launch({
proxy: {
server: "http://<HTTP_ENDPOINT>",
username: "<USERNAME>",
password: "<API_KEY>",
},
})
const page = await browser.newPage()
await page.goto("https://ip.ninjasproxy.com/")
console.log(await page.textContent("body"))
await browser.close()Rotating gateway headers
import axios from "axios"
const proxyUrl = new URL("http://<USERNAME>:<API_KEY>@<ROTATING_HTTP_ENDPOINT>")
const response = await axios.get("https://ip.ninjasproxy.com/", {
proxy: {
protocol: proxyUrl.protocol.replace(":", ""),
host: proxyUrl.hostname,
port: Number(proxyUrl.port),
auth: {
username: proxyUrl.username,
password: proxyUrl.password,
},
},
headers: {
"X-Session-ID": "checkout-flow-42",
"X-Target-Geo": "US",
},
timeout: 20000,
})
console.log(response.data)Next Steps
- curl integration — fastest path to debug auth and endpoint issues
- Go integration — net/http and SOCKS5 examples
- Authentication — username + API key and whitelist setup
- Rotating proxies — headers and sticky session controls
