add_hotspot_user
Creates a MikroTik hotspot voucher user and returns plaintext login credentials plus a QR payload for visitor access. Preview by default, then confirm to apply.
Instructions
Create a hotspot voucher user (/ip/hotspot/user add) for a
visitor - name/password are the login credentials; profile
(an existing hotspot user profile), limit_uptime (a RouterOS
duration, e.g. "01:00:00"), and limit_bytes_total (a positive
integer byte quota) are all optional.
QR/VOUCHER: the result always also includes username, password
(the plaintext voucher credentials - THIS IS THE POINT: the visitor
needs them), and qr_payload - a plain STRING the caller renders as
a QR code itself; this package deliberately does NOT generate a QR
IMAGE (no extra imaging dependency). Format chosen for qr_payload:
"<username>:<password>" - a plain, self-describing credential
pair, NOT a login URL and NOT a WIFI: payload. Two alternatives
were considered and rejected: a login URL
(http://<hotspot>/login?username=..&password=..) would need a
reliably-known hotspot LAN address, which this package has no way to
determine for an arbitrary device/deployment - and RouterOS's actual
captive-portal login is normally a POST with additional
session-specific tokens (chap-id/chap-challenge), so a bare GET
URL with a plaintext password wouldn't even reliably work; a WIFI:
payload is for auto-joining a WPA network, which is a different
credential than a hotspot LOGIN (walled-garden HTTP auth) entirely.
username:password makes no claim about network topology or login
mechanics that could be wrong for a given deployment - a caller
integrating with a specific captive portal can build its own login
URL from these two fields plus its own known portal address.
PASSWORD IN THE JOURNAL: unlike every secret this package has
handled before (a device password, a WireGuard private-key), this
tool's password is DELIBERATELY present in its result - but still
never written to the audit journal. See guard.add_hotspot_user's
docstring for exactly how that asymmetry holds.
WRITE tool, guarded: blocked entirely unless the server is running
with MIKROTIK_ALLOW_WRITE=true. Call with confirm=False (the
default) to get a preview (including qr_payload) without changing
anything; call again with confirm=True to actually create it.
Errors clearly (without creating anything) if name already exists
on the device - it never creates a duplicate or resets an existing
voucher's password.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| confirm | No | ||
| profile | No | ||
| password | Yes | ||
| device_name | Yes | ||
| limit_uptime | No | ||
| limit_bytes_total | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||