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

# Current User Profile

> Returns the complete user profile overview including user data, usage statistics (conversations, shares), and profile context (static, recent, frequent cues). Auto-creates user if not exists.

Returns the complete user profile overview for the authenticated user. Requires a valid Auth0
access token in the `Authorization` header.

## Response

The endpoint returns a comprehensive profile overview including:

| Field                 | Description                                                                  |
| --------------------- | ---------------------------------------------------------------------------- |
| `user`                | Full user object (id, email, name, avatar, preferences, etc.)                |
| `usage.conversations` | Conversation statistics (total, active, archived, deleted, lastActiveAt)     |
| `usage.shares`        | Share statistics (total, active, expired, revoked, totalViews, lastSharedAt) |
| `profileContext`      | Cached context cues (static, recent, frequent) used by AI orchestration      |

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "user": {
      "id": "683b7e9f465b1b4e6753627a4f",
      "email": "investor@example.com",
      "fullName": "Puneet",
      "avatarUrl": "https://cdn.auth0.com/...",
      "emailVerified": true,
      "preferences": {
        "language": "en",
        "theme": "dark"
      },
      "createdAt": "2025-12-01T07:00:00.000Z",
      "updatedAt": "2025-12-04T10:00:00.000Z"
    },
    "usage": {
      "conversations": {
        "total": 42,
        "active": 38,
        "archived": 3,
        "deleted": 1,
        "lastActiveAt": "2025-12-04T09:30:00.000Z"
      },
      "shares": {
        "total": 5,
        "active": 4,
        "expired": 0,
        "revoked": 1,
        "totalViews": 127,
        "lastSharedAt": "2025-12-03T15:00:00.000Z"
      }
    },
    "profileContext": {
      "static": ["Financial goals: Retirement planning"],
      "recent": ["Discussed SIP investments"],
      "frequent": ["Portfolio review", "Tax planning"]
    }
  }
}
```

## Auto-sync Behavior

If the user does not exist locally or is missing critical data (name/email), the controller:

1. Fetches user info from Auth0's `/userinfo` endpoint
2. Creates or updates the local MongoDB record
3. Returns the complete profile overview

This ensures users are always synced on their first authenticated API call.


## OpenAPI

````yaml GET /api/v1/auth/me
openapi: 3.1.0
info:
  title: Handa Uncle API
  version: 1.0.0
  description: Public specification for the Handa Uncle web and mobile APIs.
  contact:
    name: Handa Uncle Engineering
    email: hello@handauncle.com
servers:
  - url: https://handauncle-backend-prod-205012263523.asia-south1.run.app
    description: Prod API base (Cloud Run)
  - url: https://api.handauncle.com
    description: Production
  - url: https://staging-api.handauncle.com
    description: Staging
  - url: http://localhost:8080
    description: Local development
security: []
tags:
  - name: Mobile App
    description: Endpoints used by the native Handa Uncle app.
  - name: Platform
    description: Cross-service operational endpoints.
  - name: Auth
    description: Authentication endpoints handled by the backend adapter.
  - name: AI
    description: LLM chat endpoints supporting streaming and device-auth guests.
  - name: OTP
    description: Phone OTP lifecycle powered by Exotel.
  - name: Webhooks
    description: Server-to-server hooks invoked by Auth0.
  - name: Conversations
    description: Authenticated user conversation management.
  - name: Chat Share
    description: Create, manage, and consume shared conversations.
  - name: Files
    description: Upload, list, and delete user files.
  - name: Prompt management
    description: Admin and public APIs for managing masked pre-prompts.
  - name: User Profile
    description: Profile card collection and user data for personalized AI responses.
  - name: Visual Embeds
    description: Manage visual embed images that attach to AI chat responses.
  - name: Second Opinion
    description: Admin and public APIs for Second Opinion suggestion cards.
  - name: Profile Cards
    description: >-
      APIs for managing profile card questions used in onboarding and
      personalization.
paths:
  /api/v1/auth/me:
    get:
      tags:
        - Auth
      summary: Get current user profile with full overview
      description: >-
        Returns the complete user profile overview including user data, usage
        statistics (conversations, shares), and profile context (static, recent,
        frequent cues). Auto-creates user if not exists.
      operationId: authMe
      responses:
        '200':
          description: Profile overview returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileOverviewResponseEnvelope'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
components:
  schemas:
    ProfileOverviewResponseEnvelope:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/ProfileOverviewData'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      required:
        - success
        - data
        - meta
    ProfileOverviewData:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/ProfileUser'
        usage:
          type: object
          properties:
            conversations:
              $ref: '#/components/schemas/ProfileUsageConversations'
            shares:
              $ref: '#/components/schemas/ProfileUsageShares'
          required:
            - conversations
            - shares
        profileContext:
          $ref: '#/components/schemas/ProfileContext'
      required:
        - user
        - usage
        - profileContext
    ResponseMeta:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        requestId:
          type: string
          description: Server generated correlation identifier.
      required:
        - timestamp
        - requestId
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ErrorObject'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      required:
        - success
        - error
        - meta
    ProfileUser:
      type: object
      properties:
        id:
          type: string
        fullName:
          type: string
        email:
          type: string
          format: email
          nullable: true
        phoneNumber:
          type: string
          nullable: true
        avatarUrl:
          type: string
          format: uri
          nullable: true
        accountStatus:
          type: string
          enum:
            - active
            - suspended
            - deleted
        authProvider:
          type: string
          nullable: true
        preferences:
          type: object
          properties:
            language:
              type: string
            theme:
              type: string
            notifications:
              type: boolean
        deviceId:
          type: string
          nullable: true
        platform:
          type: string
          enum:
            - android
            - ios
            - web
          nullable: true
        phoneVerified:
          type: boolean
          nullable: true
        emailVerified:
          type: boolean
          nullable: true
        createdAt:
          type: string
          format: date-time
        last_login_at:
          type: string
          format: date-time
          nullable: true
      required:
        - id
        - fullName
        - accountStatus
        - createdAt
    ProfileUsageConversations:
      type: object
      properties:
        total:
          type: integer
        active:
          type: integer
        archived:
          type: integer
        deleted:
          type: integer
        lastActiveAt:
          type: string
          format: date-time
          nullable: true
      required:
        - total
        - active
        - archived
        - deleted
    ProfileUsageShares:
      type: object
      properties:
        total:
          type: integer
        active:
          type: integer
        expired:
          type: integer
        revoked:
          type: integer
        totalViews:
          type: integer
        lastSharedAt:
          type: string
          format: date-time
          nullable: true
      required:
        - total
        - active
        - expired
        - revoked
        - totalViews
    ProfileContext:
      type: object
      properties:
        static:
          type: array
          items:
            type: string
        recent:
          type: array
          items:
            type: string
        frequent:
          type: array
          items:
            type: string
      required:
        - static
        - recent
        - frequent
    ErrorObject:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message describing the issue.
          example: Please enter a valid 10-digit phone number (e.g., 9876543210)
        code:
          type: string
          description: Error code for programmatic handling.
          example: VALIDATION_ERROR
        details:
          type: array
          description: >-
            Array of field-specific validation errors (for VALIDATION_ERROR
            responses).
          items:
            type: object
            properties:
              field:
                type: string
                description: Field name that failed validation.
                example: phone
              message:
                type: string
                description: Specific validation error message for this field.
                example: Please enter a valid 10-digit phone number (e.g., 9876543210)
            required:
              - field
              - message
      required:
        - message
  responses:
    UnauthorizedError:
      description: Authentication failed or is missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Auth0 access token for registered users.

````