API Reference
The PlantSense API is available at https://app.myplantsense.com/api. All endpoints return JSON and require authentication unless noted otherwise.
Authentication
All authenticated requests must include a Bearer token in the Authorization header. Obtain a token by calling the login endpoint.
Authorization: Bearer <your-token>
Auth
/auth/registerCreate a new user account.
Request Body
{
"email": "[email protected]",
"password": "yourpassword",
"name": "Jane Doe"
}Response
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": "usr_abc123",
"email": "[email protected]",
"name": "Jane Doe"
}
}/auth/loginAuthenticate and receive a JWT token.
Request Body
{
"email": "[email protected]",
"password": "yourpassword"
}Response
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": "usr_abc123",
"email": "[email protected]",
"name": "Jane Doe"
}
}/auth/forgot-passwordRequest a password reset email.
Request Body
{
"email": "[email protected]"
}Response
{
"message": "Password reset email sent."
}Devices
/api/devicesList all devices associated with the authenticated user.
Response
[
{
"id": "dev_001",
"name": "Kitchen Basil",
"macAddress": "AA:BB:CC:DD:EE:FF",
"plantName": "Sweet Basil",
"lastReading": {
"moisture": 42,
"temperature": 22.5,
"humidity": 55,
"light": 850,
"battery": 87,
"timestamp": "2026-04-12T10:30:00Z"
}
}
]/api/devices/:idGet detailed information and recent readings for a specific device.
Response
{
"id": "dev_001",
"name": "Kitchen Basil",
"macAddress": "AA:BB:CC:DD:EE:FF",
"plantName": "Sweet Basil",
"plantSpecies": "Ocimum basilicum",
"thresholds": {
"moistureLow": 30,
"moistureHigh": 70,
"temperatureLow": 15,
"temperatureHigh": 35
},
"readings": [
{
"moisture": 42,
"temperature": 22.5,
"humidity": 55,
"light": 850,
"battery": 87,
"timestamp": "2026-04-12T10:30:00Z"
}
]
}/api/devices/:idUpdate device settings such as name, plant info, or alert thresholds.
Request Body
{
"name": "Kitchen Basil",
"plantName": "Sweet Basil",
"thresholds": {
"moistureLow": 25,
"moistureHigh": 65
}
}Response
{
"id": "dev_001",
"name": "Kitchen Basil",
"plantName": "Sweet Basil",
"thresholds": {
"moistureLow": 25,
"moistureHigh": 65,
"temperatureLow": 15,
"temperatureHigh": 35
}
}/api/devices/:idRemove a device from your account. The sensor can be re-paired to a new account.
Response
{
"message": "Device removed."
}/api/devices/:id/just-wateredMark a device as just watered. This helps calibrate moisture baselines and resets the watering timer.
Response
{
"message": "Watering recorded.",
"wateredAt": "2026-04-12T10:45:00Z"
}Notifications
/api/notificationsList all notifications for the authenticated user, most recent first.
Response
[
{
"id": "ntf_001",
"type": "moisture_low",
"deviceId": "dev_001",
"deviceName": "Kitchen Basil",
"message": "Kitchen Basil needs water! Moisture is at 18%.",
"read": false,
"createdAt": "2026-04-12T08:00:00Z"
}
]/api/notifications/:id/readMark a notification as read.
Response
{
"id": "ntf_001",
"read": true
}/api/notifications/settingsUpdate notification preferences (push and email alerts).
Request Body
{
"pushEnabled": true,
"emailEnabled": false,
"emailAddress": "[email protected]"
}Response
{
"pushEnabled": true,
"emailEnabled": false,
"emailAddress": "[email protected]"
}User
/api/userGet the authenticated user's profile.
Response
{
"id": "usr_abc123",
"email": "[email protected]",
"name": "Jane Doe",
"createdAt": "2026-01-15T12:00:00Z",
"deviceCount": 3
}/api/userUpdate the authenticated user's profile.
Request Body
{
"name": "Jane Smith"
}Response
{
"id": "usr_abc123",
"email": "[email protected]",
"name": "Jane Smith"
}/api/user/passwordChange the authenticated user's password.
Request Body
{
"currentPassword": "oldpassword",
"newPassword": "newpassword"
}Response
{
"message": "Password updated."
}Error Codes
| Code | Meaning |
|---|---|
| 400 | Bad Request - Invalid or missing parameters. |
| 401 | Unauthorized - Missing or invalid token. |
| 403 | Forbidden - Insufficient permissions. |
| 404 | Not Found - Resource does not exist. |
| 409 | Conflict - Resource already exists (e.g., duplicate email). |
| 429 | Too Many Requests - Rate limit exceeded. |
| 500 | Internal Server Error - Something went wrong on our end. |