Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Requests. Nord Public API deprecated. #294

Open
ph202107 opened this issue Mar 5, 2024 · 16 comments
Open

Feature Requests. Nord Public API deprecated. #294

ph202107 opened this issue Mar 5, 2024 · 16 comments
Labels
enhancement New feature or request

Comments

@ph202107
Copy link

ph202107 commented Mar 5, 2024

Hi! The NordVPN Public API was a very useful tool, however parts of the API have now been deprecated: https://support.nordvpn.com/hc/en-us/articles/21586950310801-Discontinuation-of-the-legacy-API-endpoints-on-NordVPN

Would it be possible to add these features to the Linux CLI?

  • server load percentage. A common statistic presented in the GUI apps, but not available for Linux. In many cases seeing a high server load will encourage me to choose a different region, in a very small way actually helping with load-balancing. The server load could be presented after the connection is established if not available beforehand. This should also help users with manual or router setups who would like to check the load on a particular server as a typical part of troubleshooting.

This command has worked for years until recently:
curl --silent https://api.nordvpn.com/server/stats/us9305.nordvpn.com | jq .percent

  • a way to retrieve or search an updated list of all the available VPN servers. From such a list Linux users could determine the available Double_VPN server-pairs, the server names and locations of the Onion_Over_VPN servers, the highest-numbered servers in a particular region (which may be useful for some streaming services) and other uses.

For just one example, say I would like to connect to the Double_VPN server group in a particular location and from the manual I know that I can specify the first hop with
nordvpn connect --group Double_VPN <location>
Auto-complete appears to show all the countries, including countries where Double_VPN is not available. How could I determine that Sweden supports Double_VPN, and that Sweden pairs with both Switzerland (se-ch) and Netherlands (se-nl) so that I can choose the server-pair that I prefer?

With the Public API this was trivial, but as of 2024/03/05 there seems to be no method to retrieve this information. Please correct me if I'm wrong, I'm an absolute novice with using any API. The CLI is a great tool and querying the API from the terminal integrated very well, including on remote or headless systems.

I'm sorry to see that these features have been removed, hopefully they can be restored in one form or another. Thank you for your consideration.

@hackthis02
Copy link

Using a custom script I was able to load balance sock5 servers for my BitTorrent client. Without this API, there is no feasible way to do this. Resulting in potentially slower network speeds from the users side and stressed servers on the networks side.

@Savolro
Copy link
Collaborator

Savolro commented Mar 12, 2024

Hi and sorry for a delayed response.

As announced in this notice (https://support.nordvpn.com/hc/en-us/articles/21586950310801-Discontinuation-of-the-legacy-API-endpoints-on-NordVPN), the legacy API endpoints will no longer be active or recommended for future use. To achieve similar functionality, you can utilize the new API endpoint at https://api.nordvpn.com/v1/servers/recommendations. This endpoint provides detailed information about VPN exit nodes, including server load, and offers a list of servers based on our recommendations. For a comprehensive list of servers, access https://api.nordvpn.com/v1/servers. Remember to include "?limit=[value]" in your request to limit the response output.

@Savolro
Copy link
Collaborator

Savolro commented Mar 12, 2024

Regarding second location selecting for Double VPN - currently it is not supported. Will update this ticket when there are any updates on this.

@Savolro Savolro added the enhancement New feature or request label Mar 12, 2024
@Mouseboy007
Copy link

Mouseboy007 commented Mar 15, 2024

Hi and sorry for a delayed response.

As announced in this notice (https://support.nordvpn.com/hc/en-us/articles/21586950310801-Discontinuation-of-the-legacy-API-endpoints-on-NordVPN), the legacy API endpoints will no longer be active or recommended for future use. To achieve similar functionality, you can utilize the new API endpoint at https://api.nordvpn.com/v1/servers/recommendations. This endpoint provides detailed information about VPN exit nodes, including server load, and offers a list of servers based on our recommendations. For a comprehensive list of servers, access https://api.nordvpn.com/v1/servers. Remember to include "?limit=[value]" in your request to limit the response output.

Before it was deprecated, querying https://api.nordvpn.com/server/stats would allow seeing current load on the connected Server. Is there a faster way to do this than querying https://api.nordvpn.com/v1/servers and then retrospectively grabbing the data from the large raw data dump. accessing the stats directly would be faster for the end user and less resource intensive for NordVPN I would presume

@ph202107
Copy link
Author

ph202107 commented Apr 3, 2024

Filtering by hostname (or IP address) would be ideal, that would download only about 3KB for one server record instead of 20MB for all 6300+ servers. I found a filter for "server id", and that works well:

curl "https://api.nordvpn.com/v1/servers?limit=1&filters\[servers.id\]=930119" | jq '.[].load'

It will return the record for "be148.nordvpn.com" and then jq can find the load. The problem is I wouldn't know the server id until I download the entire 20MB json, and the json is subject to change as servers are added and removed.

Is there an equivalent filter for hostname? I can't seem to find one. Thanks!

@Mouseboy007
Copy link

Mouseboy007 commented Apr 3, 2024

Filtering by hostname (or IP address) would be ideal, that would download only about 3KB for one server record instead of 20MB for all 6300+ servers. I found a filter for "server id", and that works well:

curl "https://api.nordvpn.com/v1/servers?limit=1&filters\[servers.id\]=930119" | jq '.[].load'

It will return the record for "be148.nordvpn.com" and then jq can find the load. The problem is I wouldn't know the server id until I download the entire 20MB json, and the json is subject to change as servers are added and removed.

Is there an equivalent filter for hostname? I can't seem to find one. Thanks!

If it helps, how I've ended up doing it in a script is:

CurrentVPNServer=nordvpn status | grep -E "Hostname" | awk -F ": " '{print $2}'
CountryCode=echo $CurrentVPNServer | awk -F"[0-9]+" '{print $1;}' | awk -F": " '{print $1}'

curl --silent "https://api.nordvpn.com/v1/servers?filters\[country_id\]=$CountryCode&\[servers_groups\]\[identifier\]=legacy_standard&limit=16354" | jq --raw-output '.[] | select(.hostname | contains("'$CurrentVPNServer'")) | [.hostname, .load] | "(.[0]): (.[1])"'

^ As you say, the catch 22 is you have to pull a large amount of data before you can get the data you need to query the data ...

@mike-sirs
Copy link

https://api.nordvpn.com/v1/servers/recommendations returns a sorted list of recommended servers
simple script to update wg on openwrt
https://raw.githubusercontent.com/mike-sirs/openwrt-configs/main/nordvpn-wireguard.sh

@bengalih
Copy link

bengalih commented Apr 9, 2024

Regarding second location selecting for Double VPN - currently it is not supported. Will update this ticket when there are any updates on this.

Please provide proper filter syntax to query only for SOCKS servers using the https://api.nordvpn.com/v1/servers/ endpoint.
It is inefficient to request the download of all 6300+ servers per query.

@Tuinslak
Copy link

Apologies for asking here, but I can't find an answer anywhere.

Is anything replacing https://api.nordvpn.com/vpn/check/full?
A simple query to return whether you're currently protected by NordVPN?

@mariusSincovici
Copy link
Contributor

hi @Tuinslak,
you could use https://api.nordvpn.com/v1/helpers/ips/insights.

@znbaboy
Copy link

znbaboy commented May 3, 2024

Hi and sorry for a delayed response.

As announced in this notice (https://support.nordvpn.com/hc/en-us/articles/21586950310801-Discontinuation-of-the-legacy-API-endpoints-on-NordVPN), the legacy API endpoints will no longer be active or recommended for future use. To achieve similar functionality, you can utilize the new API endpoint at https://api.nordvpn.com/v1/servers/recommendations. This endpoint provides detailed information about VPN exit nodes, including server load, and offers a list of servers based on our recommendations. For a comprehensive list of servers, access https://api.nordvpn.com/v1/servers. Remember to include "?limit=[value]" in your request to limit the response output.

Hi. Thank you for this.

I am kind of new to this stuff but I've been using https://api.nordvpn.com/v2/servers to get a list of servers.

Everything works great after your explanation on how to retrieve the entire list of servers (limit value).

The question I had was, I am trying to get a full list of US only servers. Is there a parameter I can use (like the limit) at the end of the URL so the API only serves me what I need?

Thanks!

@mariusSincovici
Copy link
Contributor

hi,
there are parameters for limits and to restrict results to a country, filters[country_id] and limit. Setting the limit very high will give you all the servers, e.g.: https://api.nordvpn.com/v2/servers?filters[country_id]=228&limit=10000

@znbaboy
Copy link

znbaboy commented May 6, 2024

hi, there are parameters for limits and to restrict results to a country, filters[country_id] and limit. Setting the limit very high will give you all the servers, e.g.: https://api.nordvpn.com/v2/servers?filters[country_id]=228&limit=10000

thank you. this works on browsers, but for some reason my curl -s command returns nothing

@mariusSincovici
Copy link
Contributor

does curl -g -s https://api.nordvpn.com/v2/servers\?filters\[country_id\]\=228\&limit=10000 work?
if not try to remove -s to see the errors.

@znbaboy
Copy link

znbaboy commented May 8, 2024

does curl -g -s https://api.nordvpn.com/v2/servers\?filters\[country_id\]\=228\&limit=10000 work? if not try to remove -s to see the errors.

All i get is HTML title and head saying "301 moved permanently"

@Manwithpants812
Copy link

Manwithpants812 commented May 11, 2024

Just so people don't waste time, will "https://api.nordvpn.com/v1/servers" be eventually deprecated for "https://api.nordvpn.com/v2/servers"? I ask as the jsons returned have different structures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants