Skip to main content

Overview

API key installation is ideal for automated deployments or provisioning multiple devices. Unlike the dashboard installation method, which requires manual interaction with the web interface for each device, API key installation allows you to:
  • Provision multiple devices at scale without manual intervention
  • Integrate with existing infrastructure management tools and workflows
  • Use in headless environments where a web browser isn’t available

Create the API Key

Navigate to the API Keys page in the dashboard and click New API Key in the top right corner. Give the key a descriptive name and select the devices:provision scope.
Finally, click Create to generate the key.
Copy your API key immediately after creation. Once you navigate away from this page, the key cannot be retrieved again.

Install

Set the API Key

Open a terminal on the device where you want to install the Miru Agent and set the MIRU_API_KEY environment variable.
export MIRU_API_KEY=<your-api-key>

Provision the Device

Execute the provision script, which will create and activate a device using your API key.
curl -fsSL https://raw.githubusercontent.com/miruml/agent/main/scripts/install/provision.sh | sh -s -- \
  --device-name=$HOSTNAME \
  --allow-reactivation=true
The provision script performs the following actions.
  1. Creates the device - optionally creates a new device in the Miru dashboard if a device with the provided name doesn’t already exist
  2. Downloads the agent - fetches the latest Miru Agent debian package
  3. Installs the service - installs the agent as a systemd service
  4. Activates the device - registers the agent with Miru servers using the activation token

Script Parameters

The provision script supports the following parameters to tune your installation. For example, you may want to provided the device name or hardset the version of the agent to install.
--device-name
string
default:"$HOSTNAME"
The name of the device in the Miru dashboard.
--allow-reactivation
boolean
default:false
Allows reactivation of existing devices. Without this flag, only inactive devices can be activated. With this flag, devices which have been previously activated (status online, offline, etc.) may be reactivated.
--version
string
Specific agent version to install (e.g., v0.6.0). Defaults to the latest release. See all available versions.
--from-pkg
string
The file path to the Miru Agent debian package to use for installation. Useful for installing the agent in poor connectivity scenarios.

Verify Installation

Upon successful installation, you’ll see a confirmation message in the terminal.
==> Successfully activated this device as Robot A!
Navigate back to the Devices page to verify the installation. Your device will briefly be Activating before transitioning to Online.
The transition from Activating to Online typically takes 5-15 seconds depending on your network connection.

Uninstall

To remove the agent but maintain the configuration files, run
sudo apt remove miru-agent
To remove the agent and purge all configuration files, run
sudo apt purge miru-agent
I