Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/GaelCeballos/Smart_Enviro_Backend/llms.txt

Use this file to discover all available pages before exploring further.

Returns all active devices that have not yet been assigned to any user (user_id IS NULL). Use this endpoint to populate a device discovery UI before calling POST /api/devices/{id}/add to claim a device.

Endpoint

FieldValue
MethodGET
Path/api/devices/available
AuthBearer token required (Authorization: Bearer YOUR_TOKEN)

Request

No query parameters or request body.
curl -X GET http://localhost/api/devices/available \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200 OK)

{
  "status": "success",
  "message": "Dispositivos disponibles para agregar",
  "data": [
    {
      "id": 5,
      "device_token": "abc123...",
      "name": "Dispositivo Smart Enviro",
      "mac_address": "AA:BB:CC:DD:EE:FF",
      "type": "sensor_multi",
      "is_online": false,
      "last_seen": null
    }
  ]
}
status
string
Always "success" on a 200 response.
message
string
A human-readable label confirming the query returned available devices.
data
array
Array of unclaimed, active device objects.

Only active devices (is_active = true) with no owner appear in this list. Devices already assigned to other users, inactive devices, and soft-deleted devices are all excluded.

Build docs developers (and LLMs) love