# Select Country

If you want to access IPs from specific locations, you have to provide a `country` – parameter with a two letter country code in your username Here is the list of `country` parameters. For example, if you want to use United States country parameter, add `country-US`.

Find complete list of supported countries in the table below.&#x20;

<details>

<summary>Datacenter per IP supported countries list</summary>

<table><thead><tr><th>Country</th><th>Country code</th><th data-hidden></th></tr></thead><tbody><tr><td>Argentina</td><td><code>country-AR</code></td><td></td></tr><tr><td>Australia</td><td><code>country-AU</code></td><td></td></tr><tr><td>Austria</td><td><code>country-AT</code></td><td></td></tr><tr><td>Belgium</td><td><code>country-BE</code></td><td></td></tr><tr><td>Brazil</td><td><code>country-BR</code></td><td></td></tr><tr><td>Canada</td><td><code>country-CA</code></td><td></td></tr><tr><td>Chile</td><td><code>country-CL</code></td><td></td></tr><tr><td>China</td><td><code>country-CN</code></td><td></td></tr><tr><td>Colombia</td><td><code>country-CO</code></td><td></td></tr><tr><td>Czech Republic</td><td><code>country-CZ</code></td><td></td></tr><tr><td>Denmark</td><td><code>country-DK</code></td><td></td></tr><tr><td>France</td><td><code>country-FR</code></td><td></td></tr><tr><td>Germany</td><td><code>country-DE</code></td><td></td></tr><tr><td>India</td><td><code>country-IN</code></td><td></td></tr><tr><td>Indonesia</td><td><code>country-ID</code></td><td></td></tr><tr><td>Ireland</td><td><code>country-IE</code></td><td></td></tr><tr><td>Israel</td><td><code>country-IL</code></td><td></td></tr><tr><td>Italy</td><td><code>country-IT</code></td><td></td></tr><tr><td>Japan</td><td><code>country-JP</code></td><td></td></tr><tr><td>Mexico</td><td><code>country-MX</code></td><td></td></tr><tr><td>Netherlands</td><td><code>country-NL</code></td><td></td></tr><tr><td>Peru</td><td><code>country-PE</code></td><td></td></tr><tr><td>Poland</td><td><code>country-PL</code></td><td></td></tr><tr><td>Portugal</td><td><code>country-PT</code></td><td></td></tr><tr><td>Romania</td><td><code>country-RO</code></td><td></td></tr><tr><td>Saudi Arabia</td><td><code>country-SA</code></td><td></td></tr><tr><td>Singapore</td><td><code>country-SG</code></td><td></td></tr><tr><td>Slovakia</td><td><code>country-SK</code></td><td></td></tr><tr><td>Spain</td><td><code>country-ES</code></td><td></td></tr><tr><td>Switzerland</td><td><code>country-CH</code></td><td></td></tr><tr><td>Thailand</td><td><code>country-TH</code></td><td></td></tr><tr><td>United Arab Emirates</td><td><code>country-AE</code></td><td></td></tr><tr><td>United Kingdom</td><td><code>country-GB</code></td><td></td></tr><tr><td>United States</td><td><code>country-US</code></td><td></td></tr></tbody></table>

</details>

<details>

<summary>Datacenter per traffic supported countries list</summary>

<table><thead><tr><th>Country</th><th>Country code</th><th data-hidden></th></tr></thead><tbody><tr><td>Argentina</td><td><code>country-AR</code></td><td></td></tr><tr><td>Australia</td><td><code>country-AU</code></td><td></td></tr><tr><td>Austria</td><td><code>country-AT</code></td><td></td></tr><tr><td>Belgium</td><td><code>country-BE</code></td><td></td></tr><tr><td>Brazil</td><td><code>country-BR</code></td><td></td></tr><tr><td>Canada</td><td><code>country-CA</code></td><td></td></tr><tr><td>Chile</td><td><code>country-CL</code></td><td></td></tr><tr><td>China</td><td><code>country-CN</code></td><td></td></tr><tr><td>Croatia</td><td><code>country-HR</code></td><td></td></tr><tr><td>Colombia</td><td><code>country-CO</code></td><td></td></tr><tr><td>Denmark</td><td><code>country-DK</code></td><td></td></tr><tr><td>Estonia</td><td><code>country-EE</code></td><td></td></tr><tr><td>France</td><td><code>country-FR</code></td><td></td></tr><tr><td>Germany</td><td><code>country-DE</code></td><td></td></tr><tr><td>Greece</td><td><code>country-GR</code></td><td></td></tr><tr><td>Hungary</td><td><code>country-HU</code></td><td></td></tr><tr><td>India</td><td><code>country-IN</code></td><td></td></tr><tr><td>Indonesia</td><td><code>country-ID</code></td><td></td></tr><tr><td>Ireland</td><td><code>country-IE</code></td><td></td></tr><tr><td>Israel</td><td><code>country-IL</code></td><td></td></tr><tr><td>Italy</td><td><code>country-IT</code></td><td></td></tr><tr><td>Japan</td><td><code>country-JP</code></td><td></td></tr><tr><td>Latvia</td><td><code>country-LV</code></td><td></td></tr><tr><td>Lithuania</td><td><code>country-LT</code></td><td></td></tr><tr><td>Mexico</td><td><code>country-MX</code></td><td></td></tr><tr><td>Netherlands</td><td><code>country-NL</code></td><td></td></tr><tr><td>New Zealand</td><td><code>country-NZ</code></td><td></td></tr><tr><td>Norway</td><td><code>country-NO</code></td><td></td></tr><tr><td>Peru</td><td><code>country-PE</code></td><td></td></tr><tr><td>Poland</td><td><code>country-PL</code></td><td></td></tr><tr><td>Portugal</td><td><code>country-PT</code></td><td></td></tr><tr><td>Romania</td><td><code>country-RO</code></td><td></td></tr><tr><td>Saudi Arabia</td><td><code>country-SA</code></td><td></td></tr><tr><td>Singapore</td><td><code>country-SG</code></td><td></td></tr><tr><td>Slovakia</td><td><code>country-SK</code></td><td></td></tr><tr><td>Slovenia</td><td><code>country-SI</code></td><td></td></tr><tr><td>South Korea</td><td><code>country-KR</code></td><td></td></tr><tr><td>Spain</td><td><code>country-ES</code></td><td></td></tr><tr><td>Sweden</td><td><code>country-SE</code></td><td></td></tr><tr><td>Switzerland</td><td><code>country-CH</code></td><td></td></tr><tr><td>Thailand</td><td><code>country-TH</code></td><td></td></tr><tr><td>United Kingdom</td><td><code>country-GB</code></td><td></td></tr><tr><td>United States</td><td><code>country-US</code></td><td></td></tr></tbody></table>

</details>

For example, if you want to rotate United States proxy pool only, use rotating port `8000` together with a parameter  `country-US` in your username:

```bash
curl -x dc.oxylabs.io:8000 -U 'user-USERNAME-country-US:PASSWORD' https://ip.oxylabs.io/location
```

**Code examples**

{% tabs %}
{% tab title="cURL" %}

```sh
curl -x dc.oxylabs.io:8000 -U 'user-USERNAME-country-COUNTRY:PASSWORD' https://ip.oxylabs.io/location
```

{% endtab %}

{% tab title="Python" %}

<pre class="language-python"><code class="lang-python">#pip install requests
<strong>import requests
</strong>
username = 'USERNAME'
password = 'PASSWORD'
country = 'COUNTRY'
proxy = 'dc.oxylabs.io:8000'

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

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

print(response.content)
</code></pre>

{% endtab %}

{% tab title="Node.js" %}

```javascript
//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 country = 'COUNTRY'
const password = 'PASSWORD'

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

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$username = 'USERNAME';
$country = 'COUNTRY';
$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-country-$country:$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;
}

```

{% endtab %}

{% tab title="Go" %}

```go
package main

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

func main() {
	username, country, password, entry := "USERNAME", "COUNTRY", "PASSWORD", "dc.oxylabs.io:8000"

	proxy, err := url.Parse(fmt.Sprintf("https://user-%s-country-%s:%s@%s", username, country, 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))
}

```

{% endtab %}

{% tab title="Java" %}

```java
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 targetUrl = "http://ip.oxylabs.io/location";
        String username = "USERNAME";
        String country = "COUNTRY";
        String password = "PASSWORD";
        String proxy = "dc.oxylabs.io:8000";

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

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

        System.out.println(response);
    }
}

```

{% endtab %}

{% tab title="C#" %}

```csharp
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-country-COUNTRY",
        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);
```

{% endtab %}
{% endtabs %}

#### Differences between subscription methods

`Datacenter per IP` users who provide rotating port and `country` parameter will receive a **random IP from the selected country from their Proxy list** with each new request.\
\
`Datacenter per traffic` users who provide rotating port and `country` parameter will receive **random IP from the selected country from the entire proxy pool.**

{% hint style="info" %}
We use the[ **MaxMind GeoIP2**](https://www.maxmind.com/en/geoip2-databases) database to determine IPs location.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.oxylabs.io/products/proxies/datacenter-proxies/select-country.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
