In a blog post a month ago, I described how to use a terminal to display servers recommended by NordVPN, but the same result can be achieved by using public API service. It is not officially documented, so let’s play with it.
Prerequisites
Install curl
to transfer data from a server and jq
lightweight and flexible command-line JSON processor.
$ sudo apt install curl jq
Display country list
Display countries in which NordVPN servers are available.
$ curl --silent https://api.nordvpn.com/server | jq --raw-output '[.[].country] | sort | unique | .[]'
Alternatively, list every defined country.
$ curl --silent "https://api.nordvpn.com/v1/servers/countries | jq --raw-output '[.[].name] | sort | unique | .[]'
Albania Argentina Australia Austria Azerbaijan [...] Ukraine United Arab Emirates United Kingdom United States Vietnam
Display server count in each country
Display server count in each country.
$ curl --silent https://api.nordvpn.com/server | jq --raw-output '. as $parent | [.[].country] | sort | unique | .[] as $country | ($parent | map(select(.country == $country)) | length) as $count | [$country, $count] | "\(.[0]): \(.[1])"'
Remember to increase records count when using a direct API call, as you will receive only 100 records by default.
$ curl --silent "https://api.nordvpn.com/v1/servers?limit=16384" | jq --raw-output '. as $parent | [.[].locations[].country.name] | sort | unique | .[] as $country | ($parent | map(select(.locations[].country.name == $country)) | length) as $count | [$country, $count] | "\(.[0]): \(.[1])"'
Albania: 7 Argentina: 14 Australia: 194 Austria: 37 Azerbaijan: 10 [...] Ukraine: 9 United Arab Emirates: 3 United Kingdom: 664 United States: 1873 Vietnam: 3
Display available VPN servers
Display available NordVPN servers.
sort
utility to perform natural sort of (version) numbers within text due to the naming convention.$ curl --silent https://api.nordvpn.com/server | jq --raw-output '.[].domain' | sort --version-sort
$ curl --silent "https://api.nordvpn.com/v1/servers?limit=16384" | jq --raw-output '.[].hostname' | sort --version-sort
ae1.nordvpn.com ae3.nordvpn.com ae4.nordvpn.com al7.nordvpn.com al8.nordvpn.com [...] za27.nordvpn.com za28.nordvpn.com za29.nordvpn.com za30.nordvpn.com za31.nordvpn.com
Display VPN servers in a specific country
Display VPN servers in a specific country.
$ curl --silent https://api.nordvpn.com/server | jq --raw-output '.[] | select(.country == "Bosnia and Herzegovina") | .domain'
$ curl --silent "https://api.nordvpn.com/v1/servers?limit=16384" | jq --raw-output '.[] | select(.locations[].country.name == "Bosnia and Herzegovina") | .hostname'
ba1.nordvpn.com ba2.nordvpn.com ba3.nordvpn.com ba4.nordvpn.com ba5.nordvpn.com ba6.nordvpn.com
Display VPN servers with the lowest load
Display obfuscated and recommended NordVPN servers with the lowest load.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations?filters\[servers_groups\]\[identifier\]=legacy_standard&filters\[servers_groups\]\[identifier\]=legacy_obfuscated_servers" | jq --raw-output --slurp ' .[] | sort_by(.load) | limit(5;.[]) | [.hostname, .load] | "\(.[0]): \(.[1])"'
uk481.nordvpn.com: 8 uk537.nordvpn.com: 10 uk543.nordvpn.com: 11 fr267.nordvpn.com: 12 uk546.nordvpn.com: 12
Display NordVPN servers with the lowest load.
$ curl --silent https://api.nordvpn.com/server/stats | jq '. | to_entries | sort_by(.value.percent) | limit(3;.[]) | "\(.key): \(.value.percent)"'
"jp92.nordvpn.com: 0" "jp95.nordvpn.com: 0" "jp97.nordvpn.com: 0"
Display load for specific server
Display load for the specific server using the fastest method possible.
$ curl --silent https://api.nordvpn.com/server/stats/no93.nordvpn.com | jq .percent
Display load for the specific server using the slowest method possible.
$ curl --silent "https://api.nordvpn.com/v1/servers?limit=16354" | jq '.[] | select(.hostname == "no93.nordvpn.com") | .load'
41
Display specific VPN server
Display specific NordVPN server.
$ curl --silent https://api.nordvpn.com/server | jq '.[] | select(.domain == "de80.nordvpn.com")'
{ "id": 590672, "ip_address": "185.143.230.233", "search_keywords": [], "categories": [ { "name": "Standard VPN servers" }, { "name": "P2P" } ], "name": "Germany #80", "domain": "de80.nordvpn.com", "price": 0, "flag": "DE", "country": "Germany", "location": { "lat": 50.116667, "long": 8.683333 }, "load": 77, "features": { "ikev2": true, "openvpn_udp": true, "openvpn_tcp": true, "socks": true, "proxy": true, "pptp": false, "l2tp": false, "openvpn_xor_udp": false, "openvpn_xor_tcp": false, "proxy_cybersec": true, "proxy_ssl": true, "proxy_ssl_cybersec": true, "ikev2_v6": false, "openvpn_udp_v6": false, "openvpn_tcp_v6": false } }
$ curl --silent "https://api.nordvpn.com/v1/servers?limit=16354" | jq '.[] | select(.hostname == "de80.nordvpn.com")'
{ "id": 590672, "created_at": "2016-08-24 00:00:00", "updated_at": "2019-01-27 16:24:35", "name": "Germany #80", "station": "185.143.230.233", "hostname": "de80.nordvpn.com", "load": 45, "status": "online", "locations": [ { "id": 133, "created_at": "2017-06-15 14:06:47", "updated_at": "2017-06-15 14:06:47", "latitude": 50.116667, "longitude": 8.683333, "country": { "id": 81, "name": "Germany", "code": "DE", "city": { "id": 2215709, "name": "Frankfurt", "latitude": 50.116667, "longitude": 8.683333, "dns_name": "frankfurt", "hub_score": null } } } ], "services": [ { "id": 1, "name": "VPN", "identifier": "vpn", "created_at": "2017-03-21 12:00:45", "updated_at": "2017-05-25 13:12:31" }, { "id": 5, "name": "Proxy", "identifier": "proxy", "created_at": "2017-05-29 19:38:30", "updated_at": "2017-05-29 19:38:30" } ], "technologies": [ { "id": 1, "name": "IKEv2/IPSec", "identifier": "ikev2", "created_at": "2017-03-21 12:00:24", "updated_at": "2017-09-05 14:20:16", "pivot": { "technology_id": 1, "server_id": 590672, "status": "online" } }, { "id": 3, "name": "OpenVPN UDP", "identifier": "openvpn_udp", "created_at": "2017-05-04 08:03:24", "updated_at": "2017-05-09 19:27:37", "pivot": { "technology_id": 3, "server_id": 590672, "status": "online" } }, { "id": 5, "name": "OpenVPN TCP", "identifier": "openvpn_tcp", "created_at": "2017-05-09 19:28:14", "updated_at": "2017-05-09 19:28:14", "pivot": { "technology_id": 5, "server_id": 590672, "status": "online" } }, { "id": 7, "name": "Socks 5", "identifier": "socks", "created_at": "2017-05-09 19:28:57", "updated_at": "2017-06-13 14:27:05", "pivot": { "technology_id": 7, "server_id": 590672, "status": "online" } }, { "id": 9, "name": "HTTP Proxy", "identifier": "proxy", "created_at": "2017-05-09 19:29:09", "updated_at": "2017-06-13 14:25:29", "pivot": { "technology_id": 9, "server_id": 590672, "status": "online" } }, { "id": 19, "name": "HTTP CyberSec Proxy", "identifier": "proxy_cybersec", "created_at": "2017-08-22 12:44:49", "updated_at": "2017-08-22 12:44:49", "pivot": { "technology_id": 19, "server_id": 590672, "status": "online" } }, { "id": 21, "name": "HTTP Proxy (SSL)", "identifier": "proxy_ssl", "created_at": "2017-10-02 12:45:14", "updated_at": "2017-10-02 12:45:14", "pivot": { "technology_id": 21, "server_id": 590672, "status": "online" } }, { "id": 23, "name": "HTTP CyberSec Proxy (SSL)", "identifier": "proxy_ssl_cybersec", "created_at": "2017-10-02 12:50:49", "updated_at": "2017-10-02 12:50:49", "pivot": { "technology_id": 23, "server_id": 590672, "status": "online" } } ], "groups": [ { "id": 11, "created_at": "2017-06-13 13:43:00", "updated_at": "2017-06-13 13:43:00", "title": "Standard VPN servers", "type": { "id": 3, "created_at": "2017-06-13 13:40:17", "updated_at": "2017-06-13 13:40:23", "title": "Legacy category", "identifier": "legacy_group_category" } }, { "id": 15, "created_at": "2017-06-13 13:43:38", "updated_at": "2017-06-13 13:43:38", "title": "P2P", "type": { "id": 3, "created_at": "2017-06-13 13:40:17", "updated_at": "2017-06-13 13:40:23", "title": "Legacy category", "identifier": "legacy_group_category" } }, { "id": 19, "created_at": "2017-10-27 14:17:17", "updated_at": "2017-10-27 14:17:17", "title": "Europe", "type": { "id": 5, "created_at": "2017-10-27 14:16:30", "updated_at": "2017-10-27 14:16:30", "title": "Regions", "identifier": "regions" } } ], "specifications": [ { "id": 8, "title": "Version", "identifier": "version", "values": [ { "id": 197, "value": "1.0.0" } ] } ], "ips": [ { "id": 15195, "created_at": "2018-02-23 07:28:48", "updated_at": "2018-02-23 07:28:48", "server_id": 590672, "ip_id": 1613, "type": "entry", "ip": { "id": 1613, "ip": "185.143.230.233", "version": 4 } } ] }
Display identifier number for each country
Display the current identifier number for each country.
$ curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | [.id, .name] | @tsv'
2 Albania 10 Argentina 13 Australia 14 Austria 15 Azerbaijan [...] 225 Ukraine 226 United Arab Emirates 227 United Kingdom 228 United States 234 Vietnam
Display identifier numbers for each country and city
Display current identifier numbers for each country and city.
$ curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | . as $parent | .cities[] | [$parent.name, $parent.id, .name, .id] | "\(.[0]) [\(.[1])] - \(.[2]) [\(.[3])]"'
Albania [2] - Tirana [308615] Argentina [10] - Buenos Aires [384866] Australia [13] - Adelaide [452717] Australia [13] - Brisbane [456494] Australia [13] - Melbourne [470813] [...] United States [228] - Saint Louis [8934551] United States [228] - Salt Lake City [9097865] United States [228] - San Francisco [8766359] United States [228] - Seattle [9128402] Vietnam [234] - Hanoi [9270302]
Display identifier number for the specific country
Display the current identifier number for a specific country.
$ curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | select(.name == "Germany") | [.name, .id] | "ID for \(.[0]) is \(.[1])"'
ID for Germany is 81
Display recommended VPN servers
Display the top 100 recommended NordVPN servers.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations" | jq --raw-output '.[].hostname'
pl32.nordvpn.com pl39.nordvpn.com pl62.nordvpn.com pl60.nordvpn.com pl64.nordvpn.com [...] dk80.nordvpn.com dk90.nordvpn.com dk78.nordvpn.com dk68.nordvpn.com dk39.nordvpn.com
These are the nearest servers sorted by the current load.
Display top 5 recommended VPN servers
Display the top 5 recommended NordVPN servers.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations" | jq --raw-output 'limit(5;.[]) | .hostname'
pl32.nordvpn.com pl39.nordvpn.com pl62.nordvpn.com pl60.nordvpn.com pl64.nordvpn.com
Display additional information about recommended VPN servers
Display the top three recommended NordVPN servers, including basic information.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations" | jq --raw-output 'limit(3;.[]) | " Server: \(.name)\nHostname: \(.hostname)\nLocation: \(.locations[0].country.name) - \(.locations[0].country.city.name)\n Load: \(.load)\n"'
Server: Poland #32 Hostname: pl32.nordvpn.com Location: Poland - Warsaw Load: 10 Server: Poland #39 Hostname: pl39.nordvpn.com Location: Poland - Warsaw Load: 13 Server: Poland #62 Hostname: pl62.nordvpn.com Location: Poland - Warsaw Load: 14
Display the top three recommended NordVPN servers, including most of the available information.
curl --silent "https://api.nordvpn.com/v1/servers/recommendations" | jq --raw-output 'limit(3;.[]) | " Server: \(.name)\n Hostname: \(.hostname)\n Location: \(.locations[0].country.name) - \(.locations[0].country.city.name)\n Load: \(.load)\n Created: \(.created_at)\n Updated: \(.updated_at)\n Region: \(.groups | map(select( .type.identifier == "regions") | .title) | join(", "))\n Groups: \(.groups | map(select( .type.identifier == "legacy_group_category") | .title) | join(", "))\nTechnologies: ", "\(.technologies | map(select( .pivot.status == "online") | .name) | " - \(.[])")",""'
Server: Poland #61 Hostname: pl61.nordvpn.com Location: Poland - Warsaw Load: 13 Created: 2018-11-22 13:05:19 Updated: 2019-01-27 16:27:50 Region: Europe Groups: Standard VPN servers, P2P Technologies: - IKEv2/IPSec - OpenVPN UDP - OpenVPN TCP - Socks 5 - HTTP Proxy - HTTP CyberSec Proxy - HTTP Proxy (SSL) - HTTP CyberSec Proxy (SSL) Server: Poland #64 Hostname: pl64.nordvpn.com Location: Poland - Warsaw Load: 16 Created: 2018-12-20 23:04:32 Updated: 2019-01-27 16:29:23 Region: Europe Groups: Standard VPN servers, P2P Technologies: - IKEv2/IPSec - OpenVPN UDP - OpenVPN TCP - Socks 5 - HTTP Proxy - HTTP CyberSec Proxy - HTTP Proxy (SSL) - HTTP CyberSec Proxy (SSL) Server: Poland #47 Hostname: pl47.nordvpn.com Location: Poland - Warsaw Load: 18 Created: 2018-03-23 09:43:03 Updated: 2019-01-27 16:33:58 Region: Europe Groups: Standard VPN servers, P2P Technologies: - IKEv2/IPSec - OpenVPN UDP - OpenVPN TCP - Socks 5 - HTTP Proxy
Display first recommended VPN server
Display the first recommended NordVPN server.
$ curl --silent https://api.nordvpn.com/v1/servers/recommendations | jq '. | first'
{ "id": 934373, "created_at": "2018-12-20 23:04:32", "updated_at": "2019-01-27 14:04:23", "name": "Poland #65", "station": "37.120.156.83", "hostname": "pl65.nordvpn.com", "load": 12, "status": "online", "locations": [ { "id": 367, "created_at": "2017-06-15 14:06:47", "updated_at": "2017-06-15 14:06:47", "latitude": 52.25, "longitude": 21, "country": { "id": 174, "name": "Poland", "code": "PL", "city": { "id": 6863429, "name": "Warsaw", "latitude": 52.25, "longitude": 21, "dns_name": "warsaw", "hub_score": null } } } ], "services": [ { "id": 1, "name": "VPN", "identifier": "vpn", "created_at": "2017-03-21 12:00:45", "updated_at": "2017-05-25 13:12:31" }, { "id": 5, "name": "Proxy", "identifier": "proxy", "created_at": "2017-05-29 19:38:30", "updated_at": "2017-05-29 19:38:30" } ], "technologies": [ { "id": 1, "name": "IKEv2/IPSec", "identifier": "ikev2", "created_at": "2017-03-21 12:00:24", "updated_at": "2017-09-05 14:20:16", "pivot": { "technology_id": 1, "server_id": 934373, "status": "online" } }, { "id": 3, "name": "OpenVPN UDP", "identifier": "openvpn_udp", "created_at": "2017-05-04 08:03:24", "updated_at": "2017-05-09 19:27:37", "pivot": { "technology_id": 3, "server_id": 934373, "status": "online" } }, { "id": 5, "name": "OpenVPN TCP", "identifier": "openvpn_tcp", "created_at": "2017-05-09 19:28:14", "updated_at": "2017-05-09 19:28:14", "pivot": { "technology_id": 5, "server_id": 934373, "status": "online" } }, { "id": 7, "name": "Socks 5", "identifier": "socks", "created_at": "2017-05-09 19:28:57", "updated_at": "2017-06-13 14:27:05", "pivot": { "technology_id": 7, "server_id": 934373, "status": "online" } }, { "id": 9, "name": "HTTP Proxy", "identifier": "proxy", "created_at": "2017-05-09 19:29:09", "updated_at": "2017-06-13 14:25:29", "pivot": { "technology_id": 9, "server_id": 934373, "status": "online" } }, { "id": 19, "name": "HTTP CyberSec Proxy", "identifier": "proxy_cybersec", "created_at": "2017-08-22 12:44:49", "updated_at": "2017-08-22 12:44:49", "pivot": { "technology_id": 19, "server_id": 934373, "status": "online" } }, { "id": 21, "name": "HTTP Proxy (SSL)", "identifier": "proxy_ssl", "created_at": "2017-10-02 12:45:14", "updated_at": "2017-10-02 12:45:14", "pivot": { "technology_id": 21, "server_id": 934373, "status": "online" } }, { "id": 23, "name": "HTTP CyberSec Proxy (SSL)", "identifier": "proxy_ssl_cybersec", "created_at": "2017-10-02 12:50:49", "updated_at": "2017-10-02 12:50:49", "pivot": { "technology_id": 23, "server_id": 934373, "status": "online" } } ], "groups": [ { "id": 11, "created_at": "2017-06-13 13:43:00", "updated_at": "2017-06-13 13:43:00", "title": "Standard VPN servers", "type": { "id": 3, "created_at": "2017-06-13 13:40:17", "updated_at": "2017-06-13 13:40:23", "title": "Legacy category", "identifier": "legacy_group_category" } }, { "id": 15, "created_at": "2017-06-13 13:43:38", "updated_at": "2017-06-13 13:43:38", "title": "P2P", "type": { "id": 3, "created_at": "2017-06-13 13:40:17", "updated_at": "2017-06-13 13:40:23", "title": "Legacy category", "identifier": "legacy_group_category" } }, { "id": 19, "created_at": "2017-10-27 14:17:17", "updated_at": "2017-10-27 14:17:17", "title": "Europe", "type": { "id": 5, "created_at": "2017-10-27 14:16:30", "updated_at": "2017-10-27 14:16:30", "title": "Regions", "identifier": "regions" } } ], "specifications": [ { "id": 8, "title": "Version", "identifier": "version", "values": [ { "id": 257, "value": "2.1.0" } ] } ], "ips": [ { "id": 71972, "created_at": "2018-12-20 23:04:32", "updated_at": "2018-12-20 23:04:32", "server_id": 934373, "ip_id": 34607, "type": "entry", "ip": { "id": 34607, "ip": "37.120.156.83", "version": 4 } } ] }
Apply filter to display recommended VPN servers for a specific country
Display the top three recommended NordVPN servers located in Germany.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations?filters\[country_id\]=81&limit=3" | jq --raw-output '.[].hostname'
de435.nordvpn.com de433.nordvpn.com de472.nordvpn.com
Display identifier numbers for each group and category
Display current identifier numbers for each group and category.
$ curl --silent "https://api.nordvpn.com/v1/servers/groups" | jq --raw-output '.[] | . as $parent | .type | [$parent.title, $parent.id, $parent.identifier, .title, .id, .identifier] | "\(.[0]) [\(.[2]) (\(.[1]))] - \(.[3]) [\(.[5]) (\(.[4]))]"'
Double VPN [legacy_double_vpn (1)] - Legacy category [legacy_group_category (3)] Onion Over VPN [legacy_onion_over_vpn (3)] - Legacy category [legacy_group_category (3)] Ultra fast TV [legacy_ultra_fast_tv (5)] - Legacy category [legacy_group_category (3)] Anti DDoS [legacy_anti_ddos (7)] - Legacy category [legacy_group_category (3)] Dedicated IP [legacy_dedicated_ip (9)] - Legacy category [legacy_group_category (3)] Standard VPN servers [legacy_standard (11)] - Legacy category [legacy_group_category (3)] Netflix USA [legacy_netflix_usa (13)] - Legacy category [legacy_group_category (3)] P2P [legacy_p2p (15)] - Legacy category [legacy_group_category (3)] Obfuscated Servers [legacy_obfuscated_servers (17)] - Legacy category [legacy_group_category (3)] Europe [europe (19)] - Regions [regions (5)] The Americas [the_americas (21)] - Regions [regions (5)] Asia Pacific [asia_pacific (23)] - Regions [regions (5)] Africa, the Middle East and India [africa_the_middle_east_and_india (25)] - Regions [regions (5)]
Display identifier number for each technology
Display the current identifier number for each technology.
$ curl --silent "https://api.nordvpn.com/v1/technologies" | jq --raw-output '.[] | [.name, .id, .identifier] | "\(.[0]) [\(.[2]) (\(.[1]))]"'
IKEv2/IPSec [ikev2 (1)] OpenVPN UDP [openvpn_udp (3)] OpenVPN TCP [openvpn_tcp (5)] Socks 5 [socks (7)] HTTP Proxy [proxy (9)] PPTP [pptp (11)] L2TP/IPSec [l2tp (13)] OpenVPN UDP Obfuscated [openvpn_xor_udp (15)] OpenVPN TCP Obfuscated [openvpn_xor_tcp (17)] HTTP CyberSec Proxy [proxy_cybersec (19)] HTTP Proxy (SSL) [proxy_ssl (21)] HTTP CyberSec Proxy (SSL) [proxy_ssl_cybersec (23)] IKEv2/IPSec IPv6 [ikev2_v6 (26)] OpenVPN UDP IPv6 [openvpn_udp_v6 (29)] OpenVPN TCP IPv6 [openvpn_tcp_v6 (32)]
Apply filter to display recommended VPN servers in a specific group
Display the top three recommended NordVPN servers that are hidden and located in Singapore.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations?filters\[servers_groups\]\[identifier\]=legacy_obfuscated_servers&filters\[country_id\]=195&limit=3" | jq '.[].hostname'
sg113.nordvpn.com sg123.nordvpn.com sg107.nordvpn.com
Display the top three nearest and hidden NordVPN servers.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations?filters\[servers_groups\]\[identifier\]=legacy_obfuscated_servers&limit=3" | jq --raw-output '.[].hostname'
se184.nordvpn.com se107.nordvpn.com se148.nordvpn.com
Apply filter to display recommended VPN servers in a specific group using specific technology
Display the top three nearest and NordVPN servers that provide SSL Proxy.
$ curl --silent "https://api.nordvpn.com/v1/servers/recommendations?filters\[servers_groups\]\[identifier\]=legacy_standard&filters\[servers_technologies\]\[identifier\]=proxy_ssl&limit=3" | jq '.[].hostname'
pl59.nordvpn.com pl64.nordvpn.com pl57.nordvpn.com
Additional notes
This blog post is definitely too long.