Skip to main content
GET
/
api
/
v1
/
users
/
findById
/
{id}
Get User by ID
curl --request GET \
  --url https://api.example.com/api/v1/users/findById/{id}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "userName": "jsmith",
  "name": "John Smith",
  "birthDate": "1990-05-15",
  "bookIds": [
    "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "9f3e4a56-2c1d-4b8e-8f6d-5a3c2b1d4e5f",
    "3d8f5b2a-1e4c-6d7f-9a0b-8c7e6d5f4a3b"
  ]
}
This endpoint returns detailed information about a single user, including their associated book collection.

Authentication

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

Path Parameters

id
string
required
The unique identifier (UUID) of the user to retrieve

Response

id
string
Unique identifier of the user (UUID format)
userName
string
Username for the user’s account
name
string
Full name of the user
birthDate
string
Date of birth in ISO 8601 format (YYYY-MM-DD)
bookIds
array
Array of book UUIDs associated with this user

Example Request

cURL
curl -X GET "https://api.library.com/api/v1/users/findById/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Example Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "userName": "jsmith",
  "name": "John Smith",
  "birthDate": "1990-05-15",
  "bookIds": [
    "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "9f3e4a56-2c1d-4b8e-8f6d-5a3c2b1d4e5f",
    "3d8f5b2a-1e4c-6d7f-9a0b-8c7e6d5f4a3b"
  ]
}

Status Codes

CodeDescription
200Successfully retrieved user
400Bad request - Invalid UUID format
401Unauthorized - Invalid or missing JWT token
404User not found
500Internal server error

Build docs developers (and LLMs) love