exclude[countries] parameter enables the user to calculate routes that avoid specific countries. Resulting route will never go through excluded country. If the only way is through such country, for example when origin is in it, then no route is returned. This is different from the
avoid options and it is the reason that the parameter is in
The following example route from Milan to Frankfurt is avoiding Switzerland.
curl -X GET \ 'https://router.hereapi.com/v8/routes?origin=45.474427,9.138537&destination=50.096988,8.66033&return=polyline,summary,actions,instructions&transportMode=car&exclude[countries]=CHE'
The purple route represents a route without the
exclude[countries] parameter. It is going through Switzerland. The blue route is the route from request above.
For a request with a failed detour calculation, see Fail a detour.