> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onefirewall.com/llms.txt
> Use this file to discover all available pages before exploring further.

# VPN User Stats

> Returns real-time VPN connection statistics for the authenticated user in a specific organization, including connection status, IP addresses and traffic data.



## OpenAPI

````yaml GET /auth/vpn-user-stats
openapi: 3.0.0
info:
  title: ClosedVPN API
  version: 1.1.0
  description: >
    API for managing authentication, organizations, members, VPN configurations,

    certificates and usage reporting for the ClosedVPN platform.


    The VPN capability previously delivered through the OneFirewall Application

    (`https://app.onefirewall.com/api/v1/vpn`) now runs on ClosedVPN and is
    served

    from `https://closedvpn.io`. The legacy OneFirewall VPN endpoints are
    deprecated

    and replaced by the operations documented here.


    Most endpoints require a Personal Access Token (PAT), sent as

    `Authorization: Bearer <pat>`. To obtain one, sign in through the magic link

    flow (`/auth/send-magic-link` then `/auth/verify-magic-link`, neither of
    which

    requires prior authentication) and then call `/auth/generate-pat`, or create
    the

    token from the Profile page in the web application. The plaintext token is
    shown

    only once and is stored as a bcrypt hash, so it cannot be recovered later.
  contact:
    name: OneFirewall Alliance
    url: https://closedvpn.io
    email: support@onefirewall.com
servers:
  - url: https://closedvpn.io
    description: Production server
security: []
tags:
  - name: Authentication
    description: Magic link sign-in, session validation and sign-out.
  - name: Profile
    description: Read and update the authenticated user's profile.
  - name: Personal Access Tokens
    description: Create, list and revoke Personal Access Tokens used for API access.
  - name: Organizations
    description: Create, update, list, select and delete organizations.
  - name: Members
    description: Add members to an organization, change their role and remove them.
  - name: VPN Certificates
    description: Issue and download the OpenVPN client profile for a member.
  - name: VPN Configurations
    description: Manage VPN server configurations and run their predefined commands.
  - name: VPN Exit Nodes
    description: List the VPN exit nodes available to the caller.
  - name: Statistics
    description: Connection status, traffic reporting and threat prevention metrics.
  - name: Notifications
    description: Read in-app notifications and mark them as read.
  - name: Activity Logs
    description: Retrieve the caller's recent activity.
paths:
  /auth/vpn-user-stats:
    get:
      tags:
        - Statistics
      summary: Get VPN connection stats for current user
      description: >-
        Returns real-time VPN connection statistics for the authenticated user
        in a specific organization, including connection status, IP addresses
        and traffic data.
      operationId: getVPNUserStats
      parameters:
        - name: org_id
          in: query
          required: true
          schema:
            type: string
            example: 60c72b2f5f1b2c001c8e4b1a
      responses:
        '200':
          description: >
            The caller's connection state. When the user is not connected, or
            the VPN host cannot be reached, the body is `{"connected": false}`
            and no other field is present. Every field except `connected` is
            returned only when `connected` is true.
          content:
            application/json:
              schema:
                type: object
                required:
                  - connected
                properties:
                  connected:
                    type: boolean
                    example: true
                  privateIP:
                    type: string
                    description: Address assigned to the client inside the tunnel
                    example: 10.8.0.6
                  publicIP:
                    type: string
                    description: Public address of the VPN host
                    example: 203.0.113.1
                  bytesReceived:
                    type: integer
                    format: int64
                    example: 1048576
                  bytesSent:
                    type: integer
                    format: int64
                    example: 524288
                  connectedTime:
                    type: string
                    description: Session duration formatted as HH:MM:SS
                    example: '02:15:00'
        '400':
          description: Missing organization ID or no VPN assigned
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Organization ID is required
        '401':
          description: Unauthorized (invalid or missing PAT)
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Unauthorized
        '403':
          description: Forbidden (no access to this organization)
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: You do not have permission to access this organization
        '404':
          description: Organization, user or VPN config not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Organization not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Server error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: PAT
      description: >
        Personal Access Token (PAT) passed in the Authorization header (e.g.,
        `Bearer <pat>`) for authenticated API requests. PATs are generated via
        `/auth/generate-pat` after authenticating through the magic link flow.

````