# On-board edge devices using MK.IO API

Prepare an edge device and register it to a project through the MK.IO Fleet API instead of the portal. The device must still be connected to the internet.

## Prerequisites

- You can access the device's local web UI or terminal.
- You have an [API token](/api-guides/getting-started/authentication) with access to the target project.

## Add the device to MK.IO

The on-boarding process has two parts:

1. Prepare the device and obtain a **short code** or **device ID**.
2. Use the code to register the device [via the MK.IO API](/mkio/how-to/managing-edge-devices/on-board-fleet-devices/api-onboarding#add-the-device-using-the-mkio-api).

Once registered, the device is available for monitoring and control through MK.IO.

> **Info:** **Remote on-boarding**
>
> The two steps above do not need to be completed by the same person. In a remote on-boarding scenario, the engineer installing the device can pass the short code verbally to an MK.IO user with permission to register it.

## Prepare the device

Choose one preparation path:

- **Local web UI**: Follow [Connect the device to MK.IO](/mkio/how-to/managing-edge-devices/on-board-fleet-devices/common-workflow#connect-the-device-to-mkio-from-the-device-ui), then copy the short code or device ID.
- **Device terminal**: Follow [Obtain the device ID](/mkio/how-to/managing-edge-devices/on-board-fleet-devices/terminal-only#obtain-the-device-id).

> **Warning:** The short code rotates periodically. Keep the device UI open until registration is complete, or use the longer-lived device ID.

### Add the device using the MK.IO API

Register the device using the short code in the `spec.shortCode` field. Alternatively, use the longer-lived device ID shown in the device web UI or terminal in the `spec.locationId` field:

**PUT** `https://app.mk.io/api/v1/projects/project_name/fleet/devices/device1`

```json
{
  "metadata": {
    "displayName": "Device 1"
  },
  "spec": {
    "siteName": "world",
    "locationId": "a7dafdba-4923-4317-aad1-dc76284b85b5"
  }
}
```

### Verify on-boarding

Once the device is registered, go back to **Appliance** > **Fleet** in the device's local web UI. The **Registered** field shows **Yes** and displays the device's name.

You can now [view device information](/mkio/how-to/managing-edge-devices/display-device-information) and [access the remote UI](/mkio/how-to/managing-edge-devices/access-the-remote-device-ui).

### Update device software

Once the device is registered, before commissioning, [update the device software to the latest version](/mkio/how-to/managing-edge-devices/update-device-software).
