npm install @octaspace/api.js
import { Octa, KeyError, UUIDError, ApiError } from '@octaspace/api.js';
const octa = new Octa('your-api-key');
Fetch this from Settings of Cube portal.
Pass type ("wg" or "openvpn") and nodeid (number) as parameter.
const createdVPN = await octa.createVPN('type', 1);
Returns UUID
const vpnDetails = await octa.getVPN('uuid');
await octa.stopVPN('uuid');
const vpnNodes = await octa.getVPNNodes();
const accountDetails = await octa.getAccountInfo();
const accountBalance = await octa.getAccountBalance();
Note: checkout lib/src/types.ts
for detail information about what they return.
KeyError
: Thrown for issues with the API key. Ex: Wrong API KeyUUIDError
: Thrown for issues with the UUID.ApiError
: Generic API error. Ex: Due to Network Error
MIT License - see LICENSE file for details.