Skip to content
@deckyard/routeros

routeros cheatsheet

Every exported function, constant and struct, one section per topic. Calls take an open Client as c:

jennifer
import "@deckyard/routeros/" as mt;
def c as mt.Client init mt.connect("192.168.88.1", "admin", "secret");

Unless a row says otherwise, invalid input throws Error{kind: "routeros"} before anything is sent, and a router refusal throws Error{kind: "mikrotik"}. The *_PATH constants are RouterOS menu paths for the generic verbs in Core.

Core

Guide: Core.

FunctionReturnsNotes
connect(host, user, password)Clientplaintext API, port 8728; MT_VERBOSE seeds the verbose flag
connectTLS(host, user, password)Clientapi-ssl, port 8729; the certificate is verified
connectWith(host, port, user, password, tls)Clientexplicit port (1-65535, else routeros error) and TLS choice
disconnect(c)close the session; the client is unusable afterwards
getAll(c, path)list of map of string to stringevery item under any list path, one property map each
add(c, path, attrs)stringcreate an item; returns its id (e.g. "*3")
remove(c, path, id)delete by id (RouterOS has no separate delete)
set(c, path, id, attrs)change properties of an item
update(c, path, id, attrs)synonym of set
findByName(c, path, name)map of string to stringfirst item whose name matches, filtered on the router; empty map on a miss
idByName(c, path, name)stringid of the item with that name, "" on a miss
removeByName(c, path, name)delete by name; routeros error when absent
enable(c, path, id)set disabled=no
disable(c, path, id)set disabled=yes; the item stays but has no effect
moveRule(c, path, id, beforeId)move above beforeId; "" = bottom; a self-move is rejected
moveRuleToTop(c, path, id)reads the list; no-op when already first; routeros error on an empty list
moveRuleToBottom(c, path, id)same as moveRule with ""
setVerbose(c, enabled)Clientreturns a copy with command logging on/off: $c = mt.setVerbose($c, true);
isVerbose(c)boolwhether the client logs commands

Client

An open, authenticated connection to one router.

FieldMeaning
session as mikrotik.Sessionthe underlying API session
user as stringthe logged-in account; the user helpers refuse to remove, disable or regroup it
verbose as boolprint every command to stdout before sending it (see setVerbose)

Interfaces

Guide: Interfaces.

FunctionReturnsNotes
interfaces(c)list of Interfaceevery interface, physical and virtual
interfaceByName(c, name)Interfacerouteros error when absent
enableInterface(c, name)
disableInterface(c, name)no traffic passes until enabled
renameInterface(c, current, next)new name non-empty, no spaces; RouterOS updates its own references
commentInterface(c, name, comment)"" clears the comment
ConstantValue
INTERFACE_PATH"/interface"

Interface

One network interface as reported by the router.

FieldMeaning
id as stringinternal RouterOS id (e.g. "*1")
name as stringinterface name (e.g. "ether1")
kind as stringinterface type (e.g. "ether", "bridge", "wlan")
mac as stringhardware MAC address, "" when the router reports none
running as boollink up and passing traffic
disabled as booladministratively off
comment as stringfree-text comment, "" when unset

Interface lists

Guide: Interface lists.

FunctionReturnsNotes
interfaceLists(c)list of InterfaceListincludes the built-in all, none, dynamic
addInterfaceList(c, name, comment)stringidempotent by name; returns the new or existing id
removeInterfaceList(c, name)memberships go with it
interfaceListMembers(c, listName)list of stringmember interface names; empty for an unknown list
addToInterfaceList(c, listName, interfaceName)stringcreates a missing list; interface must exist; idempotent
removeFromInterfaceList(c, listName, interfaceName)routeros error when not a member
ConstantValue
INTERFACE_LIST_PATH"/interface/list"
INTERFACE_LIST_MEMBER_PATH"/interface/list/member"

InterfaceList

One interface list: a named group of interfaces.

FieldMeaning
id as stringinternal RouterOS id
name as stringthe list name (e.g. "WAN", "LAN")
dynamic as boolcreated by the system, not configured
comment as stringfree-text comment, "" when unset

Ethernet ports

Guide: Ethernet ports.

FunctionReturnsNotes
ethernetPorts(c)list of EthernetPortconfiguration of every port
ethernetPortByName(c, name)EthernetPortrouteros error when absent
linkStatus(c, name)LinkStatusmeasured now (monitor once): up, rate, duplex
forceEthernetLink(c, name, speed, fullDuplex)auto-negotiation off; speed 10Mbps 100Mbps 1Gbps 2.5Gbps 5Gbps 10Gbps; force both ends alike
autoNegotiateEthernet(c, name)back to the default
setEthernetMtu(c, name, mtu)68-65535; the port l2mtu caps it (router error above)
setPoe(c, name, mode)auto-on, forced-on, off; refuses ports without PoE
ConstantValue
ETHERNET_PATH"/interface/ethernet"

EthernetPort

One physical ethernet port and its configuration.

FieldMeaning
id as stringinternal RouterOS id
name as stringcurrent name (e.g. "ether1")
defaultName as stringfactory name, stable across renames
mac as stringMAC address
mtu as stringconfigured MTU as reported
autoNegotiation as boolspeed and duplex negotiated (the default)
poeOut as stringPoE mode ("auto-on", "forced-on", "off"), "" on ports without PoE
running as boollink up
slave as boolmember of a bridge or bond, whose settings then mostly apply instead
disabled as booladministratively off
comment as stringfree-text comment, "" when unset

LinkStatus

The measured state of one ethernet link.

FieldMeaning
name as stringthe port
up as boolstatus is "link-ok"
status as stringraw status ("link-ok", "no-link", ...)
rate as stringnegotiated speed (e.g. "1Gbps"), "" when down
fullDuplex as boolfull-duplex link
autoNegotiation as stringnegotiation state ("done", "incomplete", "disabled")

LTE / cellular

Guide: LTE / cellular.

FunctionReturnsNotes
lteInterfaces(c)list of LteInterfaceempty on any read error: no modem, or a dropped connection
lteStatus(c, name)LteStatusmeasured now (monitor once): registration, operator, signal
setLteApn(c, interfaceName, apn)creates/updates APN profile routeros-<interface> and binds it; APN must not be empty
enableLte(c, name)
disableLte(c, name)the cellular uplink drops
ConstantValue
LTE_PATH"/interface/lte"
LTE_APN_PATH"/interface/lte/apn"

LteInterface

One LTE (cellular) interface.

FieldMeaning
id as stringinternal RouterOS id
name as stringthe interface name (e.g. "lte1")
running as boolthe modem has a data connection
disabled as booladministratively off
comment as stringfree-text comment, "" when unset

LteStatus

The measured state of an LTE modem.

FieldMeaning
status as stringregistration status ("registered", ...)
registered as boolthe status contains "registered"
operator as stringthe mobile network operator
accessTechnology as string"lte" / "5g" / "hspa" / ... as reported
signalStrength as stringRSSI as reported (dBm)
rsrp as stringreference signal received power (LTE)
rsrq as stringreference signal received quality (LTE)
sinr as stringsignal-to-noise ratio

Guide: Bonding (link aggregation).

FunctionReturnsNotes
bonds(c)list of Bond
bondByName(c, name)Bondrouteros error when absent
addBond(c, name, slaves, mode)stringmode: balance-rr active-backup balance-xor broadcast 802.3ad balance-tlb balance-alb
addLacpBond(c, name, slaves)string802.3ad; the switch needs a matching LACP group; one flow uses one link
addFailoverBond(c, name, slaves, primary)stringactive-backup, any switch; primary must be a slave
setBondSlaves(c, name, slaves)same checks as creation; own members do not count as in use
removeBond(c, name)members become plain ports; remove bridge ports/addresses on the bond first
enableBond(c, name)
disableBond(c, name)no member carries traffic
ConstantValue
BONDING_PATH"/interface/bonding"
BOND_LACP"802.3ad"
BOND_ACTIVE_BACKUP"active-backup"

Bond

One bonding interface: several physical links acting as one.

FieldMeaning
id as stringinternal RouterOS id
name as stringbond name (e.g. "bondtrunk")
slaves as stringmember interfaces, comma-separated
mode as stringbonding mode ("802.3ad", "active-backup", ...)
primary as stringpreferred link in active-backup mode, "" otherwise
transmitHashPolicy as stringhow 802.3ad spreads flows, "" when default
mac as stringMAC address
mtu as stringMTU as reported
running as boolat least one member link is up
disabled as booladministratively off
comment as stringfree-text comment, "" when unset

Bridges

Guide: Bridges.

FunctionReturnsNotes
bridges(c)list of Bridge
addBridge(c, name)stringname non-empty, no spaces
removeBridge(c, name)RouterOS drops the memberships
bridgePorts(c, bridgeName)list of BridgePortports of one bridge; empty for an unknown bridge
addBridgePort(c, bridgeName, interfaceName)stringthe bridge must exist
removeBridgePort(c, interfaceName)detach from whichever bridge holds it
setBridgePortHardwareOffload(c, interfaceName, on)the port hw flag; on only permits offload, check with switchHosts
bridgeVlans(c)list of BridgeVlanthe bridge VLAN table
enableVlanFiltering(c, bridge)enable last: with an incomplete VLAN table it drops untagged traffic, your own session included
disableVlanFiltering(c, bridge)
addBridgeVlan(c, bridge, vlanId, tagged, untagged)stringVLAN 1-4094; port lists comma-separated, "" for none; idempotent by bridge and VLAN, an existing entry is not changed
setPortPvid(c, bridge, port, pvid)access-port VLAN, 1-4094; the port must be on the bridge
removeBridgeVlan(c, bridge, vlanId)routeros error when no such entry
ConstantValue
BRIDGE_PATH"/interface/bridge"
BRIDGE_PORT_PATH"/interface/bridge/port"
BRIDGE_VLAN_PATH"/interface/bridge/vlan"

BridgeVlan

One bridge VLAN-table entry: which ports carry a VLAN, tagged or not.

FieldMeaning
id as stringinternal RouterOS id
bridge as stringthe bridge this applies to
vlanIds as stringVLAN ids as reported (list or range)
tagged as stringtrunk ports, carrying the VLAN tagged
untagged as stringaccess ports, carrying it untagged
dynamic as booladded by RouterOS, not configured

Bridge

One bridge: a software switch joining its ports into one LAN.

FieldMeaning
id as stringinternal RouterOS id
name as stringbridge name (e.g. "bridge1")
mac as stringMAC address
running as boolbridge is up
disabled as booladministratively off
comment as stringfree-text comment, "" when unset

BridgePort

One bridge membership: an interface attached to a bridge.

FieldMeaning
id as stringinternal RouterOS id
bridge as stringname of the bridge
interfaceName as stringname of the member interface
hardwareOffload as boolthe hw flag: the port may forward in the switch chip; whether it does depends on the bridge config (see switchHosts)
disabled as boolmembership is off

Switch chip (hardware offload)

Guide: Switch chip (hardware offload).

FunctionReturnsNotes
switchChips(c)list of SwitchChipEmpty on a board without a switch chip, and on any read error.
switchHosts(c)list of SwitchHostThe whole hardware MAC table. LAN MACs here mean the chip forwards their traffic. Empty on any read error.
ConstantValue
ETHERNET_SWITCH_PATH"/interface/ethernet/switch"
ETHERNET_SWITCH_HOST_PATH"/interface/ethernet/switch/host"

SwitchChip

One switch chip on the router.

FieldMeaning
id as stringinternal RouterOS id
name as stringchip name, e.g. "switch1"
kind as stringchip model as reported (the type property), e.g. "Atheros-8327"

SwitchHost

One entry in the switch chip's hardware MAC table.

FieldMeaning
mac as stringlearned MAC address
ports as stringswitch port(s) it was learned on
vlanId as intVLAN id, 0 when untagged or not reported
dynamic as booltrue when learned, false for a static entry

VLANs

Guide: VLANs.

FunctionReturnsNotes
vlans(c)list of VlanAll VLAN interfaces.
vlanByName(c, name)VlanThrows when absent.
addVlan(c, name, vlanId, interfaceName)stringTag 1-4094; parent must exist. Returns the id.
removeVlan(c, name)Throws when absent.
enableVlan(c, name)Throws when absent.
disableVlan(c, name)Throws when absent.
ConstantValue
VLAN_PATH"/interface/vlan"

Vlan

One VLAN interface: an 802.1Q-tagged virtual interface on a parent.

FieldMeaning
id as stringinternal RouterOS id
name as stringinterface name, e.g. "vlanoffice"
vlanId as int802.1Q tag, 1-4094
interfaceName as stringparent interface
mtu as stringMTU as reported
running as booltrue when the parent is up
disabled as booltrue when the VLAN is switched off
comment as stringcomment, "" when unset

Wireless (WiFi)

Guide: Wireless (WiFi).

FunctionReturnsNotes
wirelessInterfaces(c)list of WirelessInterfaceRadios and virtual APs. Empty without the classic menu (wifiwave2 hardware) and on any read error.
setupWifiAccessPoint(c, interfaceName, ssid, password)SSID, mode ap-bridge, WPA2-PSK key in profile routeros-<interface> (never default), enable. Idempotent.
setWifiSsid(c, interfaceName, ssid)SSID 1-32 characters. Disconnects clients.
setWifiPassword(c, interfaceName, password)Passphrase 8-63 characters. Moves the interface off default to its own profile first. Disconnects clients.
addVirtualAp(c, masterInterface, name, ssid, password)stringSecond SSID with its own profile on the same radio (guest WiFi). Returns the id.
removeVirtualAp(c, name)Refuses a physical radio. Keeps the security profile.
enableWifi(c, interfaceName)Throws when the interface is unknown.
disableWifi(c, interfaceName)The network disappears from the air.
wifiClients(c)list of WifiClientConnected clients with signal and rates. Empty without the classic menu and on any read error.
ConstantValue
WIRELESS_PATH"/interface/wireless"
WIRELESS_SECURITY_PATH"/interface/wireless/security-profiles"
WIRELESS_REGISTRATION_PATH"/interface/wireless/registration-table"

WirelessInterface

One wireless interface: a radio, or a virtual AP on top of one.

FieldMeaning
id as stringinternal RouterOS id
name as stringinterface name, e.g. "wlan1"
ssid as stringbroadcast network name
mode as string"ap-bridge" (access point), "station" (client), ...
band as stringradio band, e.g. "2ghz-b/g/n", "5ghz-a/n/ac"
frequency as stringchannel frequency in MHz, or "auto"
securityProfile as stringsecurity profile holding the password
masterInterface as stringparent radio of a virtual AP, "" for a physical radio
running as booltrue when the radio is up and serving
disabled as booltrue when the interface is switched off
comment as stringcomment, "" when unset

WifiClient

One connected wireless client (a registration-table entry).

FieldMeaning
interfaceName as stringwireless interface the client is on
mac as stringclient MAC address
signalStrength as stringsignal as reported, e.g. "-52dBm"
txRate as stringcurrent transmit rate as reported
rxRate as stringcurrent receive rate as reported
uptime as stringtime connected, as reported

Modern WiFi (wifiwave2 / ax)

Guide: Modern WiFi (wifiwave2 / ax).

FunctionReturnsNotes
wifiInterfaces(c)list of WifiInterfaceRadios and virtual APs. Empty without /interface/wifi and on any read error.
setupWifi(c, interfaceName, ssid, password)Mode ap, SSID, WPA2-PSK + WPA3-PSK passphrase on the interface, enable. Idempotent.
setWifiPassphrase(c, interfaceName, password)8-63 characters. Disconnects clients.
addVirtualWifi(c, masterInterface, name, ssid, password)stringGuest SSID on the same radio, WPA2/WPA3. Returns the id.
removeVirtualWifi(c, name)Refuses a physical radio.
wifiRegistrations(c)list of WifiRegistrationConnected clients. Empty without /interface/wifi and on any read error.
ConstantValue
WIFI_PATH"/interface/wifi"
WIFI_REGISTRATION_PATH"/interface/wifi/registration-table"

WifiInterface

One modern (wifiwave2/ax) WiFi interface: a radio or a virtual AP.

FieldMeaning
id as stringinternal RouterOS id
name as stringinterface name, e.g. "wifi1"
ssid as stringconfigured network name (configuration.ssid)
band as stringconfigured band (channel.band), e.g. "5ghz-ax"
masterInterface as stringparent radio of a virtual AP, "" for a radio
running as booltrue when up and serving
disabled as booltrue when switched off
comment as stringcomment, "" when unset

WifiRegistration

One connected client on a modern WiFi interface.

FieldMeaning
interfaceName as stringWiFi interface the client is on
ssid as stringnetwork it joined
mac as stringclient MAC address
signal as stringsignal in dBm, as reported
uptime as stringtime connected, as reported

CAPsMAN

Guide: CAPsMAN.

FunctionReturnsNotes
capsmanStatus(c)CapsmanStatusTries CAPsMANv2, then legacy. version 0 when neither answers (read errors included).
enableCapsman(c)Manager switch only; configuration and provisioning stay with the generic verbs. Throws without a CAPsMAN menu.
disableCapsman(c)Throws without a CAPsMAN menu.
managedAps(c)list of ManagedApRegistered APs; empty when none or no CAPsMAN.
ConstantValue
CAPSMAN_PATH"/caps-man/manager"
CAPSMAN_REGISTRATION_PATH"/caps-man/registration-table"
CAPSMAN_REMOTE_PATH"/caps-man/remote-cap"
WIFI_CAPSMAN_PATH"/interface/wifi/capsman"
WIFI_CAP_PATH"/interface/wifi/cap"

CapsmanStatus

The state of a CAPsMAN controller (either generation).

FieldMeaning
enabled as booltrue when the controller is running
version as int1 (legacy /caps-man), 2 (/interface/wifi), 0 when neither exists
managedAps as intnumber of access points it manages now

ManagedAp

One access point registered with the controller.

FieldMeaning
identity as stringAP identity (name)
address as stringaddress the AP connected from
interfaceName as stringmanaged radio interface
state as stringprovisioning state

Firewall (filter rules)

Guide: Firewall (filter rules).

FunctionReturnsNotes
firewallRule(chain, action)FirewallRuleNew builder matching everything in chain. Chain non-empty, no spaces; action one of accept, drop, reject, log, jump, return, passthrough, tarpit, fasttrack-connection, notrack.
withSrcAddressList(rule, listName)FirewallRuleCopy matching an address list as source.
withDstAddressList(rule, listName)FirewallRuleCopy matching an address list as destination.
withProtocol(rule, protocol)FirewallRuletcp, udp, icmp, gre, ipip, ospf, igmp, ipsec-esp, ipsec-ah, l2tp, sctp, vrrp.
withSrcAddress(rule, address)FirewallRuleAddress or CIDR; only empty or spaced values are rejected locally.
withDstAddress(rule, address)FirewallRuleAddress or CIDR; only empty or spaced values are rejected locally.
withSrcPort(rule, spec)FirewallRule"80", "80,443" or "8000-8100". Needs a protocol by addFirewallRule.
withDstPort(rule, spec)FirewallRule"80", "80,443" or "8000-8100". Needs a protocol by addFirewallRule.
withInInterface(rule, name)FirewallRuleCopy matching the incoming interface.
withOutInterface(rule, name)FirewallRuleCopy matching the outgoing interface.
withInInterfaceList(rule, listName)FirewallRuleCopy matching an interface list, e.g. "WAN".
withOutInterfaceList(rule, listName)FirewallRuleCopy matching an interface list as outgoing.
withComment(rule, comment)FirewallRuleThe handle the *ByComment verbs use; keep it distinct.
withDisabled(rule, disabled)FirewallRuleCreate the rule switched off.
firewallRules(c)list of FirewallRuleAll filter rules, ids set.
addFirewallRule(c, rule)stringAppends to the chain. Rejects a port match without a protocol. Returns the id.
removeFirewallRule(c, id)By id.
removeFirewallRuleByComment(c, comment)Throws when no rule carries the comment.
enableFirewallRuleByComment(c, comment)Throws when no rule carries the comment.
disableFirewallRuleByComment(c, comment)Keeps the rule; throws when no rule carries the comment.
moveFirewallRule(c, id, beforeId)Place id directly above beforeId; "" for the bottom. Rejects a self-move.
moveFirewallRuleByComment(c, comment, beforeComment)moveFirewallRule by comments; "" for the bottom.
allowService(c, protocol, port, comment)stringInput-chain accept for one port (1-65535), appended. Returns the id.
blockAddress(c, address, comment)stringInput-chain drop for a source, appended; forwarded traffic unaffected. Returns the id.
ConstantValue
FIREWALL_PATH"/ip/firewall/filter"
CHAIN_INPUT"input"
CHAIN_FORWARD"forward"
CHAIN_OUTPUT"output"
ACTION_ACCEPT"accept"
ACTION_DROP"drop"
ACTION_REJECT"reject"
ACTION_NOTRACK"notrack"

FirewallRule

One firewall filter rule, both as a builder and as a query result.

FieldMeaning
id as stringinternal RouterOS id, "" on a rule you build
chain as stringchain: input, forward, output, or a custom chain
action as stringaction on a match: accept, drop, reject, ...
protocol as stringIP protocol to match, "" for any
srcAddress as stringsource address or CIDR network, "" for any
dstAddress as stringdestination address or CIDR network, "" for any
srcAddressList as stringsource address list, "" for none
dstAddressList as stringdestination address list, "" for none
srcPort as stringsource port, list, or range, "" for any
dstPort as stringdestination port, list, or range, "" for any
inInterface as stringinterface the packet arrived on, "" for any
outInterface as stringinterface the packet would leave on, "" for any
inInterfaceList as stringinterface list the packet arrived on, "" for any
outInterfaceList as stringinterface list the packet would leave on, "" for any
comment as stringcomment, also the handle for the *ByComment verbs
disabled as booltrue when the rule is (or is created) switched off

NAT

Guide: NAT.

FunctionReturnsNotes
natRules(c)list of NatRuleall NAT rules, table order
addMasquerade(c, outInterface, comment)stringsrcnat masquerade out of outInterface; idempotent per interface (existing id returned, comment ignored); unknown interface rejected
forwardPort(c, protocol, publicPort, toAddress, toPort, comment)stringdst-nat from any interface; protocol tcp or udp only, ports 1-65535, toAddress an IP; not idempotent; the forward chain must also accept the traffic
forwardPortOn(c, inInterface, protocol, publicPort, toAddress, toPort, comment)stringas forwardPort, matching only inInterface (use the WAN); the interface is looked up first
removeNatRule(c, id)delete by id
removeNatRuleByComment(c, comment)delete by comment
enableNatRuleByComment(c, comment)enable by comment
disableNatRuleByComment(c, comment)disable by comment; the rule is kept
moveNatRule(c, id, beforeId)place above beforeId; "" = bottom; a self-move is rejected
moveNatRuleByComment(c, comment, beforeComment)same, by comment handles; "" = bottom
ConstantValue
NAT_PATH"/ip/firewall/nat"
CHAIN_SRCNAT"srcnat"
CHAIN_DSTNAT"dstnat"
ACTION_MASQUERADE"masquerade"
ACTION_DST_NAT"dst-nat"

NatRule

One firewall NAT rule as read back from the router.

FieldMeaning
id as stringinternal RouterOS id
chain as string"srcnat" (outgoing) or "dstnat" (incoming)
action as string"masquerade", "dst-nat", ...
protocol as stringmatched IP protocol, "" for any
srcAddress as stringmatched source address or network, "" for any
dstAddress as stringmatched destination address or network, "" for any
dstPort as stringmatched destination port(s), "" for any
toAddresses as stringdst-nat target address
toPorts as stringdst-nat target port
inInterface as stringincoming interface match, "" for any
outInterface as stringoutgoing interface match, "" for any
comment as stringcomment; the *ByComment handle
disabled as booltrue when the rule is switched off

Mangle

Guide: Mangle.

FunctionReturnsNotes
mangleRules(c)list of MangleRuleall mangle rules, table order
setupPacketMark(c, markName, matcher)stringconnection mark <markName>-conn on new connections, then packet mark markName; the matcher keeps its chain (use CHAIN_PREROUTING), loses action and comment; idempotent by mark
removePacketMark(c, markName)removes both rules of the mark; throws when none exists
markRoutingFor(c, markName, srcAddress)stringmark-routing in prerouting for an IP or CIDR source; the table must exist (v7) and have a default route; idempotent by mark and source
removeRoutingMark(c, markName, srcAddress)undo markRoutingFor; throws when absent
clampTcpMss(c, interfaceName)change-mss to clamp-to-pmtu for SYNs in forward, in and out of the interface; idempotent; for PPPoE and tunnels
removeTcpMssClamp(c, interfaceName)removes both clamp rules; throws when none exists
moveMangleRule(c, id, beforeId)place above beforeId; "" = bottom
moveMangleRuleByComment(c, comment, beforeComment)same, by comment handles
ConstantValue
MANGLE_PATH"/ip/firewall/mangle"
CHAIN_PREROUTING"prerouting"
CHAIN_POSTROUTING"postrouting"

MangleRule

One mangle rule as read back from the router.

FieldMeaning
id as stringinternal RouterOS id
chain as string"prerouting", "forward", "postrouting", ...
action as string"mark-connection", "mark-packet", "mark-routing", "change-mss", ...
newConnectionMark as stringconnection mark set, "" when none
newPacketMark as stringpacket mark set, "" when none
newRoutingMark as stringrouting mark (table name) set, "" when none
newMss as stringMSS set by change-mss, "" when none
connectionMark as stringmatched connection mark, "" for any
packetMark as stringmatched packet mark, "" for any
protocol as stringmatched protocol, "" for any
srcAddress as stringmatched source, "" for any
dstAddress as stringmatched destination, "" for any
dstPort as stringmatched destination port(s), "" for any
inInterface as stringmatched incoming interface, "" for any
outInterface as stringmatched outgoing interface, "" for any
passthrough as booltrue when later rules still see the packet
disabled as booltrue when the rule is switched off
comment as stringcomment; the handle the setup verbs use

Firewall raw (pre-conntrack)

Guide: Firewall raw (pre-conntrack).

FunctionReturnsNotes
rawRules(c)list of RawRuleall raw rules, table order
addRawRule(c, rule)stringappend a firewall-builder rule; raw takes chains prerouting/output and actions accept/drop/notrack, checked by the router (kind "mikrotik")
dropRawAddressList(c, listName, comment)stringdrop a source address list in prerouting
removeRawRule(c, id)delete by id
removeRawRuleByComment(c, comment)delete by comment
moveRawRule(c, id, beforeId)place above beforeId; "" = bottom
moveRawRuleByComment(c, comment, beforeComment)same, by comment handles
ConstantValue
RAW_PATH"/ip/firewall/raw"

RawRule

One raw-table rule as read back from the router.

FieldMeaning
id as stringinternal RouterOS id
chain as string"prerouting" or "output"
action as string"accept", "drop", "notrack", ...
protocol as stringmatched protocol, "" for any
srcAddress as stringmatched source, "" for any
dstAddress as stringmatched destination, "" for any
srcAddressList as stringsource address list, "" for none
inInterfaceList as stringincoming interface list, "" for none
comment as stringcomment; the *ByComment handle
disabled as booltrue when switched off

Connection tracking

Guide: Connection tracking.

FunctionReturnsNotes
conntrackSettings(c)ConntrackSettingstracking switch, table fill and capacity
connections(c)list of Connectionwhole table; thousands of rows on a busy router
connectionsFor(c, address)list of Connectionconnections whose src or dst contains address as a substring (10.0.0.1 also matches 10.0.0.10-19 and .100-.199)
dropConnectionsFor(c, address)intremoves the same substring matches, so it can hit other hosts; returns the count; does not block reconnects
ConstantValue
CONNTRACK_SETTINGS_PATH"/ip/firewall/connection/tracking"
CONNECTION_PATH"/ip/firewall/connection"

ConntrackSettings

The connection-tracking settings and table fill.

FieldMeaning
enabled as string"auto", "yes" or "no", as reported
totalEntries as intconnections tracked now
maxEntries as inttable capacity; new connections are dropped when it is full

Connection

One tracked connection.

FieldMeaning
id as stringinternal RouterOS id
protocol as stringprotocol, e.g. "tcp" or "udp"
srcAddress as stringsource address:port
dstAddress as stringdestination address:port
tcpState as stringTCP state such as "established", "" for non-TCP
timeout as stringtime until the entry expires
connectionMark as stringconnection mark, "" when none

Firewall address lists

Guide: Firewall address lists.

FunctionReturnsNotes
addressLists(c)list of stringdistinct list names, first-seen order
addressListEntries(c, listName)list of AddressListEntryone list's entries; empty for an unknown list
addToAddressList(c, listName, address, comment)stringIP, CIDR or DNS name; creates the list; idempotent per list and address
addToAddressListTimed(c, listName, address, timeout, comment)stringentry that expires after timeout ("30m", "1d", "1d12h", "HH:MM:SS"); not idempotent
removeFromAddressList(c, listName, address)address exactly as listed; throws when absent
clearAddressList(c, listName)removes static entries only; throws when there are none
dropAddressList(c, listName, chain, comment)stringappends one filter rule dropping the list's sources in chain; not idempotent
ConstantValue
ADDRESS_LIST_PATH"/ip/firewall/address-list"

AddressListEntry

One entry of a firewall address list.

FieldMeaning
id as stringinternal RouterOS id
listName as stringlist the entry belongs to, e.g. "blocklist"
address as stringIP, CIDR network or DNS name; RouterOS resolves names and follows their changes
timeout as stringremaining lifetime, "" for a permanent entry
dynamic as booltrue when something else created it, e.g. a firewall rule with add-src-to-address-list
disabled as booltrue when the entry is switched off
comment as stringcomment, "" when unset

IP addresses

Guide: IP addresses.

FunctionReturnsNotes
ipAddresses(c)list of IpAddressstatic and dynamic addresses
addIpAddress(c, address, interfaceName)stringprefix required ("192.168.88.1/24"); the interface must exist
removeIpAddress(c, address)matches the address string with its prefix exactly; throws when absent
ConstantValue
IP_ADDRESS_PATH"/ip/address"

IpAddress

One IP address assigned to an interface.

FieldMeaning
id as stringinternal RouterOS id
address as stringaddress with prefix, e.g. "192.168.88.1/24"
network as stringnetwork address the prefix implies, e.g. "192.168.88.0"
interfaceName as stringinterface the address sits on
dynamic as booltrue when a DHCP client or PPP session assigned it; such addresses cannot be removed by hand
disabled as booltrue when the address is switched off
comment as stringcomment, "" when unset

The ARP table

Guide: The ARP table.

FunctionReturnsNotes
arpTable(c)list of ArpEntrywhole table, dynamic and static
arpTableOn(c, interfaceName)list of ArpEntryone interface's entries
macForAddress(c, address)stringMAC for an IP; "" on a miss
addressesForMac(c, mac)list of stringIPs a MAC holds, case-insensitive; possibly empty
addStaticArp(c, address, mac, interfaceName)stringpin a binding; MAC stored upper-case; refuses an existing static entry for the address on that interface
removeArpEntry(c, address)static or dynamic; clears a stale binding; throws when absent
flushArp(c, interfaceName)intremoves dynamic entries on the interface; returns the count
ConstantValue
ARP_PATH"/ip/arp"

ArpEntry

One ARP entry: an IP-to-MAC binding on an interface.

FieldMeaning
id as stringinternal RouterOS id
address as stringIP address
mac as stringMAC address it resolves to, "" while unresolved
interfaceName as stringinterface the binding lives on
dynamic as booltrue when learned, false for a static (pinned) entry
complete as booltrue when the MAC is known; false means the router asked and got no answer, typically an offline device
published as booltrue when the router answers ARP for this address itself (proxy ARP)
disabled as booltrue when the entry is switched off
comment as stringcomment, "" when unset

DHCP

Guide: DHCP.

FunctionReturnsNotes
dhcpServers(c)list of DhcpServerAll server instances.
setupDhcp(c, name, interfaceName, network, gateway, rangeFrom, rangeTo, dns)stringCreates pool, server and network entry; gateway and range must lie inside the network, DNS entries must be IPs, the interface must exist. Not idempotent. Returns the server id.
teardownDhcp(c, name, network)Removes whichever of the three pieces exist; network matched by exact CIDR string. Throws when none exists.
dhcpLeases(c)list of DhcpLeaseDynamic leases and static reservations.
addStaticLease(c, address, mac, comment)stringReserve an address for a MAC (any case, sent uppercased). Not idempotent.
removeLeaseByMac(c, mac)Throws on a malformed MAC or when no lease has it.
dhcpClients(c)list of DhcpClientAll DHCP clients with lease state.
setupWan(c, interfaceName)stringDHCP client on the WAN; adopts the ISP's route and DNS. Idempotent by interface: an existing client is returned untouched.
setupWanWith(c, interfaceName, usePeerDns, addDefaultRoute)stringSame, choosing whether to adopt the ISP's DNS and default route.
wanStatus(c, interfaceName)DhcpClientCheck bound. Throws when no DHCP client runs there.
renewWan(c, interfaceName)DHCP renew now.
removeDhcpClient(c, interfaceName)The uplink loses its address, route and DNS.
enableDhcpClient(c, interfaceName)By interface name.
disableDhcpClient(c, interfaceName)By interface name.
dhcpRelays(c)list of DhcpRelayAll relays.
addDhcpRelay(c, name, interfaceName, serverAddress)stringForward DHCP to a central server (IP address). Idempotent by name.
removeDhcpRelay(c, name)Throws when no relay has that name.
ConstantValue
IP_POOL_PATH"/ip/pool"
DHCP_SERVER_PATH"/ip/dhcp-server"
DHCP_NETWORK_PATH"/ip/dhcp-server/network"
DHCP_LEASE_PATH"/ip/dhcp-server/lease"
DHCP_CLIENT_PATH"/ip/dhcp-client"
DHCP_RELAY_PATH"/ip/dhcp-relay"

DhcpServer

One DHCP server instance.

FieldMeaning
id as stringinternal RouterOS id
name as stringserver name
interfaceName as stringinterface the server listens on
addressPool as stringpool it hands addresses out of
leaseTime as stringlease duration as RouterOS prints it (e.g. "30m")
disabled as booltrue when switched off

DhcpLease

One DHCP lease: an address handed out to, or reserved for, a device.

FieldMeaning
id as stringinternal RouterOS id
address as stringleased address
mac as stringdevice MAC address
hostName as stringhost name the device sent, "" when none
server as stringDHCP server that owns the lease
status as stringlease state ("bound", "waiting", ...)
dynamic as booltrue for an automatic lease, false for a reservation
expiresAfter as stringtime until the lease runs out, "" for static
comment as stringfree-text comment, "" when unset

DhcpClient

One DHCP client: an interface that gets its address from another network, usually the ISP.

FieldMeaning
id as stringinternal RouterOS id
interfaceName as stringinterface the client runs on
status as string"bound" when an address was obtained; "searching..." while still asking
bound as booltrue when the status is "bound"
address as stringaddress obtained, with prefix
gateway as stringgateway obtained
primaryDns as stringfirst DNS server announced, "" when none
secondaryDns as stringsecond DNS server, "" when none
expiresAfter as stringtime until the lease must be renewed
usePeerDns as booltrue when the router adopts the announced DNS servers
addDefaultRoute as stringdefault-route mode: "yes", "no" or "special-classless"
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

DhcpRelay

One DHCP relay: forwards a local network's DHCP requests to a remote server.

FieldMeaning
id as stringinternal RouterOS id
name as stringrelay name
interfaceName as stringinterface whose clients are relayed
dhcpServer as stringremote DHCP server address
disabled as booltrue when switched off

DNS

Guide: DNS.

FunctionReturnsNotes
dnsSettings(c)DnsSettingsUpstreams, remote requests, cache fill.
setDnsServers(c, servers)Comma-separated IP addresses; spaces dropped; DNS names rejected.
allowRemoteDnsRequests(c, allow)Answers on every interface: close port 53 on the WAN.
dnsStaticEntries(c)list of DnsEntryLocal names.
addDnsEntry(c, name, address)stringNot idempotent. Returns the id.
removeDnsEntry(c, name)Throws when no entry has that name.
dnsCache(c)list of DnsCacheEntryWhole cache; large on a busy router.
dnsCacheFor(c, name)list of DnsCacheEntryCase-insensitive; empty when not resolved recently.
resolvedAddresses(c, name)list of stringData of the A and AAAA records only; CNAMEs not followed.
flushDnsCache(c)Static entries survive.
dnsAdlists(c)list of DnsAdlistRouterOS 7.15+.
addAdlist(c, url)stringHosts-format list; URL must start with "http". Idempotent by URL. RouterOS 7.15+; costs RAM.
removeAdlist(c, url)Throws when no adlist has that URL.
ConstantValue
DNS_PATH"/ip/dns"
DNS_STATIC_PATH"/ip/dns/static"
DNS_ADLIST_PATH"/ip/dns/adlist"
DNS_CACHE_PATH"/ip/dns/cache"

DnsCacheEntry

One DNS cache record.

FieldMeaning
id as stringinternal RouterOS id
name as stringDNS name the record answers for
kind as stringrecord type ("A", "AAAA", "CNAME", ...)
data as stringanswer: an address for A/AAAA, a name for CNAME
ttl as stringtime until the record expires from the cache
isStatic as booltrue for a static entry, which never expires

DnsSettings

The router's DNS resolver configuration.

FieldMeaning
servers as stringupstream servers, comma-separated
allowRemoteRequests as booltrue when the router answers its clients' queries
cacheSize as stringcache size as RouterOS prints it (e.g. "2048KiB")
cacheUsed as stringcache usage as RouterOS prints it

DnsEntry

One static DNS entry: a local name with a fixed address.

FieldMeaning
id as stringinternal RouterOS id
name as stringDNS name (e.g. "nas.lan")
address as stringaddress it resolves to
ttl as stringtime-to-live as RouterOS prints it (e.g. "1d")
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

DnsAdlist

One DNS adlist: a hosts-format blocklist the resolver applies (v7.15+).

FieldMeaning
id as stringinternal RouterOS id
url as stringblocklist URL, "" for a local-file list
matchCount as stringnumber of names it blocks, as RouterOS prints it
disabled as booltrue when switched off

IPv6

Guide: IPv6.

FunctionReturnsNotes
ipv6Settings(c)Ipv6SettingsThe global stack settings.
disableIpv6(c)Full effect after a reboot.
enableIpv6(c)Full effect after a reboot. Add /ipv6/firewall rules: the v4 firewall does not filter IPv6.
setIpv6Forwarding(c, enabled)Route IPv6 between interfaces.
setIpv6AcceptRouterAdvertisements(c, enabled)Router configures itself from received RAs.
ipv6Addresses(c)list of Ipv6AddressStatic and dynamic; check dynamic.
ipv6AddressesOn(c, interfaceName)list of Ipv6AddressFiltered by exact interface name.
addIpv6Address(c, cidr, interfaceName)stringAdvertised, no EUI-64. A LAN wants a /64. IPv4 CIDR rejected.
addIpv6AddressWith(c, cidr, interfaceName, advertise, eui64)stringChoose advertise (SLAAC on the LAN) and eui64 (host part from the MAC).
removeIpv6Address(c, cidr)Matched as text, as ipv6Addresses reports it; refuses dynamic addresses.
ipv6Nd(c)list of Ipv6NdNeighbor-discovery (RA) entries.
advertiseIpv6On(c, interfaceName)stringEnables or creates the interface's RA entry. Idempotent.
stopAdvertisingIpv6On(c, interfaceName)stringDisables the entry; clients keep addresses until the lifetime runs out.
setIpv6NdFlags(c, interfaceName, managed, otherConfig)stringM: addresses from DHCPv6. O: DNS from DHCPv6. Both false: pure SLAAC.
ConstantValue
IPV6_SETTINGS_PATH"/ipv6/settings"
IPV6_ADDRESS_PATH"/ipv6/address"
IPV6_ND_PATH"/ipv6/nd"

Ipv6Settings

The router's global IPv6 settings.

FieldMeaning
disabled as booltrue when the IPv6 stack is switched off
forward as booltrue when the router routes IPv6 between interfaces
acceptRouterAdvertisements as booltrue when the router configures itself from RAs it receives
acceptRedirects as booltrue when ICMPv6 redirects are honored
maxNeighborEntries as intneighbor-cache size limit, 0 when absent

Ipv6Address

One IPv6 address on an interface.

FieldMeaning
id as stringinternal RouterOS id
address as stringaddress in CIDR form
interfaceName as stringinterface it sits on
advertise as booltrue when the prefix is announced in RAs
eui64 as booltrue when the host part is derived from the MAC
linkLocal as booltrue for a fe80::/10 address
dynamic as booltrue when RouterOS created it (SLAAC, DHCPv6-PD)
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

Ipv6Nd

One neighbor-discovery entry: how the router advertises itself on an interface.

FieldMeaning
id as stringinternal RouterOS id
interfaceName as stringinterface, "all" for the default entry
raInterval as stringadvertisement interval as RouterOS prints it
raLifetime as stringhow long clients keep this router as default gateway
managed as boolM flag: clients get addresses from DHCPv6
otherConfig as boolO flag: clients get DNS and other options from DHCPv6
advertiseDns as booltrue when RAs carry the router's DNS servers
disabled as booltrue when switched off

Neighbor discovery

Guide: Neighbor discovery.

FunctionReturnsNotes
neighbors(c)list of NeighborHeard via LLDP, CDP, MNDP; directly connected segments only.
neighborsOn(c, interfaceName)list of NeighborSame, filtered by exact interface name.
ConstantValue
NEIGHBOR_PATH"/ip/neighbor"

Neighbor

One discovered neighbor on a directly-connected segment.

FieldMeaning
interfaceName as stringthe interface it was seen on
address as stringits IP address, "" when only layer 2
mac as stringits MAC address
identity as stringits system identity (host name)
platform as stringthe vendor platform (e.g. "MikroTik", "Cisco")
board as stringthe hardware model as reported
version as stringthe software version as reported

Hotspot

Guide: Hotspot.

FunctionReturnsNotes
hotspotServers(c)list of HotspotServerAll portals.
setupHotspot(c, name, interfaceName, network, gateway, rangeFrom, rangeTo)stringDHCP stack (DNS = gateway), profile and server on a dedicated guest interface. Returns the existing id when a server of that name exists.
teardownHotspot(c, name, network)Removes server, profile and DHCP stack; users, bindings and walled garden stay. Throws when nothing exists.
hotspotUsers(c)list of HotspotUserAll portal logins.
addHotspotUser(c, name, password, comment)stringThrows when the login exists or the password is empty.
addHotspotVoucher(c, name, password, uptimeLimit, comment)stringConnect-time limit: "4h", "1d", "1d12h" or "HH:MM:SS". Throws when the login exists.
removeHotspotUser(c, name)Throws when no such login exists.
hotspotActive(c)list of HotspotSessionLogged-in guests with byte counters.
kickHotspotUser(c, user)Throws when the login has no session.
bypassHotspotMac(c, mac, comment)stringDevice skips the portal. Idempotent by MAC.
removeHotspotBypass(c, mac)Throws when no bypass exists for the MAC.
allowBeforeLogin(c, dstHost, comment)stringWalled-garden host; wildcards like "*.example.org" work. Idempotent by host.
removeWalledGardenEntry(c, dstHost)Throws when no entry exists for the host.
ConstantValue
HOTSPOT_PATH"/ip/hotspot"
HOTSPOT_PROFILE_PATH"/ip/hotspot/profile"
HOTSPOT_USER_PATH"/ip/hotspot/user"
HOTSPOT_ACTIVE_PATH"/ip/hotspot/active"
HOTSPOT_BINDING_PATH"/ip/hotspot/ip-binding"
WALLED_GARDEN_PATH"/ip/hotspot/walled-garden"

HotspotServer

One hotspot server: a captive portal guarding an interface.

FieldMeaning
id as stringinternal RouterOS id
name as stringserver name
interfaceName as stringguarded interface, usually the guest bridge
addressPool as stringpool guests get addresses from
profile as stringserver profile: portal address, login method
disabled as booltrue when switched off

HotspotUser

One hotspot user: a portal login.

FieldMeaning
id as stringinternal RouterOS id
name as stringlogin name
profile as stringuser profile ("default" unless customized)
limitUptime as stringtotal connect time allowed, "" for unlimited
uptime as stringtime used so far
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

HotspotSession

One active hotspot session.

FieldMeaning
user as stringlogin used
address as stringguest IP address
mac as stringguest MAC address
uptime as stringsession duration so far
idleTime as stringtime since the guest last sent traffic
bytesIn as intbytes received from the guest
bytesOut as intbytes sent to the guest

PPPoE

Guide: PPPoE.

FunctionReturnsNotes
vpnUsers(c)list of PppUserThe PPP user database shared by L2TP, SSTP, OpenVPN, PPTP and PPPoE servers. See vpn.md.
addVpnUser(c, name, password, service, comment)stringService "any", "l2tp", "sstp", "ovpn", "pptp" or "pppoe". Throws when the login exists.
removeVpnUser(c, name)Throws when no such login exists.
enableVpnUser(c, name)Throws when no such login exists.
disableVpnUser(c, name)Parks the login without deleting it.
pppProfiles(c)list of PppProfileAddress and DNS templates for sessions.
pppActive(c)list of PppSessionSessions on every PPP server.
kickPppUser(c, name)Throws when the login has no session.
pppoeClients(c)list of PppoeClientAll PPPoE clients with session state.
setupPppoe(c, name, interfaceName, user, password)stringAdopts the ISP's route and DNS. Idempotent by name. Masquerade name, not the port.
pppoeStatus(c, name)PppoeClientCheck running. Throws when no client has that name.
setPppoeCredentials(c, name, user, password)The session reconnects.
removePppoeClient(c, name)The dial-in uplink goes away.
enablePppoeClient(c, name)Starts dialing at once.
disablePppoeClient(c, name)The session disconnects.
pppoeServers(c)list of PppoeServerAll PPPoE server services.
addPppoeServer(c, serviceName, interfaceName)stringClients authenticate against the PPP user database. Sets one-session-per-host. Idempotent by service name and interface.
removePppoeServer(c, serviceName)Throws when no such service exists.
ConstantValue
PPP_SECRET_PATH"/ppp/secret"
PPP_PROFILE_PATH"/ppp/profile"
PPP_ACTIVE_PATH"/ppp/active"
PPPOE_CLIENT_PATH"/interface/pppoe-client"
PPPOE_SERVER_PATH"/interface/pppoe-server/server"

PppUser

One PPP secret: a login shared by the PPP-based servers.

FieldMeaning
id as stringinternal RouterOS id
name as stringlogin name
service as stringservers that accept it: "any", "l2tp", "sstp", "ovpn", "pptp" or "pppoe"
profile as stringPPP profile applied ("default" unless set)
localAddress as stringrouter's tunnel address, "" when the profile decides
remoteAddress as stringclient's tunnel address, "" when the profile decides
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

PppProfile

One PPP profile: the addresses, DNS and limits applied to a login.

FieldMeaning
id as stringinternal RouterOS id
name as stringprofile name
localAddress as stringrouter's tunnel address, or a pool name
remoteAddress as stringclient address, or a pool name
dnsServer as stringDNS handed to clients, "" when unset
disabled as booltrue when switched off

PppSession

One active PPP session: a connected VPN or dial-in client.

FieldMeaning
name as stringlogin used
service as stringserver type ("l2tp", "sstp", "ovpn", "pppoe", ...)
address as stringclient tunnel address
uptime as stringsession duration so far
callerId as stringwhere the client connected from (address or MAC)

PppoeClient

One PPPoE client: a dial-in uplink over user name and password.

FieldMeaning
id as stringinternal RouterOS id
name as stringPPPoE interface name (e.g. "pppoewan")
interfaceName as stringphysical interface the session dials over
user as stringISP dial-in user name
usePeerDns as booltrue when the router adopts the ISP's DNS servers
addDefaultRoute as booltrue when the session installs the default route
running as booltrue when the session is up
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

PppoeServer

One PPPoE server service: the router accepting PPPoE dial-ins on an interface.

FieldMeaning
id as stringinternal RouterOS id
serviceName as stringPPPoE service name clients may ask for
interfaceName as stringinterface it serves on
defaultProfile as stringPPP profile applied to sessions
disabled as booltrue when switched off

RADIUS

Guide: RADIUS.

FunctionReturnsNotes
radiusServers(c)list of RadiusServerAll configured servers.
addRadiusServer(c, address, secret, services, comment)stringIP address only; non-empty secret; services from login, ppp, hotspot, wireless, dhcp, ipsec, dot1x. Idempotent by address: an existing entry is returned unchanged.
removeRadiusServer(c, address)Throws when no server has that address.
ConstantValue
RADIUS_PATH"/radius"

RadiusServer

One RADIUS server the router authenticates against.

FieldMeaning
id as stringinternal RouterOS id
address as stringserver address
services as stringsubsystems that use it, comma-separated
timeout as stringrequest timeout as RouterOS prints it
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

UPnP

Guide: UPnP.

FunctionReturnsNotes
upnpStatus(c)UpnpSettingsService on or off.
upnpInterfaces(c)list of UpnpInterfaceInterfaces that have a UPnP role.
enableUpnp(c)-Any device on an internal interface can then open forwards to itself; needs one internal and one external interface. Not for guest networks.
disableUpnp(c)-Turn UPnP off.
setUpnpInterface(c, interfaceName, role)stringRole "internal" (LAN) or "external" (WAN); other roles and unknown interfaces are rejected. Idempotent: an existing entry gets the new role.
removeUpnpInterface(c, interfaceName)-Throws when the interface has no role.
ConstantValue
UPNP_PATH"/ip/upnp"
UPNP_INTERFACES_PATH"/ip/upnp/interfaces"

UpnpSettings

The UPnP service settings.

FieldMeaning
enabled as booltrue when UPnP is running

UpnpInterface

One interface's UPnP role.

FieldMeaning
id as stringinternal RouterOS id
interfaceName as stringthe interface
role as string"internal" (LAN side) or "external" (WAN side)
disabled as booltrue when switched off

Management services

Guide: Management services.

FunctionReturnsNotes
services(c)list of Servicethe fixed list: api, api-ssl, ftp, ssh, telnet, winbox, www, www-ssl
serviceByName(c, name)Serviceunknown name rejected with the valid names
enableService(c, name)unknown name rejected
disableService(c, name)disabling the API service this session uses disconnects it
setServicePort(c, name, port)port 1-65535; a port another service uses is refused, naming it
restrictService(c, name, addresses)IPs and/or CIDRs; "" lifts; applies to new connections
disableInsecureServices(c)intswitches off telnet and ftp; returns how many were on
ConstantValue
SERVICE_PATH"/ip/service"

Service

One management service: a way to log into the router.

FieldMeaning
id as stringinternal RouterOS id
name as stringservice name ("api", "ssh", "winbox", ...)
port as intTCP port it listens on
address as stringnetworks allowed to connect, "" for anywhere
certificate as stringTLS certificate name (ssl services), "" otherwise
invalid as booltrue when misconfigured (e.g. ssl without a certificate); the service is not listening
disabled as booltrue when the service is switched off

SNMP

Guide: SNMP.

FunctionReturnsNotes
snmpSettings(c)SnmpSettingsAgent state, contact and location.
snmpCommunities(c)list of SnmpCommunityAll communities, including a default public.
enableSnmp(c, community, addresses)stringCreates or updates a read-only community (write always off) and switches the agent on. addresses: comma-separated IPs or CIDRs, "" = any source. Idempotent. v2c is cleartext: treat the community as a password.
setSnmpInfo(c, contact, location)-Strings shown by monitoring systems.
disableSnmp(c)-Agent off.
ConstantValue
SNMP_PATH"/snmp"
SNMP_COMMUNITY_PATH"/snmp/community"

SnmpSettings

The SNMP agent settings.

FieldMeaning
enabled as booltrue when the agent answers queries
contact as stringcontact string shown by monitoring systems
location as stringlocation string shown by monitoring systems

SnmpCommunity

One SNMP community: a shared string that grants access.

FieldMeaning
id as stringinternal RouterOS id
name as stringcommunity string; works as a password
addresses as stringnetworks allowed to query, "" for anywhere
readAccess as booltrue when reading is allowed
writeAccess as booltrue when writing is allowed
disabled as booltrue when switched off

Static routes

Guide: Static routes.

FunctionReturnsNotes
routes(c)list of RouteStatic, connected and dynamic routes; filter on dynamic.
addRoute(c, dstAddress, gateway, comment)stringDestination must be CIDR. Gateway: IP address, or the name of an interface on the router.
addRouteWithDistance(c, dstAddress, gateway, distance, comment)stringDistance 1-255, lower wins (static default 1); a higher-distance twin is a backup.
addDefaultRoute(c, gateway, comment)stringRoute to DEFAULT_ROUTE.
removeRoute(c, dstAddress)-First static route whose destination matches exactly; dynamic routes are skipped.
enableRoute(c, dstAddress)-First static route to the destination.
disableRoute(c, dstAddress)-First static route to the destination; kept but unused.
routingRules(c)list of RoutingRulePolicy rules in evaluation order (RouterOS v7).
useRoutingTable(c, srcAddress, table, comment)stringRule with action lookup: unmatched destinations fall back to main. Source: IP or CIDR. Creates the table if missing (it still needs its own default route). Idempotent by source and table.
useRoutingTableOnly(c, srcAddress, table, comment)stringAs useRoutingTable, action lookup-only-in-table: no fallback.
removeRoutingRule(c, srcAddress, table)-Throws when no rule matches source and table.
ConstantValue
ROUTE_PATH"/ip/route"
DEFAULT_ROUTE"0.0.0.0/0"
ROUTING_RULE_PATH"/routing/rule"
ROUTING_TABLE_PATH"/routing/table"

RoutingRule

One policy routing rule: which traffic looks routes up in which table.

FieldMeaning
id as stringinternal RouterOS id
srcAddress as stringmatched source, "" for any
dstAddress as stringmatched destination, "" for any
interfaceName as stringmatched incoming interface, "" for any
action as stringe.g. "lookup" (falls back to main) or "lookup-only-in-table" (no fallback)
table as stringthe routing table consulted
disabled as booltrue when switched off
comment as stringfree-text comment, "" when unset

Route

One route: the next hop for a destination network.

FieldMeaning
id as stringinternal RouterOS id
dstAddress as stringdestination network in CIDR; "0.0.0.0/0" is the default route
gateway as stringnext hop, an IP address or an interface name
distance as stringpreference, lower wins (RouterOS default "1")
routingTable as stringrouting table holding the route, normally "main"
active as booltrue when the route is currently usable
dynamic as booltrue when a protocol or service created it; such routes cannot be removed by hand
disabled as booltrue when the route is switched off
comment as stringfree-text comment, "" when unset

VRRP

Guide: VRRP.

FunctionReturnsNotes
vrrpInterfaces(c)list of VrrpInterfaceAll instances with master/backup state.
vrrpByName(c, name)VrrpInterfaceCheck .master.
setupVrrp(c, name, interfaceName, vrid, priority, virtualAddress)stringInstance plus the shared address (CIDR, /32 by convention). Run on each peer with the same vrid and address and different priorities. Not idempotent.
addVrrp(c, name, interfaceName, vrid, priority)stringInstance only. vrid 1-255, priority 1-254 (255 is reserved by RFC 5798). Rejects a taken name and a vrid already used on that interface.
setVrrpPriority(c, name, priority)-Priority 1-254. Lower it to hand the master role away before maintenance.
removeVrrp(c, name)-Also removes the static addresses on the instance.
enableVrrp(c, name)-Join the group.
disableVrrp(c, name)-Leave the group; the peer takes over.
ConstantValue
VRRP_PATH"/interface/vrrp"

VrrpInterface

One VRRP instance: this router's share of a redundant gateway.

FieldMeaning
id as stringinternal RouterOS id
name as stringVRRP interface name (e.g. "vrrplan")
interfaceName as stringunderlying interface (the shared network)
vrid as intvirtual router id, 1-255, the same on all peers
priority as intpriority, 1-254; the highest becomes master
interval as stringadvertisement interval as reported
version as intVRRP protocol version (2 or 3)
preemption as booltrue when a returning higher-priority peer takes over
running as booltrue when the instance is active
backup as booltrue while standing by
master as boolcomputed as running and not backup: this router answers for the address now
disabled as booltrue when the instance is switched off
comment as stringfree-text comment, "" when unset

WireGuard VPN tunnels

Guide: WireGuard VPN tunnels.

FunctionReturnsNotes
wireguardInterfaces(c)list of WireguardInterfaceRouterOS v7. Any read error gives an empty list (v6, but also a dead connection).
addWireguard(c, name, listenPort)stringRouter generates the keypair. Idempotent by name: an existing interface is returned unchanged.
wireguardPublicKey(c, name)stringBase64 public key for the other side. The private key is never read.
setupWireguardServer(c, name, listenPort, address)stringInterface, VPN address (CIDR) and an input accept rule for the UDP port, comment "wireguard: <name>". Idempotent piece by piece.
wireguardPeers(c)list of WireguardPeerPeers of all interfaces. A handshake within about 2 minutes means alive. Any read error gives an empty list.
addWireguardPeer(c, interfaceName, publicKey, allowedAddress, comment)stringPeer that dials in. Key: 44 base64 characters ending in =. Every allowed-address entry needs a prefix (/32 for one device).
connectWireguard(c, interfaceName, publicKey, endpointHost, endpointPort, allowedAddress, comment)stringPeer the router dials, with 25 s persistent keepalive. Host: IP or DNS name; port 1-65535.
removeWireguardPeerByComment(c, comment)-Throws when no peer carries the comment.
removeWireguard(c, name)-Removes the first IP address on the interface, the "wireguard: <name>" firewall rule, and the interface with its peers.
enableWireguard(c, name)-All tunnels of the interface up.
disableWireguard(c, name)-All tunnels of the interface down.
ConstantValue
WIREGUARD_PATH"/interface/wireguard"
WIREGUARD_PEER_PATH"/interface/wireguard/peers"

WireguardInterface

One WireGuard interface: the local end of one or more tunnels.

FieldMeaning
id as stringinternal RouterOS id
name as stringinterface name (e.g. "wgvpn")
publicKey as stringrouter's public key, to hand to peers
listenPort as intUDP port the router listens on
mtu as stringMTU as reported
running as booltrue when the interface is up
disabled as booltrue when the interface is switched off
comment as stringfree-text comment, "" when unset

WireguardPeer

One WireGuard peer: a remote party allowed through a tunnel.

FieldMeaning
id as stringinternal RouterOS id
interfaceName as stringWireGuard interface the peer belongs to
publicKey as stringthe peer's public key
endpointAddress as stringaddress the router dials, "" when the peer dials in
endpointPort as stringpeer's UDP port, "" or "0" when it dials in
allowedAddress as stringcomma-separated CIDRs accepted from and routed to this peer
keepalive as stringpersistent keepalive as reported, "" when off
lastHandshake as stringtime since the last handshake
rx as stringbytes received from the peer
tx as stringbytes sent to the peer
disabled as booltrue when the peer is switched off
comment as stringfree-text comment, the handle for removal

EoIP tunnels

Guide: EoIP tunnels.

FunctionReturnsNotes
eoipTunnels(c)list of EoipTunnelAll EoIP tunnels.
eoipTunnelByName(c, name)EoipTunnelThrows when absent.
addEoipTunnel(c, name, remoteAddress, tunnelId)stringUnencrypted layer-2 tunnel. Remote must be an IP address; tunnel id 0-65535, equal on both ends. Rejects a taken name and an existing tunnel with the same remote and id.
addSecureEoipTunnel(c, name, remoteAddress, tunnelId, ipsecSecret)stringSame, wrapped in RouterOS coupled IPsec; non-empty secret, same on both ends, never read back.
removeEoipTunnel(c, name)-Detach bridge ports first.
enableEoipTunnel(c, name)-Tunnel up.
disableEoipTunnel(c, name)-Tunnel down; the layer-2 link drops.
ConstantValue
EOIP_PATH"/interface/eoip"

EoipTunnel

One EoIP tunnel: an ethernet link carried over any IP path.

FieldMeaning
id as stringinternal RouterOS id
name as stringtunnel interface name (e.g. "eoipbranch")
remoteAddress as stringother MikroTik's IP address
localAddress as stringsource address, "" for automatic
tunnelId as inttunnel id, the same on both ends
mac as stringtunnel MAC address
mtu as stringMTU as reported
keepalive as stringkeepalive setting as reported
running as booltrue when the tunnel is up
disabled as booltrue when the tunnel is switched off
comment as stringfree-text comment, "" when unset

GRE tunnels

Guide: GRE tunnels.

FunctionReturnsNotes
greTunnels(c)list of GreTunnelAll GRE tunnels.
greTunnelByName(c, name)GreTunnelThrows when no tunnel has that name.
addGreTunnel(c, name, remoteAddress)stringUnencrypted. Remote must be an IP; refuses a taken name or a second tunnel to the same remote (names the owner). Mirror it on the far end.
addSecureGreTunnel(c, name, remoteAddress, ipsecSecret)stringSame, with RouterOS coupled IPsec (ipsec-secret, write-only, same on both ends). Refuses an empty secret.
removeGreTunnel(c, name)Addresses on it go with it; routes through it become unreachable.
enableGreTunnel(c, name)Throws when no tunnel has that name (as do remove/disable).
disableGreTunnel(c, name)Routes through it lose their link.
ConstantValue
GRE_PATH"/interface/gre"

GreTunnel

One GRE tunnel: a routed (layer-3) point-to-point link over IP.

FieldMeaning
id as stringinternal RouterOS id
name as stringtunnel interface name (e.g. "grebranch")
remoteAddress as stringthe other router's IP address
localAddress as stringour source address, "" for automatic
mtu as stringMTU as reported
keepalive as stringkeepalive setting as reported
running as booltrue when the tunnel is up
disabled as booltrue when the tunnel is switched off
comment as stringcomment, "" when unset

IPsec

Guide: IPsec.

FunctionReturnsNotes
ipsecPeers(c)list of IpsecPeerConfigured peers.
ipsecPolicies(c)list of IpsecPolicyPer-policy active flag (live SA).
ipsecActive(c)list of IpsecActivePeerLive negotiations; check established.
setupIpsecTunnel(c, name, peerAddress, psk, localSubnet, remoteSubnet)stringIKEv2 peer, PSK identity, tunnel policy, srcnat bypass above masquerade, input accepts for udp 500/4500 and ESP. Far end mirrors it (same PSK, subnets swapped). Existing peer name: returns its id, changes nothing.
teardownIpsecTunnel(c, name)Removes all of the above; throws when none of it exists.
setupIkev2Server(c, name, certificate, poolRange, dns)stringRoad-warrior server: pool, mode-config, passive IKEv2 peer, eap-radius identity with the router certificate, input accepts. Users come from RADIUS. Throws on an existing peer name or missing certificate. See vpn.md.
ConstantValue
IPSEC_PEER_PATH"/ip/ipsec/peer"
IPSEC_IDENTITY_PATH"/ip/ipsec/identity"
IPSEC_POLICY_PATH"/ip/ipsec/policy"
IPSEC_ACTIVE_PATH"/ip/ipsec/active-peers"
IPSEC_MODE_CONFIG_PATH"/ip/ipsec/mode-config"

IpsecPeer

One configured IPsec peer (the remote router).

FieldMeaning
id as stringinternal RouterOS id
name as stringpeer name, the handle identity and policy refer to
address as stringremote router's address or DNS name
exchangeMode as string"ike2" for peers this deck creates
disabled as booltrue when switched off

IpsecPolicy

One IPsec policy: which traffic is encrypted to which peer.

FieldMeaning
id as stringinternal RouterOS id
peer as stringpeer name
srcAddress as stringlocal subnet
dstAddress as stringremote subnet
tunnel as booltrue for tunnel mode (site-to-site)
active as booltrue when the policy has a live SA
disabled as booltrue when switched off

IpsecActivePeer

One live IPsec negotiation with a remote router.

FieldMeaning
remoteAddress as stringthe other end
state as stringnegotiation state as reported
established as boolcomputed: state equals "established"
uptime as stringtime since the tunnel came up
side as string"initiator" or "responder"

L2TP

Guide: Remote-access VPN.

FunctionReturnsNotes
l2tpServerStatus(c)L2tpServeruseIpsec is false for use-ipsec=no or unset.
enableL2tpServer(c, ipsecSecret)Requires IPsec with this PSK (refuses an empty one); opens udp 1701, 500, 4500 and ESP. Idempotent.
disableL2tpServer(c)Also removes its firewall accepts.
l2tpClients(c)list of L2tpClientDial-out tunnels.
addL2tpClient(c, name, serverAddress, user, password)stringThrows on an empty or spaced name or user, empty password, or empty or spaced server. Existing name: returns its id.
removeL2tpClient(c, name)Throws when no client has that name.
ConstantValue
L2TP_SERVER_PATH"/interface/l2tp-server/server"
L2TP_CLIENT_PATH"/interface/l2tp-client"

L2tpServer

The L2TP server settings.

FieldMeaning
enabled as booltrue when the server accepts connections
useIpsec as booltrue when use-ipsec is anything but "no" (or unset)
defaultProfile as stringPPP profile applied to logins

L2tpClient

One L2TP client: this router dialing out to an L2TP server.

FieldMeaning
id as stringinternal RouterOS id
name as stringclient interface name
connectTo as stringserver address
user as stringlogin on the server
running as booltrue when the tunnel is up
disabled as booltrue when switched off
comment as stringcomment, "" when unset

SSTP

Guide: Remote-access VPN.

FunctionReturnsNotes
sstpServerStatus(c)SstpServerPort, certificate, profile.
enableSstpServer(c, certificate, port)TLS over TCP; 443 looks like HTTPS. Certificate must exist. Opens the port. Idempotent.
disableSstpServer(c)Also removes its firewall accept.
sstpClients(c)list of SstpClientDial-out tunnels.
addSstpClient(c, name, serverAddress, user, password)stringThrows on an empty or spaced name or user, empty password, or empty or spaced server. Existing name: returns its id. Sets verify-server-certificate=no.
removeSstpClient(c, name)Throws when no client has that name.
ConstantValue
SSTP_SERVER_PATH"/interface/sstp-server/server"
SSTP_CLIENT_PATH"/interface/sstp-client"

SstpServer

The SSTP server settings.

FieldMeaning
enabled as booltrue when the server accepts connections
port as intTCP port it listens on (443 by default)
certificate as stringTLS certificate it serves
defaultProfile as stringPPP profile applied to logins

SstpClient

One SSTP client: this router dialing out to an SSTP server.

FieldMeaning
id as stringinternal RouterOS id
name as stringclient interface name
connectTo as stringserver address
user as stringlogin on the server
running as booltrue when the tunnel is up
disabled as booltrue when switched off
comment as stringcomment, "" when unset

OpenVPN

Guide: Remote-access VPN.

FunctionReturnsNotes
ovpnServerStatus(c)OvpnServerPort, mode, certificate, profile.
enableOvpnServer(c, certificate, port)Routed (mode=ip), TCP; 1194 is the usual port. Certificate must exist. Opens the port. Idempotent.
disableOvpnServer(c)Also removes its firewall accept.
ovpnClients(c)list of OvpnClientDial-out tunnels.
addOvpnClient(c, name, serverAddress, user, password)stringThrows on an empty or spaced name or user, empty password, or empty or spaced server. Existing name: returns its id.
removeOvpnClient(c, name)Throws when no client has that name.
ConstantValue
OVPN_SERVER_PATH"/interface/ovpn-server/server"
OVPN_CLIENT_PATH"/interface/ovpn-client"

OvpnServer

The OpenVPN server settings.

FieldMeaning
enabled as booltrue when the server accepts connections
port as intTCP port it listens on (1194 by default)
mode as string"ip" (routed, tun) or "ethernet" (bridged, tap)
certificate as stringTLS certificate it serves
defaultProfile as stringPPP profile applied to logins

OvpnClient

One OpenVPN client: this router dialing out to an OpenVPN server.

FieldMeaning
id as stringinternal RouterOS id
name as stringclient interface name
connectTo as stringserver address
user as stringlogin on the server
running as booltrue when the tunnel is up
disabled as booltrue when switched off
comment as stringcomment, "" when unset

Simple queues

Guide: Simple queues.

FunctionReturnsNotes
simpleQueues(c)list of SimpleQueuemax-limit already split into maxUpload / maxDownload.
limitBandwidth(c, name, target, upload, download)stringTarget: address, CIDR, interface (checked on the router) or a comma-separated mix. Upload = from the target. Rates "10M", "512k", "1G", bits/s, "0" = unlimited; normalized locally.
setBandwidthLimit(c, name, upload, download)Same rate rules.
removeSimpleQueue(c, name)Throws when no queue has that name (as do enable/disable).
enableSimpleQueue(c, name)
disableSimpleQueue(c, name)The limit pauses until enabled.
treeQueues(c)list of TreeQueueAll tree nodes.
addQueueTreeRoot(c, name, parent, maxLimit)stringParent: an interface (its egress) or "global". Set the budget slightly below the line rate. Existing name: returns its id.
addQueueTreeChild(c, name, parentName, packetMark, limitAt, maxLimit, priority)stringPriority 1-8 (1 first). Refuses an unknown parent or a packet mark no mangle rule sets. Existing name: returns its id.
removeTreeQueue(c, name)Removes the whole subtree, children first.
enableTreeQueue(c, name)
disableTreeQueue(c, name)Its subtree stops shaping.
ConstantValue
QUEUE_SIMPLE_PATH"/queue/simple"
QUEUE_TREE_PATH"/queue/tree"

SimpleQueue

One simple queue: a bandwidth limit on a target.

FieldMeaning
id as stringinternal RouterOS id
name as stringqueue name
target as stringlimited address, network or interface, comma-separated
maxUpload as stringupload ceiling (e.g. "10M", "0" = unlimited)
maxDownload as stringdownload ceiling (e.g. "20M", "0" = unlimited)
dynamic as booltrue when created by something else (e.g. PPPoE)
disabled as booltrue when the queue is switched off
comment as stringcomment, "" when unset

TreeQueue

One queue-tree node: a branch of the QoS hierarchy.

FieldMeaning
id as stringinternal RouterOS id
name as stringnode name
parent as stringan interface, "global", or another node's name
packetMark as stringmangle packet mark(s) served, "" on inner nodes
limitAt as stringguaranteed rate ("" = none)
maxLimit as stringceiling rate ("" = unlimited)
priority as int1 (first served) to 8 (last), 0 when unset
disabled as booltrue when switched off
comment as stringcomment, "" when unset

Traffic flow (NetFlow / IPFIX)

Guide: Traffic flow (NetFlow / IPFIX).

FunctionReturnsNotes
trafficFlowStatus(c)TrafficFlowSettingsEnabled flag and accounted interfaces.
flowTargets(c)list of FlowTargetThe collectors.
enableTrafficFlow(c)All interfaces. Exports nothing until a target exists.
disableTrafficFlow(c)Targets are kept.
addFlowTarget(c, address, port, version)stringCollector must be an IP; version "1", "5", "9" or "ipfix". Existing address and port: returns its id.
removeFlowTarget(c, address)First target with that address; throws when none.
ConstantValue
TRAFFIC_FLOW_PATH"/ip/traffic-flow"
TRAFFIC_FLOW_TARGET_PATH"/ip/traffic-flow/target"

TrafficFlowSettings

The traffic-flow (NetFlow/IPFIX) settings.

FieldMeaning
enabled as booltrue when flow accounting is running
interfaces as stringaccounted interfaces, "all" for every one

FlowTarget

One traffic-flow export target (a collector).

FieldMeaning
id as stringinternal RouterOS id
address as stringcollector address
port as stringcollector UDP port
version as stringexport protocol version ("1", "5", "9", "ipfix")
disabled as booltrue when switched off

Netwatch

Guide: Netwatch.

FunctionReturnsNotes
netwatchHosts(c)list of NetwatchHostEvery watched host with state.
watchHost(c, host, comment)stringReturns the id. Router default interval. Idempotent per host: an existing entry is returned unchanged.
watchHostWith(c, host, interval, comment)stringAs watchHost with a probe interval ("10s", "1m", "HH:MM:SS").
watchHostScripted(c, host, downScript, upScript, comment)stringRouterOS scripts run on each down / up transition; at least one required. Idempotent like watchHost.
hostStatus(c, host)NetwatchHostThrows routeros when the host is not watched.
downHosts(c)list of NetwatchHostHosts with status "down"; "unknown" (not probed yet) is excluded.
unwatchHost(c, host)Removes the entry.
disableWatch(c, host)Pauses; entry and scripts kept.
enableWatch(c, host)Resumes a paused watch.
ConstantValue
NETWATCH_PATH"/tool/netwatch"

NetwatchHost

One watched host and its current state.

FieldMeaning
id as stringRouterOS item id
host as stringwatched address
status as string"up", "down", or "unknown" (not probed yet)
up as boolcomputed: whether status is "up"
since as stringwhen the current state began, as RouterOS prints it
interval as stringtime between probes, as RouterOS prints it
timeout as stringprobe timeout, as RouterOS prints it
upScript as stringRouterOS script run when the host comes up, "" for none
downScript as stringRouterOS script run when the host goes down, "" for none
disabled as boolwhether the watch is switched off
comment as stringfree-text comment, "" when unset

System

Guide: System.

FunctionReturnsNotes
systemInfo(c)SystemInfoversion, board, architecture, uptime, CPU load, memory; strings as reported
identity(c)stringthe router name
setIdentity(c, name)rejects an empty name
packages(c)list of Packageinstalled packages
checkForUpdates(c)UpdateStatusread-only; needs internet and DNS on the router; check updateAvailable
downloadUpdates(c)UpdateStatusdownloads now, installs on the next reboot; blocks until done
installUpdates(c)downloads, installs and reboots; the client is dead afterwards
routerboard(c)Routerboardmodel and boot firmware; check upgradeAvailable
upgradeRouterboard(c)stages the firmware flash; takes effect on the next reboot
reboot(c)connection drop swallowed, router refusal re-thrown (kind "mikrotik")
shutdown(c)as reboot; powering on again needs physical access
deviceMode(c)DeviceModemode and the features it gates (scheduler, fetch, e-mail, container)
updateDeviceMode(c, mode)only pending: applied on a power cycle or reset-button press within minutes, not on reboot; DEVICE_MODE_* only
ConstantValue
SYSTEM_PACKAGE_PATH"/system/package"
SYSTEM_UPDATE_PATH"/system/package/update"
SYSTEM_ROUTERBOARD_PATH"/system/routerboard"
SYSTEM_RESOURCE_PATH"/system/resource"
SYSTEM_IDENTITY_PATH"/system/identity"
DEVICE_MODE_PATH"/system/device-mode"
DEVICE_MODE_UPDATE_COMMAND"/system/device-mode/update"
DEVICE_MODE_HOME"home"
DEVICE_MODE_ADVANCED"advanced"
DEVICE_MODE_ENTERPRISE"enterprise"

Package

One installed RouterOS software package.

FieldMeaning
id as stringinternal RouterOS id
name as stringpackage name (e.g. "routeros", "wireless")
version as stringinstalled version (e.g. "7.15.2")
disabled as booltrue when the package is disabled

UpdateStatus

The state of the RouterOS package updater.

FieldMeaning
channel as stringrelease channel ("stable", "testing", ...)
installedVersion as stringthe RouterOS version running now
latestVersion as stringthe newest version the channel offers, "" when unknown
status as stringthe updater's own status text
updateAvailable as booltrue when a newer version can be installed

Routerboard

The routerboard: the hardware and its boot firmware.

FieldMeaning
model as stringhardware model (e.g. "RB4011iGS+")
serialNumber as stringhardware serial number
firmwareType as stringfirmware family (e.g. "al2")
currentFirmware as stringfirmware version running now
upgradeFirmware as stringfirmware version available to flash
upgradeAvailable as booltrue when upgradeRouterboard would change anything

SystemInfo

The router's software version, hardware and load.

FieldMeaning
version as stringRouterOS version (e.g. "7.15.2 (stable)")
boardName as stringboard name (e.g. "RB4011iGS+")
architecture as stringCPU architecture (e.g. "arm64")
uptime as stringtime since the last boot (e.g. "2w3d4h5m6s")
cpuLoad as stringcurrent CPU load in percent
freeMemory as stringfree RAM in bytes
totalMemory as stringtotal RAM in bytes

DeviceMode

The router's device mode and the features it gates.

FieldMeaning
mode as stringthe active mode ("home" / "advanced" / "enterprise")
flaggingEnabled as booltrue when tamper flagging is on
container as booltrue when containers may run
scheduler as booltrue when the scheduler may run scripts
fetch as booltrue when /tool/fetch is allowed
email as booltrue when the router may send e-mail
socks as booltrue when the SOCKS proxy is allowed
installAnyVersion as booltrue when downgrades are permitted

Clock & NTP

Guide: Clock & NTP.

FunctionReturnsNotes
clock(c)Clocktime, date, timezone, UTC offset
setTimezone(c, timezone)IANA name or "UTC"; turns timezone autodetect off
useNtp(c, servers)comma-separated DNS names or IPs; empty or spaced entries rejected
disableNtp(c)the clock free-runs and resets at boot
ntpStatus(c)NtpStatussynced is true when the status is "synchronized"
ConstantValue
CLOCK_PATH"/system/clock"
NTP_CLIENT_PATH"/system/ntp/client"

Clock

The router's clock state.

FieldMeaning
time as stringcurrent time as reported
date as stringcurrent date as reported
timezone as stringtimezone name (e.g. "Europe/Berlin")
autodetect as booltrue when the router guesses the timezone
gmtOffset as stringthe resulting UTC offset as reported

NtpStatus

The NTP client state.

FieldMeaning
enabled as booltrue when the router syncs its clock
servers as stringthe configured NTP servers, comma-separated
status as stringthe sync state as reported
synced as boolcomputed: the status equals "synchronized"

Router users

Guide: Router users.

FunctionReturnsNotes
users(c)list of Userall accounts; passwords are never returned
userGroups(c)list of UserGroupbuilt-in and custom groups with their policies
activeUsers(c)list of UserSessionlive sessions: who, from where, via what
addUser(c, name, password, group)stringgroup must exist, name must not; password non-empty and write-only
setUserPassword(c, name, password)existing sessions stay alive; empty password rejected
setUserGroup(c, name, group)refuses the session's own account; group must exist
restrictUser(c, name, addresses)IPs and/or CIDRs, comma-separated; "" lifts; applies to new logins
removeUser(c, name)refuses the session's own account
enableUser(c, name)unknown user rejected
disableUser(c, name)refuses the session's own account
ConstantValue
USER_PATH"/user"
USER_GROUP_PATH"/user/group"
USER_ACTIVE_PATH"/user/active"
GROUP_FULL"full"
GROUP_READ"read"
GROUP_WRITE"write"

User

One router user account.

FieldMeaning
id as stringinternal RouterOS id
name as stringlogin name
group as stringpermission group ("full", "read", "write", or custom)
address as stringnetworks the user may log in from, "" for anywhere
lastLoggedIn as stringlast login time as reported, "" for never
disabled as booltrue when the account is switched off
comment as stringfree-text comment, "" when unset

UserGroup

One user group: a named bundle of permissions (policies).

FieldMeaning
id as stringinternal RouterOS id
name as stringgroup name
policy as stringcomma-separated policies ("read,write,api,...")

UserSession

One active login session on the router.

FieldMeaning
name as stringthe logged-in user
address as stringwhere the login came from, "" for console
via as stringhow ("api", "ssh", "winbox", "console", ...)
when as stringwhen the session started, as reported

Certificates

Guide: Certificates.

FunctionReturnsNotes
certificates(c)list of Certificatethe whole store
certificateByName(c, name)Certificateunknown name rejected
expiringCertificates(c, withinDays)list of Certificateexpiry within withinDays; durations like "51w6d" parsed to whole days, unparseable ones skipped
generateSelfSigned(c, name, commonName, days)stringsigned on the router (a few seconds); days 1-7300; name must be free
enableLetsEncrypt(c, dnsName)RouterOS v7 built-in ACME (http-01); port 80 must be reachable under the name; blocks
importCertificatePem(c, name, certPem, keyPem)via temporary <name>.crt / <name>.key files, removed afterwards; PEMs checked for BEGIN CERTIFICATE / PRIVATE KEY
assignServiceCertificate(c, serviceName, certName)"api-ssl" or "www-ssl" only; clears the invalid flag
removeCertificate(c, name)services using it go invalid
ConstantValue
CERTIFICATE_PATH"/certificate"

Certificate

One certificate in the router's store.

FieldMeaning
id as stringinternal RouterOS id
name as stringstore name (the handle everything binds to)
commonName as stringthe subject CN (usually the DNS name)
issuer as stringwho signed it, "" for a template not yet signed
expiresAfter as stringtime until expiry as reported (e.g. "51w6d")
invalidAfter as stringthe absolute expiry date as reported
hasPrivateKey as booltrue when the router holds the key (usable for serving)
trusted as booltrue when marked trusted
isCa as booltrue for a CA certificate

Files & backups

Guide: Files & backups.

FunctionReturnsNotes
files(c)list of RouterFilefiles and directories on the router's storage
saveBackup(c, name)writes <name>.backup, checks it appeared; unencrypted, holds secrets
saveBackupWith(c, name, password)encrypted; empty password rejected; checks the file appeared
readFileText(c, name)stringsmall files only (a few KB); "" when too large to expose
writeFileText(c, name, contents)creates or overwrites; RouterOS v7
removeFile(c, name)unknown file rejected
ConstantValue
FILE_PATH"/file"

RouterFile

One file on the router's storage.

FieldMeaning
name as stringfile name (with extension, e.g. "nightly.backup")
kind as stringfile type as reported ("backup", ".txt file", "directory", ...)
size as intsize in bytes
creationTime as stringwhen it was created, as reported

Disks

Guide: Disks.

FunctionReturnsNotes
disks(c)list of Diskempty when there is no storage or the read fails
diskByName(c, name)Diskmatches name, then slot
formatDisk(c, name, filesystem, label)erases the whole disk, no undo; ext4, fat32, exfat, btrfs, vfat; tries /disk/format, falls back to /disk/format-drive
ejectDisk(c, name)matches name, then slot
ConstantValue
DISK_PATH"/disk"

Disk

One storage device attached to the router.

FieldMeaning
id as stringinternal RouterOS id
name as stringthe device name (e.g. "usb1", "nvme1"), from slot when unnamed
model as stringthe disk model / label as reported
kind as stringthe device type as reported ("hardware", "partition", "raid", ...)
fs as stringthe filesystem ("ext4", "fat32", "", ...)
sizeBytes as inttotal capacity in bytes (0 when not reported)
freeBytes as intfree space in bytes (0 when not reported)
slot as stringthe physical slot / interface as reported

System health

Guide: System health.

FunctionReturnsNotes
healthSensors(c)list of HealthSensormodel-dependent; an empty list is normal
healthValue(c, name)stringthe reading, "" when the router does not report it
ConstantValue
SYSTEM_HEALTH_PATH"/system/health"

HealthSensor

One hardware health sensor reading.

FieldMeaning
name as stringwhat is measured ("cpu-temperature", "voltage", "fan1-speed", "temperature", ...)
value as stringthe reading as reported (units vary by sensor)
kind as stringthe reading type ("C", "V", "RPM", ...) when reported

The router log

Guide: The router log.

FunctionReturnsNotes
logEntries(c)list of LogEntryThe memory buffer, oldest first; 1000 entries by default, cleared on reboot.
recentLogEntries(c, count)list of LogEntryNewest count (at least 1), oldest of them first.
logEntriesWithTopic(c, topic)list of LogEntryExact topic word: "fire" does not match "firewall".
logErrors(c)list of LogEntryTopic "error" or "critical".
loggingRules(c)list of LoggingRuleWhich topics go to which action.
addLoggingRule(c, topics, action)stringReturns the id. Topics comma-separated, "!" negates; the action must exist. Idempotent.
removeLoggingRule(c, topics, action)Topics compared in order after normalization.
setupRemoteLogging(c, address, port, topics)stringReturns the rule id. Repoints the built-in "remote" action (UDP syslog, 514 standard). Idempotent.
ConstantValue
LOG_PATH"/log"
LOGGING_PATH"/system/logging"
LOGGING_ACTION_PATH"/system/logging/action"

LogEntry

One log entry.

FieldMeaning
id as stringRouterOS item id
time as stringtime as RouterOS prints it, e.g. "15:33:02"; older entries carry a date prefix
topics as stringcomma-separated topics, e.g. "system,info"
message as stringthe log line

LoggingRule

One logging rule: which topics go to which action.

FieldMeaning
id as stringRouterOS item id
topics as stringcomma-separated topics matched, e.g. "info,!dns"
action as string"memory", "disk", "echo", "remote", or a custom action
prefix as stringtext prepended to each entry, "" when unset
disabled as boolwhether the rule is switched off

Scripts (the repository)

Guide: Scripts (the repository).

FunctionReturnsNotes
scripts(c)list of ScriptEvery stored script.
scriptByName(c, name)ScriptThrows routeros when absent.
addScript(c, name, source, comment)stringReturns the id. Source is RouterOS script, must not be blank; name must be free (else use updateScript).
updateScript(c, name, source)Replaces the source of an existing script.
runScript(c, name)stringRuns with the script's own policies; returns its return value or "". Script errors are mikrotik.
removeScript(c, name)Scheduler entries that call it by name then fail.
ConstantValue
SCRIPT_PATH"/system/script"

Script

One stored RouterOS script.

FieldMeaning
id as stringRouterOS item id
name as stringscript name, the handle the scheduler and netwatch use
source as stringRouterOS script source
policy as stringcomma-separated permissions it runs with
runCount as intnumber of runs so far
lastStarted as stringtime of the last run, as RouterOS prints it
comment as stringfree-text comment, "" when unset

Scheduler

Guide: Scheduler.

FunctionReturnsNotes
scheduledTasks(c)list of ScheduledTaskEvery task, with nextRun and runCount.
scheduleScript(c, name, interval, source)stringReturns the id. Interval "30s", "10m", "2h", "1d", "1w", "1d12h", bare seconds, or "HH:MM:SS". Runs with the policies of the client user.
scheduleDaily(c, name, startTime, source)stringReturns the id. Router-local "HH:MM:SS", interval 1d.
scheduleAtStartup(c, name, source)stringReturns the id. Runs once per boot.
removeScheduledTask(c, name)By task name.
enableScheduledTask(c, name)By task name.
disableScheduledTask(c, name)Kept configured, stops firing.
ConstantValue
SCHEDULER_PATH"/system/scheduler"

ScheduledTask

One scheduler entry: a script the router runs on a timer.

FieldMeaning
id as stringRouterOS item id
name as stringtask name
startTime as string"HH:MM:SS" or "startup"
startDate as stringfirst day the timer is armed, as RouterOS prints it
interval as stringtime between runs ("1d", "00:30:00"; "0" runs once)
onEvent as stringRouterOS script source, or the name of a "/system/script"
nextRun as stringnext firing time, as RouterOS prints it
runCount as intnumber of runs so far
disabled as boolwhether the task is switched off
comment as stringfree-text comment, "" when unset

Tools

Guide: Tools.

FunctionReturnsNotes
ping(c, host)PingResult4 probes. Host is an IP or DNS name.
pingWith(c, host, count)PingResult1-100 probes; a count is always sent because an unbounded RouterOS ping never returns.
isReachable(c, host)boolping(...).reachable.
bandwidthTest(c, host, seconds, direction)BandwidthResultAgainst a btest server; 1-300 s; "receive", "transmit" or "both". Saturates the link.
bandwidthTestWith(c, host, seconds, direction, user, password)BandwidthResultAs bandwidthTest, with btest credentials ("" omits).
traceroute(c, host)list of TracerouteHopOne probe per hop.
fetchUrl(c, url)FetchResultURL must start with "http"; body in data.
downloadFile(c, url, fileName)FetchResultSaves to router storage; file name without spaces.
configureEmail(c, server, port, from, user, password)Leaves the TLS mode unchanged; empty user / password are not sent.
configureEmailWith(c, server, port, from, user, password, tls)tls is an EMAIL_TLS_* value or "" to keep it. Writes the pre-7.12 or 7.12+ property names, whichever the router has.
emailSettings(c)EmailSettingsNo password: RouterOS stores it write-only.
sendEmail(c, recipient, subject, body)Needs configureEmail first. SMTP failure is mikrotik.
ConstantValue
PING_COMMAND"/ping"
TRACEROUTE_COMMAND"/tool/traceroute"
FETCH_COMMAND"/tool/fetch"
EMAIL_PATH"/tool/e-mail"
EMAIL_TLS_NONE"no"
EMAIL_TLS_STARTTLS"starttls"
EMAIL_TLS_IMPLICIT"yes"
BANDWIDTH_TEST_COMMAND"/tool/bandwidth-test"

EmailSettings

The router's outgoing e-mail (SMTP) settings.

FieldMeaning
server as stringSMTP server, DNS name or IP, "" when unset
port as intSMTP port, 0 when unset
from as stringFrom: address
user as stringSMTP login, "" when the relay needs none
tls as stringone of the EMAIL_TLS_* values

PingResult

The outcome of a ping from the router.

FieldMeaning
host as stringhost that answered, usually the target
sent as intprobes sent
received as intreplies received
packetLoss as intloss in percent, 0 when every reply arrived
minRtt as stringfastest round trip as RouterOS prints it, e.g. "1ms52us"
avgRtt as stringaverage round trip as RouterOS prints it
maxRtt as stringslowest round trip as RouterOS prints it
reachable as boolcomputed: whether at least one reply arrived

BandwidthResult

The outcome of a bandwidth test.

FieldMeaning
status as stringfinal tester status, "done testing" on success
direction as string"receive", "transmit" or "both"
txCurrent as stringtransmit rate at the end of the test
txAverage as stringaverage transmit rate over the test
rxCurrent as stringreceive rate at the end of the test
rxAverage as stringaverage receive rate over the test
lostPackets as intpackets lost during the test

TracerouteHop

One hop on a traceroute path.

FieldMeaning
address as stringhop address, "" when it did not answer
loss as stringpacket loss at this hop, as RouterOS prints it
avgRtt as stringaverage round trip to this hop, "" when no reply
status as stringhop status, as RouterOS prints it

FetchResult

The outcome of a router-side fetch.

FieldMeaning
status as string"finished" on success, else the failure text
ok as boolcomputed: whether status is "finished"
downloaded as stringamount downloaded, as RouterOS prints it
data as stringresponse body; only fetchUrl fills it

Containers

Guide: Containers.

FunctionReturnsNotes
containers(c)list of ContainerEvery container; name is the comment addContainer set.
addContainer(c, name, remoteImage, interfaceName, rootDir)stringReturns the id. Needs the container package, device-mode enable, an existing veth and storage. name is stored as the comment.
startContainer(c, name)By comment or image tag.
stopContainer(c, name)By comment or image tag.
removeContainer(c, name)Also deletes its extracted filesystem.
containerEnvs(c)list of ContainerEnvVariables of every env list.
addContainerEnv(c, listName, key, value)stringReturns the id. Always adds; clear the list first on a re-run.
removeContainerEnvList(c, listName)intDeletes every variable in the list; returns the count.
containerMounts(c)list of ContainerMountMounts of every mount list.
addContainerMount(c, listName, src, dst)stringReturns the id. src on the router (created if missing), dst in the container.
removeContainerMountList(c, listName)intDeletes every mount in the list; returns the count.
setContainerEnvLists(c, name, listNames)Replaces the attached lists; [] detaches all. Takes effect at the next start.
setContainerMountLists(c, name, listNames)Replaces the attached lists; [] detaches all. Set before the first start.
ConstantValue
CONTAINER_PATH"/container"
CONTAINER_ENVS_PATH"/container/envs"
CONTAINER_MOUNTS_PATH"/container/mounts"
CONTAINER_CONFIG_PATH"/container/config"

Container

One container on the router.

FieldMeaning
id as stringRouterOS item id
name as stringthe comment addContainer set, else the image tag
tag as stringimage tag it runs
status as string"running", "stopped", "extracting", "error", ...; derived from running when the router sends no status
running as boolwhether the container is up
interfaceName as stringveth interface it attaches to
rootDir as stringpath of its filesystem on the router
envLists as stringcomma-separated env lists, "" for none
mountLists as stringcomma-separated mount lists, "" for none

ContainerEnv

One environment variable belonging to a named env list.

FieldMeaning
id as stringRouterOS item id
listName as stringenv list it belongs to
key as stringvariable name, e.g. "TZ"
value as stringvariable value

ContainerMount

One mount belonging to a named mount list.

FieldMeaning
id as stringRouterOS item id
listName as stringmount list it belongs to
src as stringpath on the router's storage
dst as stringpath inside the container

Cloud DDNS

Guide: Cloud DDNS.

FunctionReturnsNotes
cloudStatus(c)CloudStatusDDNS flag, name, last seen public address, update time.
enableCloudDns(c)Turns DDNS on and forces an update; the name resolves within about a minute.
disableCloudDns(c)The name stops following the public address.
routerDnsName(c)string<serial>.sn.mynetname.net; throws routeros until assigned.
ConstantValue
CLOUD_PATH"/ip/cloud"

CloudStatus

MikroTik Cloud DDNS state.

FieldMeaning
ddnsEnabled as boolwhether the router keeps its cloud name updated
dnsName as string<serial>.sn.mynetname.net, "" until the first update completes
publicAddress as stringthe public address MikroTik's servers last saw
updateTime as stringtime of the last update, as RouterOS prints it

SMS

Guide: SMS.

FunctionReturnsNotes
smsSettings(c)SmsSettingsCurrent SMS settings.
enableSmsReceive(c, port)Reception is off by default; port is the modem port, e.g. "lte1".
disableSmsReceive(c)Stops reception; the inbox is kept.
restrictSms(c, allowedNumber, keepMaxSms)Sender accepted for SMS commands ("" = anyone) and inbox cap 1-100. Set it: unrestricted SMS commands are unauthenticated.
sendSms(c, port, phoneNumber, message)Leaves over the modem when the wired uplink is down. Number: digits, + - ( ), spaces. Modem refusal is mikrotik.
smsInbox(c)list of SmsMessageReceived messages; empty until reception is enabled.
removeSmsMessage(c, id)Deletes one message by id.
clearSmsInbox(c)intDeletes every message; returns the count.
ConstantValue
SMS_PATH"/tool/sms"
SMS_INBOX_PATH"/tool/sms/inbox"
SMS_SEND_COMMAND"/tool/sms/send"

SmsSettings

The router's SMS settings.

FieldMeaning
receiveEnabled as boolwhether incoming messages are stored
port as stringmodem port, e.g. "lte1"
channel as stringmodem channel, "" for the default
allowedNumber as stringthe only sender accepted for remote commands, "" when unrestricted
keepMaxSms as intcap on stored received messages
autoErase as boolwhether the oldest message is dropped at the cap

SmsMessage

One received text message.

FieldMeaning
id as stringRouterOS item id
phone as stringsender's number
message as stringmessage text
timestamp as stringreceive time, as RouterOS prints it
kind as stringRouterOS type value, "" when absent

Layout and tests

src/routeros.j        the module: use/import lines and one include per topic
src/routeros_test.j   the test overlay: use testing and one include per topic
src/topics/           T.j and T_test.j for each topic
docs/                 one guide per topic
examples/             one read-only example per topic

include is a textual splice: src/routeros.j is the only module and holds every export, so consumers import @deckyard/routeros/ and never a topic file.

sh
jennifer test src/routeros_test.j

The tests need no router: they cover validators, reply-row folding, builders and redaction, and call each verb that validates input on a never-connected client to check it rejects bad input before any I/O.