Skip to main content
GET
/
api
/
users
/
{id}
Get User
curl --request GET \
  --url https://api.example.com/api/users/{id}
{
  "404": {},
  "id": 123,
  "username": "<string>",
  "email": "<string>",
  "password_hash": "<string>",
  "firstname": "<string>",
  "lastname": "<string>",
  "phone_number": "<string>",
  "role": "<string>",
  "is_active": true,
  "profileImage": "<string>",
  "created_at": {},
  "updated_at": {}
}

Overview

This endpoint retrieves detailed information about a specific user by their unique identifier.

Request

id
long
required
The unique identifier of the user to retrieve
curl -X GET 'http://localhost:8080/api/users/1' \
  -H 'Content-Type: application/json'

Response

id
long
Unique identifier for the user
username
string
User’s username
email
string
User’s email address
password_hash
string
Encrypted password hash
firstname
string
User’s first name
lastname
string
User’s last name
phone_number
string
User’s phone number
role
string
User’s role in the system (e.g., ADMIN, USER, DRIVER)
is_active
boolean
Whether the user account is active
profileImage
string
URL or path to the user’s profile image
created_at
timestamp
Timestamp when the user was created
updated_at
timestamp
Timestamp when the user was last updated

Example Response

{
  "id": 1,
  "username": "johndoe",
  "email": "[email protected]",
  "password_hash": "$2a$10$...",
  "firstname": "John",
  "lastname": "Doe",
  "phone_number": "+1234567890",
  "role": "USER",
  "is_active": true,
  "profileImage": "/images/profiles/johndoe.jpg",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-20T14:45:00Z"
}

Error Responses

404
error
User not found - returned when no user exists with the specified ID

Build docs developers (and LLMs) love