The AgroPulse frontend communicates exclusively with the REST backend configured viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/diarpicu2022-commits/frontend-AgroPulse/llms.txt
Use this file to discover all available pages before exploring further.
VITE_API_URL (default http://localhost:8080). Every request is made through BaseRepository in src/core/ApiService.ts, which automatically injects authentication headers and handles JSON serialisation. This page lists every endpoint used by the frontend, grouped by resource.
Authentication
All requests include the following headers when a user context is set viasetUserContext():
| Header | Type | Description |
|---|---|---|
X-User-Id | string | ID of the currently authenticated user. Present on all requests after login. |
X-Admin-Email | string | Email of the user, included only when the user holds an admin role. Required by admin-only endpoints. |
Headers are injected automatically by
ApiService.ts. You do not set them manually in application code unless you need a one-off override via options.headers.Base URL
VITE_API_URL in your environment. See Environment variables.
Endpoints by resource
Greenhouses
Greenhouses
GET /api/greenhousesReturns all greenhouses the authenticated user has access to.List of greenhouse objects.
GET /api/greenhouses/:idReturns a single greenhouse by ID.Greenhouse ID.
The greenhouse object.
POST /api/greenhousesCreates a new greenhouse.Display name.
Human-readable location.
Optional description.
ESP32 device identifier to link.
GPS latitude.
GPS longitude.
Supabase photo URL.
The created greenhouse.
PUT /api/greenhouses/:idUpdates an existing greenhouse (full or partial fields).Greenhouse ID.
GreenhouseDto fields.The updated greenhouse.
DELETE /api/greenhouses/:idDeletes a greenhouse.Greenhouse ID.
204 No Content.Greenhouse users
Greenhouse users
GET /api/greenhouses/:id/usersLists users assigned to a greenhouse.Greenhouse ID.
List of user objects.
POST /api/greenhouses/:id/usersAssigns a user to a greenhouse.Greenhouse ID.
ID of the user to assign.
204 No Content.DELETE /api/greenhouses/:id/users/:userIdRemoves a user from a greenhouse.Greenhouse ID.
User ID to remove.
204 No Content.Alert recipients
Alert recipients
GET /api/greenhouses/:id/alert-recipientsLists alert recipients for a greenhouse.Greenhouse ID.
List of recipient objects.
POST /api/greenhouses/:id/alert-recipientsAdds an alert recipient to a greenhouse.Greenhouse ID.
Recipient display name.
Email address for notifications.
Phone number for SMS.
CallMeBot API key for WhatsApp/Telegram.
The created recipient.
DELETE /api/greenhouses/:id/alert-recipients/:recipientIdRemoves an alert recipient.Greenhouse ID.
Recipient ID to remove.
204 No Content.Sensors
Sensors
GET /api/sensorsReturns all sensors, optionally filtered by greenhouse.Filter sensors belonging to this greenhouse.
List of sensor objects.
GET /api/sensors/:idReturns a single sensor by ID.Sensor ID.
The sensor object.
POST /api/sensorsCreates a sensor.Sensor display name.
Measurement type.
Hardware protocol.
GPIO pin on the ESP32.
Parent greenhouse.
The created sensor.
PUT /api/sensors/:idUpdates a sensor.Sensor ID.
SensorDto fields.DELETE /api/sensors/:idDeletes a sensor.Sensor ID.
204 No Content.GET /api/sensors/:id/thresholdReturns the anomaly threshold configuration for a sensor.Sensor ID.
Threshold configuration object.
PUT /api/sensors/:id/thresholdCreates or updates the threshold for a sensor.Sensor ID.
Minimum acceptable value.
Maximum acceptable value.
No-data alert window in minutes.
Stuck-sensor alert window in minutes.
Spike detection threshold percentage.
Updated threshold object.
DELETE /api/sensors/:id/thresholdRemoves the threshold configuration for a sensor.Sensor ID.
204 No Content.Actuators
Actuators
GET /api/actuatorsReturns all actuators, optionally filtered by greenhouse.Filter actuators belonging to this greenhouse.
List of actuator objects.
GET /api/actuators/:idReturns a single actuator by ID.Actuator ID.
The actuator object.
POST /api/actuatorsCreates an actuator.Display name.
Actuator category.
GPIO pin on the ESP32.
Set to
true for active-low relays.Parent greenhouse.
The created actuator.
PUT /api/actuators/:idUpdates an actuator.Actuator ID.
ActuatorDto fields.DELETE /api/actuators/:idDeletes an actuator.Actuator ID.
204 No Content.Sensor readings
Sensor readings
GET /api/readingsReturns sensor readings. Exactly one of sensor or greenhouseId is typically supplied to scope the results.Return readings for this sensor ID only.
Return readings for all sensors in this greenhouse.
Maximum number of readings to return.
List of reading objects ordered by timestamp descending.
POST /api/readingsCreates a sensor reading (used by device proxies or manual entry).Sensor that produced the reading.
Measured value.
ISO 8601 timestamp. Defaults to server time if omitted.
The created reading.
Crops
Crops
GET /api/cropsReturns all crop profiles.List of crop objects.
GET /api/crops/:idReturns a single crop profile.Crop ID.
The crop object.
POST /api/cropsCreates a crop profile.Crop name.
Greenhouse to assign the crop to.
Minimum temperature (°C).
Maximum temperature (°C).
CropDto range fields.The created crop.
PUT /api/crops/:idUpdates a crop profile.Crop ID.
DELETE /api/crops/:idDeletes a crop profile.Crop ID.
204 No Content.Alerts
Alerts
GET /api/alertsReturns all alerts for the authenticated user’s accessible greenhouses.List of alert objects.
POST /api/alertsCreates an alert manually.Sensor type or custom category.
Severity:
INFO, WARNING, or CRITICAL.Alert message body.
Short title.
Associated greenhouse.
The created alert.
PUT /api/alerts/:id/readMarks an alert as read.Alert ID.
204 No Content.DELETE /api/alerts/:idDeletes an alert.Alert ID.
204 No Content.Automation rules
Automation rules
GET /api/rulesReturns all automation rules.List of rule objects.
POST /api/rulesCreates a rule.Rule name.
Sensor type to monitor.
Comparison operator.
Trigger value.
Actuator to control.
Action to perform.
The created rule.
PUT /api/rules/:idUpdates a rule.Rule ID.
DELETE /api/rules/:idDeletes a rule.Rule ID.
204 No Content.Audit logs
Audit logs
Reports
Reports
GET /api/reports/daily-csvReturns or initiates a daily CSV report download.GET /api/reports/weekly-statsReturns weekly aggregated statistics.POST /api/reports/send-emailSends a report via email.Report payload — recipient, date range, and format fields.
POST /api/reports/scheduleSchedules a recurring report.GET /api/reports/historyReturns report generation history.Maximum number of history entries.
Users and auth
Users and auth
POST /api/auth/loginAuthenticates a user with username/password or Google OAuth.- Username/password
- Google OAuth
The authenticated user object.
POST /api/auth/registerRegisters a new user account.Desired username.
Password.
Full display name.
Optional email address.
The created user object.
GET /api/auth/meReturns the profile of the currently authenticated user (uses X-User-Id header).Current user object.
GET /api/auth/users (admin only)Returns all user accounts. Requires X-Admin-Email header.List of all users.
PUT /api/auth/users/:userId/role (admin only)Changes a user’s role.Target user ID.
New role:
ADMIN or USER.204 No Content.GET /api/usersReturns all users (non-admin variant).List of user objects.
POST /api/usersCreates a user.PUT /api/users/:idUpdates a user.User ID.
DELETE /api/users/:idDeletes a user.User ID.
204 No Content.GET /api/users/:id/greenhousesReturns the greenhouse IDs a user has access to.User ID.
List of greenhouse IDs.
PUT /api/auth/users/:userId/greenhouses (admin only)Sets the greenhouse access list for a user.User ID.
Array of greenhouse IDs to assign.
Updated list of assigned greenhouse IDs.
Device
Device
POST /api/device/registerRegisters a new ESP32 device.Device registration payload (device ID, firmware version, etc.).
GET /api/device/config/:idReturns the full sensor and actuator configuration for a greenhouse’s device.Greenhouse ID.
ESP32 device identifier.
Sensors registered to this device.
Actuators registered to this device.
GET /api/device/gpios/:idReturns available and used GPIO pins for a greenhouse’s device.Greenhouse ID.
Pins already assigned.
Pins available for sensor assignment.
Pins available for actuator assignment.
Tickets
Tickets
GET /api/ticketsReturns all support tickets.List of ticket objects.
GET /api/tickets/:idReturns a single ticket.Ticket ID.
POST /api/ticketsCreates a support ticket.Ticket subject.
Full description of the issue.
The created ticket.
PUT /api/tickets/:idUpdates a ticket (e.g. change status).Ticket ID.
DELETE /api/tickets/:idDeletes a ticket.Ticket ID.
204 No Content.