# ASN targeting

ASN targeting is not compatible with any random continent, therefore the examples will vary from other targeting methods. This is because ASN targeting only uses region-based endpoints.

use one of these region endpoints depending on ASN:

* America: proxy-america.goproxies.com:1080
* Europe: proxy-europe.goproxies.com:1080
* Asia: proxy-asia.goproxies.com:1080

Format for username: customer-USERNAME-asn-XXXX (replace XXXX with the ASN).

Below are short snippet examples. Please see their comments too where applicable:

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
# America
curl --proxytunnel --proxy "https://customer-USERNAME-asn-12345:PASSWORD@proxy-america.goproxies.com:1080" https://ip.goproxies.com

# Europe
curl --proxytunnel --proxy "https://customer-USERNAME-asn-54321:PASSWORD@proxy-europe.goproxies.com:1080" https://ip.goproxies.com

# Asia
curl --proxytunnel --proxy "https://customer-USERNAME-asn-99999:PASSWORD@proxy-asia.goproxies.com:1080" https://ip.goproxies.com
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');
const { HttpsProxyAgent } = require('https-proxy-agent');

const username = 'customer-USERNAME-asn-12345';
const password = 'PASSWORD';
const proxyHost = 'proxy-america.goproxies.com:1080'; // or proxy-europe..., proxy-asia...
const proxyUrl = `http://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${proxyHost}`;
const agent = new HttpsProxyAgent(proxyUrl);

await axios.get('https://ip.goproxies.com', { httpsAgent: agent });
```

{% endtab %}

{% tab title="Python" %}

```python
from urllib.parse import quote
import requests

username = "customer-USERNAME-asn-12345"
password = "PASSWORD"
proxy_host = "proxy-europe.goproxies.com:1080"  # choose region
proxy = f"http://{quote(username)}:{quote(password)}@{proxy_host}"

proxies = {"http": proxy, "https": proxy}
print(requests.get("https://ip.goproxies.com", proxies=proxies, timeout=10).text)
```

{% endtab %}

{% tab title="Go" %}

```go
proxyURL, _ := url.Parse("http://customer-USERNAME-asn-99999:PASSWORD@proxy-asia.goproxies.com:1080")
transport := &http.Transport{Proxy: http.ProxyURL(proxyURL)}
client := &http.Client{Transport: transport}
resp, _ := client.Get("https://ip.goproxies.com")
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

username = 'customer-USERNAME-asn-54321'
password = 'PASSWORD'
proxy_addr = 'proxy-asia.goproxies.com'
proxy_port = 1080

uri = URI('https://ip.goproxies.com')
Net::HTTP::Proxy(proxy_addr, proxy_port, username, password).start(uri.host, uri.port, use_ssl: true) do |http|
  puts http.get(uri).body
end
```

{% endtab %}

{% tab title="Java" %}

```java
// assume Apache HttpClient on the classpath
String proxyHost = "proxy-america.goproxies.com";
int proxyPort = 1080;
String user = "customer-USERNAME-asn-12345";
String pass = "PASSWORD";

// (CredentialsProvider + HttpHost + RequestConfig same as previous examples)
```

{% endtab %}

{% tab title="PHP" %}

```php
$ch = curl_init('https://ip.goproxies.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, 'proxy-europe.goproxies.com:1080'); // region
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'customer-USERNAME-asn-54321:PASSWORD');
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
echo curl_exec($ch);
curl_close($ch);
```

{% endtab %}
{% endtabs %}


---

# 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.goproxies.com/proxies/rotating-residential-proxies/proxy-parameters/asn-targeting.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.
