API Documentation

How do PureWL APIs work?

Estimated reading: 5 minutes

The following section describes the process of establishing a VPN Connection through the API.

In most cases, a user starts the overall communication process by dialing to a server with credentials using a network protocol. Though to get the DNS of a VPN Server there are prerequisites explained below:

  1. Get your Secret Key from Partner’s Console
  2. Get Access Token via Secret key received in First Step
  3. Get the Fastest Server DNS using GetServer API
  4. Dial DNS using the selected Protocol to establish a Connection

Note:
The API Secret Key can be retrieved from Partner’s console. Though a prior Signup and Paid Subscription to the services are also a prerequisite.

Your App sends a VPN Connection Request to the PureWL-provided DNS with VPN Credentials using the Web Service API. PureWL verifies the Credentials and creates a VPN Tunnel over the requested Protocol.

Note:
Before establishing a VPN Connection you must create a VPN Account. On Account Creation the API will respond with Valid Credentials those are to be use in every VPN Connection Request.

Web service interfaces are designed using the Open API Specification / Swagger. You must have API Secret Key to access these API. As your app requests a connection with valid credentials, connection establishes without prompting you for any other input. A secure connection is established and all data transferred between your application and Internet stay safe from any logging or monitoring by the ISP.

Note:
All API are called by sending a RESTful request to the following URL: https://atomapi.com

This operation returns a JSON-encoded response. Depending on the tools you use to integrate with the Web Service API, you may need to save the API Secret Key in a safe place. If so, you must tell your tool that the communication is SSL-enabled. The process for this depends upon your tool. Consult the documentation for your tool for details. The following section will guide you in setting up your account for building and performing custom VPN Connections.

Getting Started

To begin with, you’ll need a Subscribed Partner’s account that will allow you to access PureWL API.

Get Access Token

An access token is an opaque string that identifies a user and can be used by the app to make API calls. The token includes information about when the token will expire. Because of privacy checks, the majority of API calls need to include an access token.

Access tokens can be fetched via the Secret Key explained below.

  1. First, browse console.purewl.com and log into the platform’s console with your credentials.
  2. Go to the section Secret Key
  3. Copy the Secret key shared on the Screen. (Do not share it with any untrusted source).

After getting the Secret Key, create a REST request to retrieve your access token.

Create VPN Account

Each VPN Account has its credentials (username and password) on the Platform, and VPN Services only recognize the credentials associated with the platform. Following are the possibilities to authenticate users with Platform VPN Services.

Platform Provided Credentials

  • Create a VPN Account via API.
  • The above step would return a username and password for the created VPN Account.
  • Partner is requested to use these credentials to create a VPN Tunnel.

Single Sign On

Partners looking to authenticate and authorize their existing users (associated with the partner’s application), can follow the below steps for authenticating and authorizing their users on the Platform.

  • Create a VPN Account via API.
  • The above step would return a username and password for the created VPN Account.
  • Partner is requested to map these credentials against the email address/username their application is using for authenticating users.
  • As the user attempts to create a VPN Tunnel, mapped credentials (provided by the platform) are to be used with the request.

Get Fastest Server

To connect to the fastest server there is an API exposed at an endpoint called GetServer, also an equivalent method encapsulated in Client side SDK. There are two mechanisms available to get the fastest server from speed test.

Ping Datacenter Algorithm

(Speedtest 4.0 – Recommended)

Ping algorithm is best suited for SDK implementation as SDK offers a PingDataCenters() (explained separately in SDK documentation) to get the closest data centers to ensure the least latency. This method is to be called with regular intervals to ensure list of the best possible data centers.

Note:
To get a list of Data Centers you are subscribed to use exposed API.

As a user requests for VPN Connection, the closest data centers get passed to SpeedTest Algo, to identify the best VPN server within those Data Centers.

Via Latitude & Longitude Algorithm

(SpeedTest 2.0)

This mechanism is to be used when attempting to get the best Server via RESTful API. This method gets the Fastest Server based on your provided Latitude and Longitude and attempts to get the fastest server based on your location.

Establish VPN Connection

Once the fastest Server gets received, you are now ready to attempt to create a VPN Tunnel with the VPN Server returned via SpeedTest API. To establish a VPN connection, the following Protocols are supported over VPN Servers to create a Tunnel.

  • IPSec
  • IKEV2
  • OpenVPN
  • Wireguard
Share this Doc

How do PureWL APIs work?

Or copy link

On This Page