---
parent: /workflows/agents.md
back_out_url: /workflows/agents.md
---

# Workflow 13: Backup and Restore an Edge Device from LEM

> You are at https://api.litmus.io/workflows/backup-restore-edge.md
> Parent: https://api.litmus.io/workflows/agents.md
> If this is the wrong workflow, back out to the index above.

## 13. Backup and Restore an Edge Device from LEM

**UI trigger**: LEM -> Edge Lifecycle Management -> Edge Devices -> select device -> Backups -> *Make Backup* / *Restore*

Backups are stored in LEM-managed S3 and accessed via pre-signed URLs (no further auth needed on the URL itself). The backup target on restore can be a different device than the source -- enables configuration cloning across devices.

### Step table

| Step | Name in Collection | Method | Endpoint | Body / Notes | Output |
|------|-------------------|--------|----------|-------------|--------|
| 1 | Make Device Backup | `POST` | `{{LEM_URL}}/api/v1/backup/init-backup?projectId={{project_id}}&deviceId={{edge_device_id}}` | No body. Asynchronous -- backup runs on the device | `{ "code": "200", "content": null }` |
| 2 | List Backups | `GET` | `{{LEM_URL}}/api/v1/backup/list?projectId={{project_id}}&deviceId={{edge_device_id}}` | Poll until the new entry appears | List with `timestamp` and `backupType` (typically `MASTER`) |
| 3 | Get Pre-signed S3 URL to Backup | `POST` | `{{LEM_URL}}/api/v1/backup/get?projectId={{project_id}}&deviceId={{edge_device_id}}&backupType=MASTER&timestamp={ts}` | -- | Pre-signed S3 GET URL valid 7 days |
| 4 *(optional, cross-tenant)* | Save Backup to Pre-signed S3 URL | `POST` | `{{LEM_URL}}/api/v1/backup/put?...` | Used only when relocating the `.dat` to a different S3 location | New pre-signed PUT URL |
| 5 | Restore from Backup | `POST` | `{{LEM_URL}}/api/v1/backup/init-restore?projectId={{project_id}}&deviceId={{target_edge_device_id}}&backupType=MASTER&timestamp={ts}` | `deviceId` query param can target a **different** device than the source | Restore initiated on target device |

> **Distinct from "LEM Backup"**: this chain backs up a single edge device (`/api/v1/backup/...`). To back up the LEM instance itself, use Admin Console -> Admin Console Settings -> Backup (`/admin/v1/lem-backup/...`).

> **Auth**: all calls use `X-AuthToken: {{LEM_AdminApiToken}}`. The pre-signed S3 URL from step 3 carries SigV4 query params and needs **no** auth header.


---
