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 LocationsWhat 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:not.country
not.city
not.state
not.asn
- 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.
Calling API with Location Exclusions
1. Exclude by Country
Use-not.country-xx
or multiple like -not.country-xx,yy,zz
.
2. Exclude by State
Use-not.state-<state_name>
.
3. Exclude by City
Use-not.city-<city_name>
.
4. Exclude by ASN (ISP)
Use-not.asn-<ASN_NUMBER>
. You can also pass multiple values like -not.asn-31898,12271
.
Example Response
Here’s an example API response when city or ASN is excluded: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.
Can I target both state and city in a single request?
Can I target both state and city in a single request?
No, you can’t target both state and city at the same time. You must choose one.
How do I know which countries or cities are available for targeting?
How do I know which countries or cities are available for targeting?
You can check the list of available locations directly from the Geonode Dashboard or use the API to retrieve the locations.
What do I do if my targeted location isn't working?
What do I do if my targeted location isn't working?
Make sure you’re using the correct username format for the location and that the proxy is functional in the targeted area. Also, ensure your credentials are correct.
Can I automate geo-targeted requests for multiple locations?
Can I automate geo-targeted requests for multiple locations?
Yes, you can automate this by scripting your requests using loops or functions, specifying different locations for each API call.