Skip to content
Login Sign up

Code integrations

The Shifter gateway speaks plain HTTP(S) and SOCKS5 on p.shifter.io:443. Any HTTP(S) client in any language that supports proxy auth will work, no SDK required.

The username encodes your targeting and session preferences; the password is your account password. See Gateway & auth for the full flag list.

Most popular option is requests with a proxies dict:

import requests
proxy = "customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443"
proxies = {"http": proxy, "https": proxy}
r = requests.get("https://ipinfo.io/json", proxies=proxies)
print(r.text)

For async code, httpx works the same way (httpx.AsyncClient(proxies=proxy)).

Use node-fetch (or the built-in fetch in Node 18+) with https-proxy-agent:

import fetch from 'node-fetch';
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent(
'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443'
);
const res = await fetch('https://ipinfo.io/json', { agent });
console.log(await res.text());

axios, got, and undici all accept a similar agent option.

Same runtime as Node.js, just typed. Example with axios:

import axios from 'axios';
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent(
'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443'
);
const { data } = await axios.get<string>('https://ipinfo.io/json', {
httpAgent: agent,
httpsAgent: agent,
});
console.log(data);

Plain Node CommonJS with no transpiler:

const fetch = require('node-fetch');
const { HttpsProxyAgent } = require('https-proxy-agent');
const agent = new HttpsProxyAgent(
'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443'
);
fetch('https://ipinfo.io/json', { agent })
.then((r) => r.text())
.then(console.log);

Standard library, no third-party dependency:

package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
proxyURL, _ := url.Parse("customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443")
client := &http.Client{
Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
}
resp, _ := client.Get("https://ipinfo.io/json")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}

reqwest with basic auth on the proxy:

use reqwest::blocking::Client;
use reqwest::Proxy;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let proxy = Proxy::all("http://p.shifter.io:443")?
.basic_auth("customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600", "PASSWORD");
let client = Client::builder().proxy(proxy).build()?;
let body = client.get("https://ipinfo.io/json").send()?.text()?;
println!("{body}");
Ok(())
}

Built-in java.net.http.HttpClient (Java 11+):

import java.net.*;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newBuilder()
.proxy(ProxySelector.of(new InetSocketAddress("p.shifter.io", 443)))
.authenticator(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
"customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600",
"PASSWORD".toCharArray()
);
}
})
.build();
HttpRequest req = HttpRequest.newBuilder(URI.create("https://ipinfo.io/json")).build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
}
}

C#

HttpClient with HttpClientHandler.Proxy:

using System.Net;
using System.Net.Http;
var handler = new HttpClientHandler
{
Proxy = new WebProxy("http://p.shifter.io:443")
{
Credentials = new NetworkCredential(
"customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600",
"PASSWORD"
)
},
UseProxy = true
};
using var client = new HttpClient(handler);
var ip = await client.GetStringAsync("https://ipinfo.io/json");
Console.WriteLine(ip);

Guzzle with the proxy request option:

<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client([
'proxy' => 'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443',
]);
$res = $client->get('https://ipinfo.io/json');
echo $res->getBody();

Plain curl bindings (curl_setopt($ch, CURLOPT_PROXY, '...')) work too.

The gateway is a plain HTTP/HTTPS/SOCKS proxy. If your client speaks any of those with basic auth, it works. For product-specific tools (Scrapy, Puppeteer, Playwright, SwitchyOmega, Multilogin), see Residential Proxies → Integrations.