This guide will help you understand how to exclude proxies from specific cities, countries, states, or ISPs using the Geonode API.

Prerequisites

Before you begin, make sure you:
  • Have active Geonode proxy credentials.
  • Understand how to make API calls using tools like cURL or Python.

What is Location Exclusion?

Geonode allows you to exclude certain locations while routing traffic through proxies. This is helpful when you want to avoid specific regions due to content restrictions, compliance, or testing needs. ➡️ Want to route traffic through a location instead? See Targeting Locations

What Can You Exclude?

You can exclude proxies based on:
  • Country
  • State
  • City
  • ASN (Autonomous System Number)
You can’t combine different exclusion types in a single request. For example, you can’t exclude cities and ASNs together.

Format for Exclusion

To exclude a location, modify your proxy username like this:
curl --request GET \
     -x "http://proxy.geonode.io:<port>" \
     --user "<geonode_username>-not.country-<country_code>:<geonode_password>" \
     --url "http://ip-api.com/json"
Supported location types:
  • not.country
  • not.city
  • not.state
  • not.asn
You can pass:
  • A single exclusion: -not.city-tokyo
  • Multiple exclusions: -not.city-tokyo,kyoto,osaka

Get Proxy with Exclusions from Dashboard

You can easily get the correct country codes, city names, state names, and ASN numbers directly from the Geonode Dashboard. Just go to the right-hand filters for Country, City, State, or ASN targeting. Once selected, they will appear in the proxy string for reference. Locations

Calling API with Location Exclusions

1. Exclude by Country

Use -not.country-xx or multiple like -not.country-xx,yy,zz.
curl --request GET \
     -x "http://proxy.geonode.io:<port>" \
     --user "<geonode_username>-not.country-<country_code_1>,<country_code_2>:<geonode_password>" \
     --url "http://ip-api.com/json"
📄 See full API doc for country exclusion

2. Exclude by State

Use -not.state-<state_name>.
curl --request GET \
     -x "http://proxy.geonode.io:<port>" \
     --user "<geonode_username>-country-<country_code>-not.state-<state_name>:<geonode_password>" \
     --url "http://ip-api.com/json"
📄 See full API doc for state exclusion

3. Exclude by City

Use -not.city-<city_name>.
curl --request GET \
     -x "http://proxy.geonode.io:<port>" \
     --user "<geonode_username>-country-<country_code>-not.city-<city_name>:<geonode_password>" \
     --url "http://ip-api.com/json"
📄 See full API doc for city exclusion

4. Exclude by ASN (ISP)

Use -not.asn-<ASN_NUMBER>. You can also pass multiple values like -not.asn-31898,12271.
curl --request GET \
     -x "http://proxy.geonode.io:<port>" \
     --user "<geonode_username>-country-<country_code>-not.asn-<ASN_NUMBER>:<geonode_password>" \
     --url "http://ip-api.com/json"
📄 See full API doc for ASN exclusion

Example Response

Here’s an example API response when city or ASN is excluded:
{
  "status": "success",
  "country": "United States",
  "countryCode": "US",
  "region": "NC",
  "regionName": "North Carolina",
  "city": "Charlotte",
  "zip": "28202",
  "lat": 35.2327,
  "lon": -80.8461,
  "timezone": "America/New_York",
  "isp": "FiberPower LLC",
  "org": "FiberPower LLC",
  "as": "AS214483 FiberPower LLC",
  "query": "38.13.166.129"
}
This shows the API successfully excluded the targeted city, and routed through an allowed location instead.

Troubleshooting Tips

  • Make sure exclusions use correct names (e.g., “newyork” not “New York”).
  • City/state names should not have spaces.
  • Double-check that you are not mixing exclusion types in one request.
  • If you get 407 errors, check username/password.
If you encounter any issues, refer to the troubleshooting section or Geonode support.