Documentation has been updated: see help center and changelog in one place.
🆕Explore
LogoLogo
Oxylabs dashboardContact usProduct
English
  • Documentation
  • Help center
  • Changelog
English
  • Overview
  • PROXIES
    • Integration Guides
      • Get IP Address for Integrations
      • Residential Proxies Guides
        • AdsPower
        • Android
        • ClonBrowser
        • Dolphin Anty
        • Ghost Browser
        • GoLogin
        • Helium Scraper
        • Incogniton
        • iOS
        • Kameleo
        • Lalicat Browser
        • MacOS
        • MoreLogin
        • MuLogin
        • Multilogin
        • Nstbrowser
        • Octoparse
        • Oxy® Proxy Extension for Chrome
        • ParseHub
        • Playwright
        • Puppeteer
        • Selenium
        • SEO Neo
        • SessionBox
        • Shadowrocket
        • Super Proxy
        • SwitchyOmega
        • Ubuntu
        • VMLogin
        • WebHarvy
        • Hidemyacc
      • ISP Proxies Guides
        • AdsPower
        • Android
        • Dolphin Anty
        • FoxyProxy
        • GoLogin
        • Incogniton
        • iOS
        • Lalicat Browser
        • MacOS
        • MoreLogin
        • MuLogin
        • Multilogin
        • Nstbrowser
        • Octoparse
        • Oxy® Proxy Extension for Chrome
        • SEO Neo
        • Shadowrocket
        • Sphere
        • Super Proxy
        • SwitchyOmega
        • Ubuntu
        • Hidemyacc
      • Mobile Proxies Guides
        • AdsPower
        • Android
        • ClonBrowser
        • Dolphin Anty
        • Ghost Browser
        • GoLogin
        • Helium Scraper
        • Incogniton
        • iOS
        • Kameleo
        • Lalicat Browser
        • MacOS
        • MoreLogin
        • MuLogin
        • Multilogin
        • Nstbrowser
        • Octoparse
        • Oxy® Proxy Extension for Chrome
        • ParseHub
        • Playwright
        • Puppeteer
        • Selenium
        • SEO Neo
        • SessionBox
        • Shadowrocket
        • SwitchyOmega
        • Ubuntu
        • VMLogin
        • WebHarvy
      • Dedicated Datacenter Proxies Guides
        • Enterprise
          • Dolphin Anty
          • FoxyProxy
          • GoLogin
          • Lalicat Browser
          • MoreLogin
          • MuLogin
          • Nstbrowser
          • Octoparse
          • Oxy® Proxy Extension for Chrome
          • SEO Neo
          • Shadowrocket
          • Sphere
          • Super Proxy
          • SwitchyOmega
          • Ubuntu
          • Hidemyacc
        • Self-Service
          • Android
          • Dolphin Anty
          • FoxyProxy
          • GoLogin
          • iOS
          • Lalicat Browser
          • MacOS
          • MoreLogin
          • MuLogin
          • Nstbrowser
          • Octoparse
          • Oxy® Proxy Extension for Chrome
          • SEO Neo
          • Shadowrocket
          • Sphere
          • Super Proxy
          • SwitchyOmega
          • Ubuntu
          • Hidemyacc
      • Datacenter Proxies Guides
        • AdsPower
        • Android
        • Dolphin Anty
        • GoLogin
        • iOS
        • Lalicat Browser
        • MacOS
        • MoreLogin
        • MuLogin
        • Nstbrowser
        • Octoparse
        • Oxy® Proxy Extension for Chrome
        • SEO Neo
        • Shadowrocket
        • Super Proxy
        • SwitchyOmega
        • Ubuntu
        • Hidemyacc
    • Residential Proxies
      • Getting Started
      • Making Requests
        • Entry Node for China
      • Location Settings
        • Country
        • City
        • State
        • Continent
        • ZIP/Postal code
        • Coordinates
        • ASN Targeting
      • Session Control
        • Sticky Proxy Entry Nodes
      • Protocols
      • Whitelisting IPs
        • Requests with Whitelisted IPs
      • Endpoint Generator
      • Restricted Targets
      • Public API
      • Response Codes
    • ISP Proxies
      • Making Requests
      • Proxy List
      • Proxy Rotation
      • Location Settings
      • Protocols
      • Whitelisting IPs
      • Response Codes
      • Restricted Targets
      • Fair usage policy
    • Mobile Proxies
      • Getting Started
      • Making Requests
        • Entry Node for China
      • Location Settings
        • Country
        • City
        • State
        • Continent
        • Coordinates
        • ASN Targeting
      • Session Control
        • Sticky Proxy Entry Nodes
      • Protocols
      • Whitelisting IPs
      • Endpoint Generator
      • Restricted Targets
      • Public API
      • Response Codes
    • Datacenter Proxies
      • Proxy List
      • IP Control
      • Select Country
      • Protocols
      • Whitelisting
      • Response Codes
      • Restricted Targets
      • Fair usage policy
      • Free Datacenter IPs
    • Dedicated Datacenter Proxies
      • Enterprise
        • Getting Started
        • Proxy List
        • Making Requests
        • Protocols
        • Whitelisting IPs
          • Dashboard
          • RESTful
            • Getting Whitelisted IPs List
            • Adding a Whitelisted IP
            • Removing a Whitelisted IP
            • Saving Changes (5min Cooldown)
        • Datacenter Proxy API
        • Proxy Rotator - Optional
        • Response Codes
      • Self-Service
        • Getting Started
        • Making Requests
        • Proxy List
        • Proxy Rotation
        • Location Settings
        • Protocols
        • Whitelisting IPs
        • Response Codes
        • Restricted Targets
        • Fair usage policy
    • Dedicated ISP Proxies
      • Getting Started
      • Proxy List
      • Making Requests
      • Protocols
      • Whitelisting IPs (RESTful)
        • Getting Whitelisted IPs List
        • Adding a Whitelisted IP
        • Removing a Whitelisted IP
        • Saving Changes (5min Cooldown)
      • Proxy API
      • Proxy Rotator - Optional
      • Response Codes
  • Advanced proxy solutions
    • Web Unblocker
      • Getting Started
      • Making Requests
        • Session
        • Geo-location
        • Headers & Cookies
        • Custom status code
        • POST requests
      • Headless Browser
        • JavaScript rendering
        • Browser instructions (Beta)
          • List of instructions
      • Sample Response
      • Response Codes
      • Rate Limits
      • Migration Guides
        • From Bright Data Web Unlocker
      • Usage Statistics
      • Billing Information
  • VIDEO DATA
    • High-Bandwidth Proxies
      • YouTube Downloader (yt_dlp) integration
  • Video Data API
  • Scraper APIs
    • Web Scraper API
      • Integration Methods
        • Realtime
        • Push-Pull
        • Proxy Endpoint
      • Features
        • Localization
          • Proxy Location
          • SERP Localization
          • E-Commerce Localization
          • Domain, Locale, Results Language
        • JS Rendering & Browser Control
          • JavaScript Rendering
          • Browser Instructions
            • List of instructions
        • Result Processing & Storage
          • Dedicated Parsers
          • Custom Parser
            • Getting started
            • Parsing instruction examples
            • List of functions
              • Function examples
          • Download Images
          • Cloud Storage
        • HTTP Context & Job Management
          • Headers, Cookies, Method
          • User Agent Type
          • Client Notes
        • Scheduler
      • Solutions for AI Workflows
        • Model Context Protocol (MCP)
        • LangChain
        • LlamaIndex
      • Targets
        • Google
          • Search
            • Web Search
            • AI Overviews
            • Image Search
            • News Search
            • Local Search
            • Reverse Image Search
            • Google Suggest
          • Ads Max
          • Shopping
            • Shopping Product
            • Shopping Search
            • Shopping Pricing
          • Trends: Explore
          • Travel: Hotels
          • Lens
          • URL
        • Amazon
          • Product
          • Search
          • Pricing
          • Sellers
          • Best Sellers
          • Reviews
          • Questions & Answers
          • URL
        • YouTube
          • YouTube Scraping Guide for AI
          • YouTube Search
          • YouTube Video Trainability
          • YouTube Metadata
          • YouTube Downloader
          • YouTube Transcript
        • Generic Target
        • Walmart
          • Search
          • Product
        • Ebay
        • Etsy
          • Search
          • Product
        • Bing
          • Search
          • URL
        • North American E-Commerce
          • Best Buy
            • Search
            • Product
          • Target
            • Search
            • Product
            • Category
          • Kroger
            • Product
            • Search
            • URL
          • Costco
          • Bed Bath & Beyond
          • Menards
          • Petco
          • Staples
          • Grainger
          • Instacart
        • European E-Commerce
          • Allegro
            • Search
            • Product
          • Idealo
          • Mediamarkt
          • Cdiscount
        • Asian E-Commerce
          • Alibaba
          • Aliexpress
          • Lazada
          • Rakuten
          • Tokopedia
          • Flipkart
          • Avnet
          • Indiamart
        • Latin American E-Commerce
          • Mercado Livre
          • Magazine Luiza
          • Falabella
          • Dcard
      • Restricted Targets
      • Response Codes
    • OxyCopilot (Beta)
    • Usage and Billing
      • Usage Statistics
      • Traffic and Billing
      • Rate Limits
    • Unblocking Browser
      • Chrome
      • Firefox
      • Device Type
      • Restricted Targets
      • Integration with MCP
  • Dashboard
    • Teams
    • Billing Information
      • Accessing Billing Information
      • Managing Payment Methods
      • Updating Billing Information
      • Canceling a Subscription
    • IP Replacement
  • Guides for Scraper APIs
    • Python SDK
    • Go SDK
    • Forming Requests
    • Forming URLs
    • Using Postman
  • Useful links
    • Oxylabs Dashboard
    • Release Notes
    • Network status
    • Open Source Tools
      • Oxy Parser
      • Oxy Mouse
      • Web Scraper API Scheduler
    • Discord Community
    • GitHub
    • Scraping Experts
  • SUPPORT
    • FAQ
    • Have a Question?
Powered by GitBook
On this page
  • Proxy Rotation
  • Static Sessions

Was this helpful?

  1. PROXIES
  2. Datacenter Proxies

IP Control

Instructions on how to rotate proxies for changing IP addresses and how to use static IPs for maintaining the same IP.

PreviousProxy ListNextSelect Country

Last updated 10 months ago

Was this helpful?

Pay per IP users can download the proxy list via the .

Proxy Rotation

Datacenter Proxies support proxy rotation. To use this feature you need to use port number 8000. With each new request you will use a random IP.

Code examples

curl -x dc.oxylabs.io:8000 -U "user-USERNAME:PASSWORD" https://ip.oxylabs.io/location 
#pip install requests
import requests

username = 'USERNAME'
password = 'PASSWORD'
proxy = 'dc.oxylabs.io:8000'

proxies = {
   "https": ('https://user-%s:%s@%s' % (username, password, proxy))
}

response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)

print(response.content)
//npm install axios
const axios = require("axios");
const https = require("https");

const client = axios.create({
    httpsAgent: new https.Agent({
        rejectUnauthorized: false,
    }),
});
const username = 'USERNAME';
const password = 'PASSWORD'

client
    .get("https://ip.oxylabs.io/location", {
        proxy: {
            protocol: "https",
            host: "dc.oxylabs.io",
            port: 8000,
            auth: {
                username: `user-${username}`,
                password: password,
            },
        },
    })
    .then((res) => {
        console.log(res.data);
    })
    .catch((err) => console.error(err));
<?php

$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 'dc.oxylabs.io:8000';
$target = 'https://ip.oxylabs.io/location';

$request = curl_init($target);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_PROXY, $proxy);
curl_setopt($request, CURLOPT_PROXYUSERPWD, "user-$username:$password");
$responseBody = curl_exec($request);
$error = curl_error($request);
curl_close($request);

if ($responseBody !== false) {
    echo 'Response: ' . $responseBody;
} else {
    echo 'Failed to connect to proxy: ' . $error;
}
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	username, password, entry := "USERNAME", "PASSWORD", "dc.oxylabs.io:8000"
	proxy, err := url.Parse(fmt.Sprintf("https://user-%s:%s@%s", username, password, entry))
	if err != nil {
		panic(err)
	}

	transport := &http.Transport{
		Proxy: http.ProxyURL(proxy),
	}
	client := &http.Client{Transport: transport}
	target := "https://ip.oxylabs.io/location"
	response, err := client.Get(target)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	body, err := io.ReadAll(response.Body)
	if err != nil {
		panic(err)
	}

	fmt.Println("Response:")
	fmt.Println(string(body))
}
package com.example;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Base64;

import org.apache.hc.client5.http.fluent.Request;
import org.apache.hc.core5.http.HttpHost;

public class App {
    public static void main(String[] args) throws IOException, URISyntaxException {
        String target = "http://ip.oxylabs.io/location";
        String username = "USERNAME";
        String password = "PASSWORD";
        String proxy = "dc.oxylabs.io:8000";

        URI proxyURI = new URI(String.format("https://user-%s:%s@%s", username, password, proxy));

        String basicAuth = new String(
                Base64.getEncoder()
                        .encode(
                                proxyURI.getUserInfo().getBytes()));
        String response = Request.get(target)
                .addHeader("Proxy-Authorization", "Basic " + basicAuth)
                .viaProxy(HttpHost.create(proxyURI))
                .execute().returnContent().asString();

        System.out.println(response);
    }
}
using System.Net;

// .NET currently does not support HTTPS proxies
var proxy = new WebProxy {
    Address = new Uri("dc.oxylabs.io:8000"),
    Credentials = new NetworkCredential(
        userName: "user-USERNAME",
        password: "PASSWORD"
    )
};

var httpClientHandler = new HttpClientHandler {Proxy = proxy};

using var client = new HttpClient(handler: httpClientHandler, disposeHandler: true);

var result = await client.GetStringAsync("https://ip.oxylabs.io/location");
Console.WriteLine(result);

For the pay per IP billing type, each request will use a random IP from your Proxy list via port 8000.

For the pay per traffic billing type, each request will use a random IP from the full pool via port 8000.

Static Sessions

Depending on your billing type, you can utilize specific ports to maintain a consistent IP address for your requests.

Datacenter Proxies per IP

For the pay per IP billing type, use a specific static port to make requests. You will find port numbers in your .

Here is an example using a port (8001) for a static session:

curl -x dc.oxylabs.io:8001 -U user-USERNAME:PASSWORD https://ip.oxylabs.io/location 

Find more code examples in other code languages below:

curl -x dc.oxylabs.io:8001 -U user-USERNAME:PASSWORD https://ip.oxylabs.io/location 
#pip install requests
import requests

username = 'USERNAME'
password = 'PASSWORD'
proxy = 'dc.oxylabs.io:8001'

proxies = {
   "https": ('https://user-%s:%s@%s' % (username, password, proxy))
}

response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)

print(response.content)
//npm install axios
const axios = require("axios");
const https = require("https");

const client = axios.create({
    httpsAgent: new https.Agent({
        rejectUnauthorized: false,
    }),
});
const username = 'USERNAME';
const password = 'PASSWORD'

client
    .get("https://ip.oxylabs.io/location", {
        proxy: {
            protocol: "https",
            host: "dc.oxylabs.io",
            port: 8001,
            auth: {
                username: `user-${username}`,
                password: password,
            },
        },
    })
    .then((res) => {
        console.log(res.data);
    })
    .catch((err) => console.error(err));
<?php

$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 'dc.oxylabs.io:8001';
$target = 'https://ip.oxylabs.io/location';

$request = curl_init($target);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_PROXY, $proxy);
curl_setopt($request, CURLOPT_PROXYUSERPWD, "user-$username:$password");
$responseBody = curl_exec($request);
$error = curl_error($request);
curl_close($request);

if ($responseBody !== false) {
    echo 'Response: ' . $responseBody;
} else {
    echo 'Failed to connect to proxy: ' . $error;
}
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	username, password, entry := "USERNAME", "PASSWORD", "dc.oxylabs.io:8001"
	proxy, err := url.Parse(fmt.Sprintf("https://user-%s:%s@%s", username, password, entry))
	if err != nil {
		panic(err)
	}

	transport := &http.Transport{
		Proxy: http.ProxyURL(proxy),
	}
	client := &http.Client{Transport: transport}
	target := "https://ip.oxylabs.io/location"
	response, err := client.Get(target)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	body, err := io.ReadAll(response.Body)
	if err != nil {
		panic(err)
	}

	fmt.Println("Response:")
	fmt.Println(string(body))
}
package com.example;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Base64;

import org.apache.hc.client5.http.fluent.Request;
import org.apache.hc.core5.http.HttpHost;

public class App {
    public static void main(String[] args) throws IOException, URISyntaxException {
        String target = "http://ip.oxylabs.io/location";
        String username = "USERNAME";
        String password = "PASSWORD";
        String proxy = "dc.oxylabs.io:8001";

        URI proxyURI = new URI(String.format("https://user-%s:%s@%s", username, password, proxy));

        String basicAuth = new String(
                Base64.getEncoder()
                        .encode(
                                proxyURI.getUserInfo().getBytes()));
        String response = Request.get(target)
                .addHeader("Proxy-Authorization", "Basic " + basicAuth)
                .viaProxy(HttpHost.create(proxyURI))
                .execute().returnContent().asString();

        System.out.println(response);
    }
}
using System.Net;

// .NET currently does not support HTTPS proxies
var proxy = new WebProxy {
    Address = new Uri("dc.oxylabs.io:8001"),
    Credentials = new NetworkCredential(
        userName: "user-USERNAME",
        password: "PASSWORD"
    )
};

var httpClientHandler = new HttpClientHandler {Proxy = proxy};

using var client = new HttpClient(handler: httpClientHandler, disposeHandler: true);

var result = await client.GetStringAsync("https://ip.oxylabs.io/location");
Console.WriteLine(result);

Datacenter Proxies per traffic

For the pay per traffic billing type, a static port within the range of 8001 to 63000 (generate a random number within this range) will be used to make requests. Each request will receive a random IP from the pool, but the IP will remain consistent for the duration of the session.

Here is an example using a random port (35467) for a static session:

curl -x dc.oxylabs.io:35467 -U user-USERNAME:PASSWORD https://ip.oxylabs.io/location 

Find more code examples in other code languages below:

curl -x dc.oxylabs.io:35467 -U user-USERNAME:PASSWORD https://ip.oxylabs.io/location 
#pip install requests
import requests

username = 'USERNAME'
password = 'PASSWORD'
proxy = 'dc.oxylabs.io:35467'

proxies = {
   "https": ('https://user-%s:%s@%s' % (username, password, proxy))
}

response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)

print(response.content)
//npm install axios
const axios = require("axios");
const https = require("https");

const client = axios.create({
    httpsAgent: new https.Agent({
        rejectUnauthorized: false,
    }),
});
const username = 'USERNAME';
const password = 'PASSWORD'

client
    .get("https://ip.oxylabs.io/location", {
        proxy: {
            protocol: "https",
            host: "dc.oxylabs.io",
            port: 35467,
            auth: {
                username: `user-${username}`,
                password: password,
            },
        },
    })
    .then((res) => {
        console.log(res.data);
    })
    .catch((err) => console.error(err));
<?php

$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 'dc.oxylabs.io:35467';
$target = 'https://ip.oxylabs.io/location';

$request = curl_init($target);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_PROXY, $proxy);
curl_setopt($request, CURLOPT_PROXYUSERPWD, "user-$username:$password");
$responseBody = curl_exec($request);
$error = curl_error($request);
curl_close($request);

if ($responseBody !== false) {
    echo 'Response: ' . $responseBody;
} else {
    echo 'Failed to connect to proxy: ' . $error;
}
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	username, password, entry := "USERNAME", "PASSWORD", "dc.oxylabs.io:35467"
	proxy, err := url.Parse(fmt.Sprintf("https://user-%s:%s@%s", username, password, entry))
	if err != nil {
		panic(err)
	}

	transport := &http.Transport{
		Proxy: http.ProxyURL(proxy),
	}
	client := &http.Client{Transport: transport}
	target := "https://ip.oxylabs.io/location"
	response, err := client.Get(target)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	body, err := io.ReadAll(response.Body)
	if err != nil {
		panic(err)
	}

	fmt.Println("Response:")
	fmt.Println(string(body))
}
package com.example;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Base64;

import org.apache.hc.client5.http.fluent.Request;
import org.apache.hc.core5.http.HttpHost;

public class App {
    public static void main(String[] args) throws IOException, URISyntaxException {
        String target = "http://ip.oxylabs.io/location";
        String username = "USERNAME";
        String password = "PASSWORD";
        String proxy = "dc.oxylabs.io:35467";

        URI proxyURI = new URI(String.format("https://user-%s:%s@%s", username, password, proxy));

        String basicAuth = new String(
                Base64.getEncoder()
                        .encode(
                                proxyURI.getUserInfo().getBytes()));
        String response = Request.get(target)
                .addHeader("Proxy-Authorization", "Basic " + basicAuth)
                .viaProxy(HttpHost.create(proxyURI))
                .execute().returnContent().asString();

        System.out.println(response);
    }
}
using System.Net;

// .NET currently does not support HTTPS proxies
var proxy = new WebProxy {
    Address = new Uri("dc.oxylabs.io:35467"),
    Credentials = new NetworkCredential(
        userName: "user-USERNAME",
        password: "PASSWORD"
    )
};

var httpClientHandler = new HttpClientHandler {Proxy = proxy};

using var client = new HttpClient(handler: httpClientHandler, disposeHandler: true);

var result = await client.GetStringAsync("https://ip.oxylabs.io/location");
Console.WriteLine(result);

For a rotating or static session in a specific country, refer to page.

dashboard
proxy list
Select country