The Users API provides direct CRUD access to user records, complementing the authentication endpoints atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/diarpicu2022-commits/backend-AgroPulse/llms.txt
Use this file to discover all available pages before exploring further.
/api/auth. Use these endpoints to manage user profiles, update passwords, change roles, and look up the greenhouses a user can access. Unlike the auth endpoints, these routes do not require the X-Admin-Email header — they operate on individual records by ID.
This is distinct from the admin-only user management at
/api/auth/users. The /api/users endpoints expose full CRUD without a separate admin gate, so they should be called from trusted backend contexts or protected at the network level.GET /api/users
Returns all registered users. Passwords are never included in responses. Response Returns a{"users": [...]} envelope with an array of sanitized user objects.
POST /api/users
Creates a new user record. This is the administrative variant of registration — it allows setting any role and bypasses the self-registration flow. Request bodyLogin username for the account.
Display name.
Email address.
Phone number.
URL to a profile picture.
Plain-text password. The server hashes it with BCrypt before storing. Omit to create an account without a password (e.g. Google-only accounts).
Initial role. One of
ADMIN, AGRONOMIST, OPERATOR, VIEWER, or USER. Unrecognized values default to OPERATOR.Whether the account is enabled. Defaults to
true.PUT /api/users/
Updates one or more fields on an existing user. Only fields present in the request body are changed. Path parametersThe user’s integer ID.
POST /api/users. All fields are optional.
If
password is provided and non-blank, it is re-hashed with BCrypt before saving. Passing an empty string or omitting the field leaves the existing password unchanged.404 Not Found if no user exists with that ID.
DELETE /api/users/
Permanently deletes a user account. Also removes the user from theuser_greenhouse junction table so greenhouse access lists stay consistent.
Path parameters
The user’s integer ID.
{"deleted": true} on success, or 404 Not Found if no user exists with that ID.
GET /api/users//greenhouses
Returns the list of greenhouse IDs the user has been granted access to. Path parametersThe user’s integer ID.
Array of greenhouse IDs the user can access.
404 Not Found if no user exists with that ID.