PlantSense
PlantSenseKnow Your Plants

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

POST/auth/register

Create 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"
  }
}
POST/auth/login

Authenticate 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"
  }
}
POST/auth/forgot-password

Request a password reset email.

Request Body

{
  "email": "[email protected]"
}

Response

{
  "message": "Password reset email sent."
}

Devices

GET/api/devices

List 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"
    }
  }
]
GET/api/devices/:id

Get 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"
    }
  ]
}
PUT/api/devices/:id

Update 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
  }
}
DELETE/api/devices/:id

Remove a device from your account. The sensor can be re-paired to a new account.

Response

{
  "message": "Device removed."
}
POST/api/devices/:id/just-watered

Mark 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

GET/api/notifications

List 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"
  }
]
PATCH/api/notifications/:id/read

Mark a notification as read.

Response

{
  "id": "ntf_001",
  "read": true
}
PUT/api/notifications/settings

Update notification preferences (push and email alerts).

Request Body

{
  "pushEnabled": true,
  "emailEnabled": false,
  "emailAddress": "[email protected]"
}

Response

{
  "pushEnabled": true,
  "emailEnabled": false,
  "emailAddress": "[email protected]"
}

User

GET/api/user

Get the authenticated user's profile.

Response

{
  "id": "usr_abc123",
  "email": "[email protected]",
  "name": "Jane Doe",
  "createdAt": "2026-01-15T12:00:00Z",
  "deviceCount": 3
}
PUT/api/user

Update the authenticated user's profile.

Request Body

{
  "name": "Jane Smith"
}

Response

{
  "id": "usr_abc123",
  "email": "[email protected]",
  "name": "Jane Smith"
}
PUT/api/user/password

Change the authenticated user's password.

Request Body

{
  "currentPassword": "oldpassword",
  "newPassword": "newpassword"
}

Response

{
  "message": "Password updated."
}

Error Codes

CodeMeaning
400Bad Request - Invalid or missing parameters.
401Unauthorized - Missing or invalid token.
403Forbidden - Insufficient permissions.
404Not Found - Resource does not exist.
409Conflict - Resource already exists (e.g., duplicate email).
429Too Many Requests - Rate limit exceeded.
500Internal Server Error - Something went wrong on our end.