Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/aliammari1/readrealm/llms.txt

Use this file to discover all available pages before exploring further.

The Users API manages reader accounts. It handles registration, profile retrieval, and account updates. User IDs returned from these endpoints are referenced throughout the Books and Chat APIs for bookmarks, reviews, and messages.

Endpoint summary

MethodPathDescription
POST/userCreate a new user account
GET/userList all users
GET/user/:emailFind a user by email address
GET/user/userId/:idFind a user by ID
GET/user/profile/:idGet a user’s profile
PUT/user/:idUpdate a user account
DELETE/user/:idDelete a user account

POST /user

Registers a new user account.
Passwords are stored as provided. Implement hashing at the application layer before sending to this endpoint.

Request body

username
string
required
Display name for the user.
email
string
required
Email address. Must be a valid email format.
password
string
required
Account password. Maximum 100 characters.
profilePicture
string
URL or base64-encoded image for the user’s avatar. Optional.
curl -X POST http://localhost:3000/user \
  -H 'Content-Type: application/json' \
  -d '{
    "username": "alice",
    "email": "alice@example.com",
    "password": "s3cure-passw0rd"
  }'

Response

_id
string
MongoDB document ID assigned to the new user.
username
string
Display name.
email
string
Email address.
profilePicture
string
Profile picture URL, if provided.
role
string
User role. Defaults to "user".
emailVerifiedAt
string
Timestamp of email verification. null until verified.

GET /user

Returns all registered users.
curl http://localhost:3000/user

Response

Array of user objects. Each object contains the fields described in the POST /user response section.

GET /user/:email

Looks up a single user by their email address.
The :email segment must be URL-encoded (e.g. alice%40example.com).

Path parameters

email
string
required
URL-encoded email address of the user.
curl 'http://localhost:3000/user/alice%40example.com'

Response

A single user object, or 404 if no user with that email exists.

GET /user/userId/:id

Looks up a single user by their MongoDB document ID.

Path parameters

id
string
required
MongoDB _id string of the user.
curl http://localhost:3000/user/userId/64a1f3c2e4b0a1234567890a

Response

A single user object, or 404 if no user with that ID exists.

GET /user/profile/:id

Retrieves the public profile for a user by ID. Internally equivalent to GET /user/userId/:id — both resolve using findById.

Path parameters

id
string
required
MongoDB _id string of the user.
curl http://localhost:3000/user/profile/64a1f3c2e4b0a1234567890a

Response

A single user object.

PUT /user/:id

Replaces user fields with the provided values. Unspecified fields retain their current values (partial update via PartialType).

Path parameters

id
string
required
MongoDB _id string of the user to update.

Request body

All fields are optional:
username
string
New display name.
email
string
New email address. Must be a valid email format.
password
string
New password. Maximum 100 characters.
profilePicture
string
New profile picture URL or base64 image.
curl -X PUT http://localhost:3000/user/64a1f3c2e4b0a1234567890a \
  -H 'Content-Type: application/json' \
  -d '{"username": "alice_reads"}'

Response

The updated user object.

DELETE /user/:id

Permanently deletes a user account.
This operation is irreversible. Bookmarks and reviews authored by this user are not automatically removed.

Path parameters

id
string
required
MongoDB _id string of the user to delete.
curl -X DELETE http://localhost:3000/user/64a1f3c2e4b0a1234567890a

Response

The deleted user document.

User object reference

FieldTypeRequiredDescription
usernamestringYesDisplay name
emailstringYesEmail address
passwordstringYesHashed password (max 100 chars)
profilePicturestringNoAvatar URL or base64 image (max 1000 chars)
rolestringYesAccount role; defaults to "user"
emailVerifiedAtDateNoTimestamp of email verification