> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/No-Country-simulation/S02-26-Equipo-33-Web-App/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Current User

> Retrieve the authenticated user profile

## Endpoint

```
GET /api/auth/me
```

## Authentication

**Required.** Include a valid JWT token in the Authorization header.

```
Authorization: Bearer <token>
```

## Request

No request parameters required. The user is identified from the JWT token.

## Response

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

<ResponseField name="user" type="object">
  Complete user profile information (password hash is excluded).

  <ResponseField name="_id" type="string">
    User's unique identifier.
  </ResponseField>

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

  <ResponseField name="role" type="string">
    User's role ("seller" or "admin").
  </ResponseField>

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

  <ResponseField name="phone" type="string">
    User's phone number in international format.
  </ResponseField>

  <ResponseField name="is_email_verified" type="boolean">
    Whether the user's email has been verified.
  </ResponseField>

  <ResponseField name="is_phone_verified" type="boolean">
    Whether the user's phone number has been verified.
  </ResponseField>

  <ResponseField name="profile_picture_url" type="string">
    URL to the user's profile picture.
  </ResponseField>

  <ResponseField name="seller_profile" type="object">
    Seller-specific profile information. Null for admin users.

    <ResponseField name="identity_document" type="string">
      URL or identifier for the seller's identity document.
    </ResponseField>

    <ResponseField name="selfie_url" type="string">
      URL to the seller's selfie image.
    </ResponseField>

    <ResponseField name="verification_status" type="string">
      Verification status: "pending", "verified", or "rejected".
    </ResponseField>

    <ResponseField name="verification_method" type="string">
      Method used for verification: "manual" or "automatic".
    </ResponseField>

    <ResponseField name="verified_at" type="string">
      ISO 8601 timestamp of when verification was completed.
    </ResponseField>

    <ResponseField name="verified_by" type="string">
      User ID of the admin who verified this seller (for manual verification).
    </ResponseField>

    <ResponseField name="rejection_reason" type="string">
      Reason for rejection if verification\_status is "rejected".
    </ResponseField>

    <ResponseField name="is_verified_badge" type="boolean">
      Whether the seller has a verified badge displayed.
    </ResponseField>
  </ResponseField>

  <ResponseField name="is_active" type="boolean">
    Whether the user account is active.
  </ResponseField>

  <ResponseField name="last_login" type="string">
    ISO 8601 timestamp of the user's last login.
  </ResponseField>

  <ResponseField name="created_at" type="string">
    ISO 8601 timestamp of when the account was created.
  </ResponseField>

  <ResponseField name="updated_at" type="string">
    ISO 8601 timestamp of when the account was last updated.
  </ResponseField>
</ResponseField>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.horsetrust.com/api/auth/me \
    -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  ```

  ```javascript JavaScript/TypeScript theme={null}
  const token = localStorage.getItem('authToken');

  const response = await fetch('https://api.horsetrust.com/api/auth/me', {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${token}`
    }
  });

  const data = await response.json();

  if (data.success) {
    console.log('Current user:', data.user);
  }
  ```
</CodeGroup>

## Example Response

```json 200 Success theme={null}
{
  "success": true,
  "user": {
    "_id": "507f1f77bcf86cd799439011",
    "email": "seller@example.com",
    "role": "seller",
    "full_name": "John Smith",
    "phone": "+5491112345678",
    "is_email_verified": false,
    "is_phone_verified": false,
    "profile_picture_url": null,
    "seller_profile": {
      "identity_document": "https://storage.example.com/docs/id-123.pdf",
      "selfie_url": "https://storage.example.com/selfies/selfie-123.jpg",
      "verification_status": "pending",
      "is_verified_badge": false
    },
    "is_active": true,
    "last_login": "2026-03-05T10:30:00.000Z",
    "created_at": "2026-03-01T08:00:00.000Z",
    "updated_at": "2026-03-05T10:30:00.000Z"
  }
}
```

## Error Responses

<ResponseField name="401" type="error">
  **Unauthorized** - Missing or invalid authentication token.

  ```json theme={null}
  {
    "success": false,
    "message": "Authentication required"
  }
  ```
</ResponseField>

<ResponseField name="404" type="error">
  **Not Found** - User not found (may have been deleted).

  ```json theme={null}
  {
    "success": false,
    "message": "User not found"
  }
  ```
</ResponseField>

<ResponseField name="500" type="error">
  **Server Error** - Internal server error.

  ```json theme={null}
  {
    "success": false,
    "message": "Server error"
  }
  ```
</ResponseField>

## Notes

* This endpoint requires a valid JWT token obtained from login or registration
* The password hash is never included in the response for security
* Use this endpoint to check if the current token is still valid
* The response includes complete profile information including verification status
* This is useful for maintaining user state in client applications
