Targeting
Country, state, city, ASN, ZIP and OS, and which network supports each.
Targeting is set with tokens in the proxy username (Connection strings) or with the matching query parameters of the list endpoints.
| Token | List parameter | Values | Residential | Mobile |
|---|---|---|---|---|
_c_ | country | ISO-2, lowercase | Yes | Yes |
_st_ | state | Alias from the locations endpoint | Yes; needs a country, not together with a city | No |
_city_ | city | Alias from the locations endpoint | Yes; needs a country | Yes; needs a country |
_asn_ | asn | AS number | Yes; needs a country | Yes; needs a country |
_zip_ | zip | Postal code | No | Yes; needs a country |
_os_ | os | windows, android, ios, mac | Yes | No |
A token the network does not support is refused: the list endpoints answer 400 bad_target, the gateway answers 400 with X-Proxy-Error: bad_target.
Finding the values
The locations endpoints return what can be targeted right now, with the exact aliases:
# Countries only
curl https://api.boxafox.com/v1/locations/residential -H "X-API-Key: $BOXAFOX_KEY"
# One country with its states, cities and ASNs
curl "https://api.boxafox.com/v1/locations/residential?country=de" -H "X-API-Key: $BOXAFOX_KEY"The list is refreshed every 6 hours. The endpoints support ETag and If-None-Match, so a client can cache it and ask only whether it changed. supports in the answer says which targeting options the network has.
When no IP matches
If the network has no IP for the location you asked for, the gateway answers 503 with X-Proxy-Error: no_node_for_target. Widen the target (for example drop the city) or try again later.