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

# Get User Data

> Retrieve authenticated user's profile information and enrolled courses list

## Authentication

This endpoint requires authentication via Clerk. The `userId` is automatically extracted from the authentication token.

## Response

<ResponseField name="success" type="boolean" required>
  Indicates whether the request was successful
</ResponseField>

<ResponseField name="user" type="object">
  User profile data

  <Expandable title="user properties">
    <ResponseField name="_id" type="string">
      User's unique identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      User's full name
    </ResponseField>

    <ResponseField name="email" type="string">
      User's email address
    </ResponseField>

    <ResponseField name="imageUrl" type="string">
      URL to user's profile image
    </ResponseField>

    <ResponseField name="enrolledCourses" type="array">
      Array of course IDs the user is enrolled in
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="message" type="string">
  Error message if success is false
</ResponseField>

## Response Examples

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "user": {
      "_id": "user_2abc123def456",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "imageUrl": "https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy...",
      "enrolledCourses": [
        "60d5ec49f1b2c72b8c8e4f1a",
        "60d5ec49f1b2c72b8c8e4f1b"
      ]
    }
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json User Not Found theme={null}
  {
    "success": false,
    "message": "User Not Found"
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json Error Response theme={null}
  {
    "success": false,
    "message": "An unexpected error occurred"
  }
  ```
</ResponseExample>

## Error Codes

| Status Code | Description                                            |
| ----------- | ------------------------------------------------------ |
| 200         | Success or user not found (check `success` field)      |
| 401         | Unauthorized - Invalid or missing authentication token |
| 500         | Internal server error                                  |
