Skip to main content
GET
/
api
/
v1
/
users
/
logged
Get Logged In User
curl --request GET \
  --url https://api.example.com/api/v1/users/logged
{
  "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"
  ]
}
This endpoint returns information about the user associated with the provided JWT token, including their book collection.

Authentication

This endpoint requires JWT authentication. Include a valid JWT token in the Authorization header. The user information is extracted from the token.
Authorization: Bearer <your_jwt_token>

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/logged" \
  -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"
  ]
}

Status Codes

CodeDescription
200Successfully retrieved logged in user
401Unauthorized - Invalid or missing JWT token
404User not found
500Internal server error

Notes

  • This endpoint is useful for retrieving the current user’s profile information after authentication
  • The user ID is automatically extracted from the JWT token’s claims
  • No user ID parameter is needed in the request

Build docs developers (and LLMs) love