Get User Information
GET /api/user
Retrieve information about the currently authenticated user account. This endpoint returns basic account details including the user ID, email address, and role.
Path Parameters
None.
Query Parameters
None.
Headers
| Key | Value |
|---|---|
x-api-key | Your API Key |
Response
Status Code: 200 OK
Response Fields
| Field | Type | Description |
|---|---|---|
_id | string | Unique user identifier (MongoDB ObjectId) |
email | string | User's email address |
role | string | User role (typically "USER" for standard accounts) |
Example Response
json
{
"_id": "6603fcf18adc9203718db05b",
"email": "[email protected]",
"role": "USER"
}Error Responses
401 Unauthorized
Returned when the API key is missing or invalid.
json
{
"message": "Unauthorized"
}Examples
python
import requests
response = requests.get('https://panel.cheapcarfax.net/api/user', headers={'x-api-key': 'YOUR_API_KEY'})
print(response.json())bash
curl -X GET 'https://panel.cheapcarfax.net/api/user' \
-H 'x-api-key: YOUR_API_KEY'