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

# Get User Profile

> Endpoint to get the profile of the logged in user

Endpoint to get the profile of the logged in user.

## Request

### Headers

| Name          | Type   | Required | Description  |
| ------------- | ------ | -------- | ------------ |
| Authorization | string | Yes      | Bearer token |

## Response

### 200 OK - Successfully retrieved profile

```json theme={null}
{
  "message": "Profile retrieved successfully",
  "data": {
    "_id": "64b7f1a2e4b0a5d3f9c12345",
    "emails": "user@example.com",
    "role": "user",
    "rcExtension": "1234",
    "phone": "+1-555-555-5555",
    "department": {
      "_id": "64b7f2b3e4b0a5d3f9c54321",
      "name": "Customer Support"
    },
    "permissions": ["compass.dashboard.*", "compass.dashboard.overview"]
  }
}
```

### 400 Bad Request

```json theme={null}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request"
  }
}
```

### 401 Unauthorized

```json theme={null}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing or invalid authentication token"
  }
}
```

### 404 Not Found

```json theme={null}
{
  "error": {
    "code": "USER_NOT_FOUND",
    "message": "User not found"
  }
}
```

### 500 Internal Server Error

```json theme={null}
{
  "error": {
    "code": "SERVER_ERROR",
    "message": "Internal server error"
  }
}
```

## Example

```bash theme={null}
curl -X GET 'http://localhost:2000/profile' \
  -H 'Authorization: Bearer your-jwt-token'
```

## Notes

* This endpoint returns the complete profile information for the authenticated user
* Includes user details, department information, and assigned permissions
* Use this to populate user profile pages or verify user session
* The response contains sensitive information and should be handled securely


## OpenAPI

````yaml GET /profile
openapi: 3.0.3
info:
  title: COMPASS API
  version: 1.0.0
  description: OpenAPI specification for the Compass backend routes.
servers:
  - url: http://localhost:2000
    description: Local development server
security: []
tags:
  - name: Auth
    description: >-
      Authentication and session management endpoints (OAuth and session
      validation)
  - name: Users
    description: Operations for managing user records
  - name: Departments
    description: Operations for managing departments
  - name: Email Meter
    description: APIs to get Email Meter Stats
  - name: HubSpot Tickets
    description: Feedback APIs
  - name: Permissions
    description: Permissions APIs
  - name: Transcription
    description: Transcription APIs
paths:
  /profile:
    get:
      tags:
        - Users
      summary: Get user profile
      description: Endpoint to get the profile of the logged in user
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
        '400':
          description: Validation error / bad request
        '401':
          description: Unauthorized (missing/invalid token or insufficient permissions)
        '404':
          description: User not found
        '500':
          description: Server error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````