Skip to main content

Fetching a list of available locations

Locations represent a cluster of servers at a specific geographical location. The SDK will use proper caching so that this list is frequently updated.

get_locations_for_protocols

Fetch list of locations with an HTTP call or from local HTTP cache, small response payload size. This will return all available locations for the provided subscription id and protocols. A shortcut to this method is get_locations() which will set the protocols to lightway, openvpn and wireguard.

Parameters

NameDescription
subscription_idID of the subscription which has a VPN entitlement. You can obtain that subscription id as described in Obtaining a VPN Subscription ID
protocolsAn array of protocol identifiers.
lightway
openvpn
wireguard
proxy

Returns

Array of ServerLocation objects if successful, InstanceDiscoveryException otherwise.

get_full_locations_for_protocols

Fetch full dataset of all locations and endpoints, around 3MB JSON payload compressed to around 300kb over the wire, or read from local cache. The method returns all available locations for the provided subscription id and protocols.

The set of protocols must be full list of protocols supported by current client.

Parameters

NameDescription
subscription_idID of the subscription which has a VPN entitlement. You can obtain that subscription id as described in Obtaining a VPN Subscription ID
protocolsAn array of all protocol identifiers supported by current client.
lightway
openvpn
wireguard
proxy

ServerLocation

NameDescription
idUnique ID of that location
nameDisplay Name of that location
latitudeGeographical Latitude of that location
longitudeGeographical Longitude of that location
country_codeISO3166-1 alpha2 Country Code
instance_count_minMinimum number of instances in that location
instance_count_maxMaximum number of instances in that location
is_geolocatedIf true, this instance is physically not located in that location, but emulates the location by using a specific set of IPs, which are associated with that location
popularity_orderIf set, it defines the popularity of that location, which can be used to show popular locations in the UI of the app
test_ipsA set of IPs, which this instance provided to run speedtests