Mikrotik Api | Examples

This guide covers using the MikroTik RouterOS API (the binary/API or the REST-like RouterOS API depending on RouterOS version) and includes examples in three common languages: Python, Go, and curl (REST API). Assumes RouterOS v6+ (API) or RouterOS v7+ (REST API available). Use username/password with an account that has API access; enable the API service in IP > Services if needed.

import mikrotik

# Create a new user user = api.get_resource('/system/user').add( name='newuser', password='newpassword', group='admin' ) mikrotik api examples