The user management endpoints allow privileged operations on user accounts: listing all users, changing a user’s role, updating greenhouse access, and upserting Google-authenticated users. Most of these operations are restricted to administrators and require theDocumentation 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.
X-Admin-Email request header.
GET /api/auth/users
Returns a list of all registered users. Requires admin access.Request headers
Must match the value of the
AGROPULSE_ADMIN_EMAIL environment variable on the server.Response
Array of user objects.
Example
PUT /api/auth/users//role
Changes the role of an existing user. Requires admin access.Path parameters
The integer ID of the user to update.
Request headers
Must match the value of the
AGROPULSE_ADMIN_EMAIL environment variable on the server.Request body
Target role. Valid values are
ADMIN, AGRONOMIST, OPERATOR, VIEWER, and USER. Unrecognized values are mapped to OPERATOR.Response
Returns the updated user object (same shape as the user objects inGET /api/auth/users).
Passing an unrecognized role string does not produce an error — it silently maps to
OPERATOR.Error responses
| Status | Cause |
|---|---|
403 | Missing or non-matching X-Admin-Email header. |
404 | No user found with the specified id. |
Example
PUT /api/auth/users//greenhouses
Replaces the greenhouse access list for a user. Requires admin access.Path parameters
The integer ID of the user to update.
Request headers
Must match the value of the
AGROPULSE_ADMIN_EMAIL environment variable on the server.Request body
Array of greenhouse integer IDs to assign to the user. Pass an empty array (
[]) to revoke all access. Any non-array value clears the list.Response
The updated list of greenhouse IDs now stored on the user.
Error responses
| Status | Cause |
|---|---|
403 | Missing or non-matching X-Admin-Email header. |
404 | No user found with the specified id. |
Example
POST /api/auth/sync-google-user
Upserts a Google-authenticated user. If a user with the given email already exists, the existing record is returned unchanged. Otherwise a new account is created with the provided details.Request body
The Google account email address. Used as the unique lookup key.
Desired username for the new account. Defaults to
email if omitted.Display name. Defaults to
email if omitted.URL of the Google profile picture.
Initial role for a newly created account. Defaults to
OPERATOR if omitted or unrecognized.Response
Returns the user object for the existing or newly created account (same shape as the user objects inGET /api/auth/users).
Error responses
| Status | error value | Cause |
|---|---|---|
400 | email requerido | The email field is missing from the request body. |