# Country

Adding a `country` flag to the authorization header enables one to specify which country IP to use to process the request. The value of this parameter is a case insensitive country code in 2-letter [**3166-1 alpha-2 format**](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). For example, `DE` for Germany, `GB` for the United Kingdom, and `TH` for Thailand proxy. See the examples for more details.

Here are a few examples of `country` parameters:

Country parameter

United States `country-US`

Italy `country-IT`

Thailand `country-TH`

Japan `country-JP`

Australia `country-AU`

Spain `country-ES`

**Code example**

In this example, a query to ipinfo.io is performed from a random IP address from United States:

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

```javascript
curl -x res-v2.pr.plainproxies.com:8080 -U User-country-US:Password ipinfo.io
```

{% endtab %}

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

```python
const axios = require('axios');

// Residential proxy
const proxy = {
  host: 'res-v2.pr.plainproxies.com',
  port: 8080,
  auth: {
    username: 'your-username-country-US',
    password: 'your-password'
  }
};

const response = await axios.get('https://ip.plainproxies.com/', { proxy });
console.log(response.data);
```

{% endtab %}

{% tab title="Python" %}

```
import requests

# Residential proxy (US)
proxies = {
    'http': 'http://username-country-US:password@res-v2.pr.plainproxies.com:8080',
    'https': 'http://username-country-US:password@res-v2.pr.plainproxies.com:8080'
}

response = requests.get('https://ip.plainproxies.com/', proxies=proxies)
print(response.json())
```

{% endtab %}

{% tab title="Go" %}

```
package main

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

func main() {
    // Residential proxy (US)
    proxy, _ := url.Parse("http://username-country-US:password@res-v2.pr.plainproxies.com:8080")
    client := &http.Client{
        Transport: &http.Transport{
            Proxy: http.ProxyURL(proxy),
        },
    }
    
    resp, _ := client.Get("https://ip.plainproxies.com/")
    defer resp.Body.Close()
    fmt.Println(resp.Status)
}
```

{% endtab %}

{% tab title="Java" %}

```
import java.net.*;
import java.io.*;

public class DatacenterProxy {
    public static void main(String[] args) throws Exception {
        // Residential proxy (US)
        Proxy proxy = new Proxy(Proxy.Type.HTTP,
            new InetSocketAddress("res-v2.pr.plainproxies.com", 8080));
        
        Authenticator.setDefault(new Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(
                    "username-country-US", "password".toCharArray());
            }
        });
        
        URL url = new URL("https://ip.plainproxies.com/");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection(proxy);
        conn.setRequestMethod("GET");
        
        int responseCode = conn.getResponseCode();
        System.out.println("Response Code: " + responseCode);
    }
}
```

{% endtab %}
{% endtabs %}

You can also generate the parameters using our proxy generator available on your [dashboard](https://dashboard.plainproxies.com/).


---

# 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://docs.plainproxies.com/proxies/residential-proxies/location-settings/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.
