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

# Get current session

> Returns the currently authenticated user's basic info from the access token.
Project admin tokens return a projectAdmin session object instead of an auth.users row.

This endpoint does not refresh expired access tokens by itself.
For browser apps using the TypeScript SDK, call `auth.getCurrentUser()`
during startup. The SDK will use the httpOnly refresh cookie automatically
when it can refresh the session. Server, mobile, and other non-browser
clients should call `/api/auth/refresh` explicitly.




## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/auth.yaml get /api/auth/sessions/current
openapi: 3.0.3
info:
  title: Insforge Authentication API
  version: 2.0.0
  description: Authentication endpoints with separated auth and profile tables
servers: []
security: []
paths:
  /api/auth/sessions/current:
    get:
      tags:
        - Client
      summary: Get current session
      description: >
        Returns the currently authenticated user's basic info from the access
        token.

        Project admin tokens return a projectAdmin session object instead of an
        auth.users row.


        This endpoint does not refresh expired access tokens by itself.

        For browser apps using the TypeScript SDK, call `auth.getCurrentUser()`

        during startup. The SDK will use the httpOnly refresh cookie
        automatically

        when it can refresh the session. Server, mobile, and other non-browser

        clients should call `/api/auth/refresh` explicitly.
      responses:
        '200':
          description: Current session info
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    required:
                      - user
                    additionalProperties: false
                    properties:
                      user:
                        $ref: '#/components/schemas/UserResponse'
                  - type: object
                    required:
                      - projectAdmin
                    additionalProperties: false
                    properties:
                      projectAdmin:
                        $ref: '#/components/schemas/ProjectAdminResponse'
        '401':
          description: Unauthorized
      security:
        - bearerAuth: []
components:
  schemas:
    UserResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        email:
          type: string
          format: email
        profile:
          type: object
          nullable: true
          additionalProperties: true
          description: User profile data (name, avatar_url, and custom fields)
          properties:
            name:
              type: string
            avatar_url:
              type: string
              format: uri
        metadata:
          type: object
          nullable: true
          additionalProperties: true
          description: System metadata (device ID, login IP, etc.)
        emailVerified:
          type: boolean
        providers:
          type: array
          items:
            type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ProjectAdminResponse:
      type: object
      required:
        - subject
        - username
      properties:
        subject:
          type: string
          example: local:admin
        username:
          type: string
          example: admin
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````