> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/proxies/datacenter-proxies/location-settings.md). Agents can also search and read this documentation through its [MCP server](https://developers.oxylabs.io/~gitbook/mcp).

# Location settings

Target Datacenter Proxies by country, as well as city, state, continent or ASN for pay-per-traffic plans. Parameters, combinations, code examples and errors.

Oxylabs Datacenter Proxies let you route traffic through IPs from a specific **country**. On the pay-per-traffic plan, you can also narrow targeting down to **city**, **state**, **continent** or **ASN** level. Location parameters are added directly into your proxy `username` string.

{% hint style="info" %}
**Location and network data:** We use the <a href="https://www.maxmind.com/en/geoip2-databases" target="_blank">**MaxMind GeoIP2**</a> database to determine the location (`cc`, `st` and `city` values) of our IPs. To verify the ISP provider and ASN of an IP, we recommend checking it in the <a href="https://stat.ripe.net/" target="_blank">**RIPEstat**</a> database for current status of the IP.
{% endhint %}

<table><thead><tr><th width="135">Targeting</th><th width="135">Availability</th><th>Description</th></tr></thead><tbody><tr><td><strong>Country</strong><br><code>cc</code></td><td>Pay per IP and pay per GB</td><td>ISO 3166-1 alpha-2 code.<br>E.g. <code>user-USERNAME-cc-us</code></td></tr><tr><td><strong>City</strong><br><code>city</code></td><td>Pay per GB</td><td>English city name. Requires the <code>cc</code> parameter.<br>E.g. <code>user-USERNAME-cc-us-city-chicago</code></td></tr><tr><td><strong>State</strong><br><code>st</code></td><td>Pay per GB</td><td>US state name. Requires the <code>cc</code> parameter.<br>E.g. <code>user-USERNAME-cc-us-st-california</code></td></tr><tr><td><strong>Continent</strong><br><code>cn</code></td><td>Pay per GB</td><td>Two-letter continent code (<code>af</code>, <code>an</code>, <code>as</code>, <code>eu</code>, <code>na</code>, <code>oc</code>, <code>sa</code>).<br>E.g. <code>user-USERNAME-cn-eu</code></td></tr><tr><td><strong>ASN targeting</strong><br><code>asn</code></td><td>Pay per GB</td><td>Autonomous System Number (digits only). Can be combined with any location parameter.<br>E.g. <code>user-USERNAME-asn-9009</code></td></tr></tbody></table>

{% hint style="warning" %}
**City, state, continent and ASN targeting are available only for Datacenter Proxies pay per traffic.** On the pay-per-IP plan, use the `cc` parameter to rotate IPs from a specific country in your proxy list.
{% endhint %}

{% hint style="info" %}
Legacy `country` parameter (e.g., `country-US`) is still fully supported, so your existing integrations keep working. We recommend using `cc` for new integrations.
{% endhint %}

## Country

Add the `cc` parameter to your username to specify the target country using a 2-letter [**ISO 3166-1 alpha-2**](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code (e.g., `de` for Germany, `gb` for the United Kingdom, `jp` for Japan):

```
user-USERNAME-cc-de:PASSWORD
```

Find the complete list of supported countries in the tables below.

<details>

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

<table><thead><tr><th>Country</th><th>Parameter</th><th data-hidden></th></tr></thead><tbody><tr><td>Argentina</td><td><code>cc-ar</code></td><td></td></tr><tr><td>Australia</td><td><code>cc-au</code></td><td></td></tr><tr><td>Austria</td><td><code>cc-at</code></td><td></td></tr><tr><td>Belgium</td><td><code>cc-be</code></td><td></td></tr><tr><td>Brazil</td><td><code>cc-br</code></td><td></td></tr><tr><td>Canada</td><td><code>cc-ca</code></td><td></td></tr><tr><td>Chile</td><td><code>cc-cl</code></td><td></td></tr><tr><td>China</td><td><code>cc-cn</code></td><td></td></tr><tr><td>Colombia</td><td><code>cc-co</code></td><td></td></tr><tr><td>Croatia</td><td><code>cc-hr</code></td><td></td></tr><tr><td>Czech Republic</td><td><code>cc-cz</code></td><td></td></tr><tr><td>Denmark</td><td><code>cc-dk</code></td><td></td></tr><tr><td>Finland</td><td><code>cc-fi</code></td><td></td></tr><tr><td>France</td><td><code>cc-fr</code></td><td></td></tr><tr><td>Germany</td><td><code>cc-de</code></td><td></td></tr><tr><td>India</td><td><code>cc-in</code></td><td></td></tr><tr><td>Indonesia</td><td><code>cc-id</code></td><td></td></tr><tr><td>Ireland</td><td><code>cc-ie</code></td><td></td></tr><tr><td>Israel</td><td><code>cc-il</code></td><td></td></tr><tr><td>Italy</td><td><code>cc-it</code></td><td></td></tr><tr><td>Japan</td><td><code>cc-jp</code></td><td></td></tr><tr><td>Mexico</td><td><code>cc-mx</code></td><td></td></tr><tr><td>Netherlands</td><td><code>cc-nl</code></td><td></td></tr><tr><td>Peru</td><td><code>cc-pe</code></td><td></td></tr><tr><td>Philippines</td><td><code>cc-ph</code></td><td></td></tr><tr><td>Poland</td><td><code>cc-pl</code></td><td></td></tr><tr><td>Portugal</td><td><code>cc-pt</code></td><td></td></tr><tr><td>Romania</td><td><code>cc-ro</code></td><td></td></tr><tr><td>Saudi Arabia</td><td><code>cc-sa</code></td><td></td></tr><tr><td>Singapore</td><td><code>cc-sg</code></td><td></td></tr><tr><td>Slovakia</td><td><code>cc-sk</code></td><td></td></tr><tr><td>Spain</td><td><code>cc-es</code></td><td></td></tr><tr><td>Switzerland</td><td><code>cc-ch</code></td><td></td></tr><tr><td>Thailand</td><td><code>cc-th</code></td><td></td></tr><tr><td>United Arab Emirates</td><td><code>cc-ae</code></td><td></td></tr><tr><td>United Kingdom</td><td><code>cc-gb</code></td><td></td></tr><tr><td>United States</td><td><code>cc-us</code></td><td></td></tr></tbody></table>

</details>

<details>

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

<table><thead><tr><th>Country</th><th>Parameter</th><th data-hidden></th></tr></thead><tbody><tr><td>Argentina</td><td><code>cc-ar</code></td><td></td></tr><tr><td>Australia</td><td><code>cc-au</code></td><td></td></tr><tr><td>Austria</td><td><code>cc-at</code></td><td></td></tr><tr><td>Belgium</td><td><code>cc-be</code></td><td></td></tr><tr><td>Brazil</td><td><code>cc-br</code></td><td></td></tr><tr><td>Canada</td><td><code>cc-ca</code></td><td></td></tr><tr><td>Chile</td><td><code>cc-cl</code></td><td></td></tr><tr><td>China</td><td><code>cc-cn</code></td><td></td></tr><tr><td>Colombia</td><td><code>cc-co</code></td><td></td></tr><tr><td>Croatia</td><td><code>cc-hr</code></td><td></td></tr><tr><td>Denmark</td><td><code>cc-dk</code></td><td></td></tr><tr><td>Estonia</td><td><code>cc-ee</code></td><td></td></tr><tr><td>Finland</td><td><code>cc-fi</code></td><td></td></tr><tr><td>France</td><td><code>cc-fr</code></td><td></td></tr><tr><td>Germany</td><td><code>cc-de</code></td><td></td></tr><tr><td>Greece</td><td><code>cc-gr</code></td><td></td></tr><tr><td>Hungary</td><td><code>cc-hu</code></td><td></td></tr><tr><td>India</td><td><code>cc-in</code></td><td></td></tr><tr><td>Indonesia</td><td><code>cc-id</code></td><td></td></tr><tr><td>Ireland</td><td><code>cc-ie</code></td><td></td></tr><tr><td>Israel</td><td><code>cc-il</code></td><td></td></tr><tr><td>Italy</td><td><code>cc-it</code></td><td></td></tr><tr><td>Japan</td><td><code>cc-jp</code></td><td></td></tr><tr><td>Latvia</td><td><code>cc-lv</code></td><td></td></tr><tr><td>Lithuania</td><td><code>cc-lt</code></td><td></td></tr><tr><td>Mexico</td><td><code>cc-mx</code></td><td></td></tr><tr><td>Netherlands</td><td><code>cc-nl</code></td><td></td></tr><tr><td>New Zealand</td><td><code>cc-nz</code></td><td></td></tr><tr><td>Norway</td><td><code>cc-no</code></td><td></td></tr><tr><td>Peru</td><td><code>cc-pe</code></td><td></td></tr><tr><td>Poland</td><td><code>cc-pl</code></td><td></td></tr><tr><td>Portugal</td><td><code>cc-pt</code></td><td></td></tr><tr><td>Romania</td><td><code>cc-ro</code></td><td></td></tr><tr><td>Saudi Arabia</td><td><code>cc-sa</code></td><td></td></tr><tr><td>Singapore</td><td><code>cc-sg</code></td><td></td></tr><tr><td>Slovakia</td><td><code>cc-sk</code></td><td></td></tr><tr><td>Slovenia</td><td><code>cc-si</code></td><td></td></tr><tr><td>South Korea</td><td><code>cc-kr</code></td><td></td></tr><tr><td>Spain</td><td><code>cc-es</code></td><td></td></tr><tr><td>Sweden</td><td><code>cc-se</code></td><td></td></tr><tr><td>Switzerland</td><td><code>cc-ch</code></td><td></td></tr><tr><td>Thailand</td><td><code>cc-th</code></td><td></td></tr><tr><td>United Kingdom</td><td><code>cc-gb</code></td><td></td></tr><tr><td>United States</td><td><code>cc-us</code></td><td></td></tr></tbody></table>

</details>

#### **Code examples**

In this example, a query to `ip.oxylabs.io/location` is performed from a random IP in the United States, using the rotating port `8000`:

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

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

{% endtab %}

{% tab title="Python" %}

```python
#pip install requests
import requests

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

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

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

print(response.content)
```

{% 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 password = 'PASSWORD';

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

{% endtab %}

{% tab title="PHP" %}

```php
<?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-cc-us:$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, password, entry := "USERNAME", "PASSWORD", "dc.oxylabs.io:8000"

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

{% 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 password = "PASSWORD";
        String proxy = "dc.oxylabs.io:8000";

        URI proxyURI = new URI(String.format("https://user-%s-cc-us:%s@%s", username, 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("http://dc.oxylabs.io:8000"),
    Credentials = new NetworkCredential(
        userName: "user-USERNAME-cc-us",
        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

<table data-header-hidden><thead><tr><th width="163.5"></th><th></th></tr></thead><tbody><tr><td><strong>Datacenter Proxies per IP</strong></td><td>Using the rotating port <code>8000</code> with the <code>cc</code> parameter returns a random IP from the selected country <strong>from your proxy list</strong> with each new request.</td></tr><tr><td><strong>Datacenter Proxies per traffic</strong></td><td>Using the rotating port <code>8000</code> with the <code>cc</code> parameter returns a random IP from the selected country <strong>from the entire proxy pool</strong> with each new request.</td></tr></tbody></table>

## City

Target proxies in specific cities by combining the `city` parameter with a matching country code (`cc`). The `cc` parameter is required.

```
user-USERNAME-cc-us-city-chicago:PASSWORD
```

When entering city names:

* Use the full English name of the city (e.g., `new_york`, not `nyc`).
* Replace spaces with underscores (e.g., `los_angeles`).
* Replace special or accented characters with their basic Latin equivalents (e.g., São Paulo → `sao_paulo`, München → `munchen`).

#### **Code examples**

In this example, a query to `ip.oxylabs.io/location` is performed from a random IP in Chicago, United States:

## Troubleshooting

<table><thead><tr><th width="153">Response code</th><th>Cause</th><th>What to do</th></tr></thead><tbody><tr><td><code>400 Bad Request</code></td><td>The username contains an unsupported parameter or an incorrectly formatted value.</td><td>Check your username string and make sure the parameters and values follow the syntax on this page.</td></tr><tr><td rowspan="2"><code>502 Bad Gateway</code></td><td>The <code>city</code> or <code>st</code> parameter is used without the <code>cc</code> parameter.</td><td>Add the <code>cc</code> parameter when using <code>city</code> or <code>st</code>.</td></tr><tr><td>The requested location or ASN is valid, but no IPs are currently available for it in the proxy pool.</td><td>Broaden your targeting, for example, target the state, country or continent instead.</td></tr></tbody></table>

For all other response codes, see [**Response Codes**](https://developers.oxylabs.io/products/proxies/datacenter-proxies/response-codes.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/proxies/datacenter-proxies/location-settings.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
