> ## 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.

# Verify Magic Link

> Validates the magic link token from the email. Upon success, sets an authentication cookie and returns user info, allowing PAT generation via `/auth/generate-pat`. This endpoint does not require PAT authentication; it uses the token query parameter for verification.



## OpenAPI

````yaml GET /auth/verify-magic-link
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/verify-magic-link:
    get:
      tags:
        - Authentication
      summary: Verify a magic link token
      description: >-
        Validates the magic link token from the email. Upon success, sets an
        authentication cookie and returns user info, allowing PAT generation via
        `/auth/generate-pat`. This endpoint does not require PAT authentication;
        it uses the token query parameter for verification.
      operationId: verifyMagicLink
      parameters:
        - name: token
          in: query
          required: true
          schema:
            type: string
            description: Magic link token from the email
            example: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
      responses:
        '200':
          description: Token validated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Token validated successfully
                  userId:
                    type: string
                    example: 60c72b2f5f1b2c001c8e4b1b
                  email:
                    type: string
                    format: email
                    example: john@example.com
                  name:
                    type: string
                    example: John Doe
                  givenName:
                    type: string
                    example: John
                  surname:
                    type: string
                    example: Doe
                  avatar:
                    type: string
                    example: JD
                  phoneNumber:
                    type: string
                    example: '+441234567890'
                  companyName:
                    type: string
                    example: Acme Ltd
                  receiveNotifications:
                    type: boolean
                    example: true
                  receivePromotional:
                    type: boolean
                    example: false
        '400':
          description: Missing token
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Invalid request
        '401':
          description: >
            Invalid, expired, or already used token. This status also covers
            unexpected failures during verification, in which case `error`
            carries the detail. The endpoint does not return 500.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Token expired
                  error:
                    type: string
                    example: Detailed error message
                    nullable: true
      security: []

````