#!/bin/bash HOST="192.168.88.1" USER="admin" PASS="" PORT=8729
| CLI Command | API Path | Action | | :--- | :--- | :--- | | /ip address print | /ip/address/print | Retrieve IP addresses | | /system reboot | /system/reboot | Reboot the device | | /ping 8.8.8.8 | /ping + =address=8.8.8.8 | Execute a ping | mikrotik api examples
// Authenticate and create a new user $auth = base64_encode("$username:$password"); $headers = array( 'Authorization: Basic ' . $auth, 'Content-Type: application/json' ); Responses are similarly structured, ending with
curl — add address (POST)
There are several libraries and tools available that support the Mikrotik API, including: Responses are similarly structured
MikroTik RouterOS API (port 8728, or 8729 for TLS) uses a simple line‑based, synchronous protocol. Each command is sent as a set of key=value pairs followed by an empty line. Responses are similarly structured, ending with !done or !trap (error).