List MQTT Users
Response
Unique MQTT user identifier
MQTT username for authentication
Associated tenant ID
Device type: SENSOR, ACTUATOR, GATEWAY, API
Whether this user can currently connect
Timestamp when user was created
Timestamp of last successful connection (null if never connected)
Example
cURL
Response
Get MQTT User by ID
MQTT user ID
Example
cURL
Create MQTT User
Request Body
Unique MQTT username (3-50 characters)
MQTT password (minimum 8 characters, hashed with bcrypt)
Tenant ID this user belongs to
Device type:
SENSOR, ACTUATOR, GATEWAY, APIExample
cURL
Update MQTT User
MQTT user ID
Request Body
All fields are optional for updates.New password (will be hashed with bcrypt)
Updated device type
Activate or deactivate the user
Example
cURL
Delete MQTT User
MQTT user ID
Example
cURL
Device Types
MQTT users are categorized by device type for access control:SENSOR
- Purpose: Greenhouse sensor devices
- Permissions: Publish sensor data to
GREENHOUSE/{tenantId} - Example: Temperature sensors, humidity sensors, soil moisture
ACTUATOR
- Purpose: Control devices (pumps, valves, windows)
- Permissions:
- Subscribe to command topics
- Publish status updates
- Example: Irrigation pumps, ventilation systems, shade controllers
GATEWAY
- Purpose: Edge gateways that aggregate multiple sensors
- Permissions:
- Publish data for multiple devices
- Subscribe to configuration updates
- Example: Raspberry Pi gateway, industrial IoT gateway
API
- Purpose: Backend services and integrations
- Permissions: Full access (publish and subscribe to all topics)
- Example: Analytics services, monitoring dashboards, third-party integrations
Access Control Lists (ACLs)
ACL rules are automatically created based on device type:| Device Type | Publish Topics | Subscribe Topics |
|---|---|---|
| SENSOR | GREENHOUSE/{tenantId} | GREENHOUSE/{tenantId}/commands/# |
| ACTUATOR | GREENHOUSE/{tenantId}/status/# | GREENHOUSE/{tenantId}/actuators/# |
| GATEWAY | GREENHOUSE/{tenantId}/# | GREENHOUSE/{tenantId}/# |
| API | # (all topics) | # (all topics) |
ACL permissions are enforced at the MQTT broker level using the EMQX authentication plugin.
Security Best Practices
Strong Passwords
Use minimum 12 characters with uppercase, lowercase, numbers, and symbols
Unique Credentials
Each device should have its own unique MQTT username and password
Regular Rotation
Rotate MQTT passwords every 90 days for production environments
Monitor Access
Track
lastConnectedAt to detect unused or compromised accountsTesting MQTT Authentication
Test MQTT credentials using mosquitto_pub:For production, use TLS/SSL (port 8883) instead of plain MQTT (port 1883).