Connection & Usage

Monitor active VPN connections, view connection history, and retrieve usage statistics.

Get Active Connection

Check the current VPN connection status for the authenticated user, including the connected server, protocol, duration, and data transferred.

GET/api/v1/vpn/connection

Get the active VPN connection status

Authentication:Bearer Token
curl -X GET https://api.orbai.world/api/v1/vpn/connection \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
200Active connection found
{
  "success": true,
  "data": {
    "is_connected": true,
    "connection": {
      "stats_id": 50001,
      "server": {
        "id": 101,
        "host_name": "us-nyc-01.orbvpn.com",
        "public_ip": "203.0.113.10",
        "type": "premium",
        "city": "New York",
        "country": "US",
        "continent": "NA",
        "crypto_friendly": true,
        "bridge_capable": false,
        "bridge_country": null,
        "bridge_priority": 0,
        "description": "Premium US East Coast server",
        "hidden": false
      },
      "protocol": "wireguard",
      "connected_at": "2026-02-08T09:00:00Z",
      "duration_secs": 5400,
      "data_transferred": 157286400,
      "tokens_earned": 12.5,
      "client_ip": "198.51.100.50"
    }
  }
}
200No active connection
{
  "success": true,
  "data": {
    "is_connected": false,
    "connection": null
  }
}
401Authentication required
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or expired access token"
  }
}

Response Fields

FieldTypeDescription
is_connectedbooleanWhether the user has an active VPN connection
connection.stats_idintegerUnique connection statistics identifier
connection.serverobjectFull server object (same as Server Details response)
connection.protocolstringActive VPN protocol (wireguard, vless, orbconnect)
connection.connected_atstringISO 8601 timestamp of when the connection was established
connection.duration_secsintegerConnection duration in seconds
connection.data_transferredintegerTotal bytes transferred during the session
connection.tokens_earnednumberORB tokens earned during this connection
connection.client_ipstringThe client's public IP address

Connection History

Retrieve a paginated list of past VPN connections for the authenticated user.

GET/api/v1/vpn/history

Get the user's VPN connection history

Authentication:Bearer Token
ParameterTypeRequiredDescription
pageintegerOptionalPage number for pagination (default: 1)
per_pageintegerOptionalResults per page (default: 25, max: 100)
curl -X GET "https://api.orbai.world/api/v1/vpn/history?page=1&per_page=25" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
200Connection history retrieved successfully
{
  "success": true,
  "data": {
    "connections": [
      {
        "id": 90001,
        "server_id": 101,
        "server_name": "us-nyc-01.orbvpn.com",
        "server_country": "US",
        "protocol": "wireguard",
        "connected_at": "2026-02-08T09:00:00Z",
        "disconnected_at": "2026-02-08T10:30:00Z",
        "duration_secs": 5400,
        "bytes_sent": 52428800,
        "bytes_received": 104857600,
        "client_ip": "198.51.100.50"
      },
      {
        "id": 90000,
        "server_id": 205,
        "server_name": "de-fra-01.orbvpn.com",
        "server_country": "DE",
        "protocol": "vless",
        "connected_at": "2026-02-07T14:00:00Z",
        "disconnected_at": "2026-02-07T18:45:00Z",
        "duration_secs": 17100,
        "bytes_sent": 209715200,
        "bytes_received": 524288000,
        "client_ip": "198.51.100.50"
      }
    ],
    "total": 142,
    "page": 1,
    "per_page": 25,
    "total_pages": 6
  }
}

History Response Fields

FieldTypeDescription
connections[].idintegerUnique connection record ID
connections[].server_idintegerServer ID used for the connection
connections[].server_namestringHostname of the connected server
connections[].server_countrystringCountry code of the connected server
connections[].protocolstringVPN protocol used
connections[].connected_atstringConnection start timestamp
connections[].disconnected_atstringConnection end timestamp
connections[].duration_secsintegerTotal connection duration in seconds
connections[].bytes_sentintegerTotal bytes uploaded
connections[].bytes_receivedintegerTotal bytes downloaded
connections[].client_ipstringClient IP address during the connection

Usage Statistics

Retrieve aggregate VPN usage statistics for the authenticated user.

GET/api/v1/vpn/usage

Get aggregate VPN usage statistics

Authentication:Bearer Token
curl -X GET https://api.orbai.world/api/v1/vpn/usage \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
200Usage statistics retrieved successfully
{
  "success": true,
  "data": {
    "total_data_transferred": 10737418240,
    "total_connection_time_secs": 864000,
    "total_sessions": 142,
    "average_session_time_secs": 6084,
    "total_tokens_earned": 350.75
  }
}

Usage Response Fields

FieldTypeDescription
total_data_transferredintegerTotal bytes transferred across all sessions
total_connection_time_secsintegerTotal time connected in seconds
total_sessionsintegerTotal number of VPN sessions
average_session_time_secsintegerAverage session duration in seconds
total_tokens_earnednumberTotal ORB tokens earned from VPN usage

Data Conversion

The total_data_transferred and bytes_sent/bytes_received values are in bytes. Divide by 1073741824 (1024^3) to convert to gigabytes, or by 1048576 (1024^2) for megabytes.

Token Earnings

ORB tokens are earned while connected to the VPN. The earning rate depends on your subscription plan and connection duration. Check the Tokens section for more details on the token economy.