Skip to main content

Endpoint

GET /api/users/profile

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header:
Authorization: Bearer <token>

Response

Success response

Returns the user’s profile data, including store information if the user is a store employee.
success
boolean
required
Indicates if the request was successful
data
object
required
User profile data
id
string
required
User’s unique identifier
name
string
required
User’s full name
email
string
required
User’s email address
role
string
required
User’s role. One of: student, faculty, or store_employee
register_number
string
Student or faculty registration number (null if not applicable)
employee_id
string
Employee ID for store employees (null if not applicable)
phone_number
string
User’s phone number (null if not provided)
is_email_verified
boolean
required
Whether the user’s email has been verified
no_show_count
number
required
Number of times the user failed to pick up orders
trust_tier
string
required
User’s trust level based on order history. One of: good, watch, or restricted
ordering_restricted_until
string
ISO 8601 date when ordering restrictions will be lifted (null if not restricted)
last_no_show_at
string
ISO 8601 date of the last no-show incident (null if none)
created_at
string
required
ISO 8601 date when the account was created
updated_at
string
required
ISO 8601 date when the profile was last updated
store
object
Store information (only present if user role is store_employee and owns a store)

Error responses

success
boolean
required
Always false for errors
message
string
required
Error description

Examples

curl -X GET https://api.campusbite.com/api/users/profile \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Success response example

{
  "success": true,
  "data": {
    "id": "507f1f77bcf86cd799439011",
    "name": "John Doe",
    "email": "[email protected]",
    "role": "student",
    "register_number": "2021CS001",
    "employee_id": null,
    "phone_number": "+1234567890",
    "is_email_verified": true,
    "no_show_count": 0,
    "trust_tier": "good",
    "ordering_restricted_until": null,
    "last_no_show_at": null,
    "created_at": "2024-01-15T10:30:00.000Z",
    "updated_at": "2024-01-15T10:30:00.000Z",
    "store": null
  }
}

Error response example

{
  "success": false,
  "message": "User not found."
}
Sensitive fields like password, email_verification_token, and password_reset_token are automatically removed from the response.

Build docs developers (and LLMs) love