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

# Workflow 1: Apply / Upload Template (LE)

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

## 1. Apply / Upload Template (LE)

**UI trigger**: System -> Device Management -> Templates -> *Apply Template* (downloads a `.zip`, then re-uploads it)

> **What the UI does invisibly**: When a user clicks "Download Template", the UI first clears any previous upload session, then creates a new one, then uploads the file - the user just sees a file download/upload dialog.

### Step table

| Step | Name in Collection | Method | Endpoint | Body / Notes | Output |
|------|-------------------|--------|----------|-------------|--------|
| 0 | Step 0: Apply Template | `DELETE` | `{{edgeUrl}}/dm/template/v2` | No body. Clears any stale upload session. | 200 OK |
| 1 | Step 1: Apply Template | `POST` | `{{edgeUrl}}/dm/template/v2` | `{"size": <file_bytes>}` | `{"id": "<session_id>"}` |
| 2 | Step 2: Apply Template | `PUT` | `{{edgeUrl}}/dm/template/v2/{id_from_step1}/resume` | Binary file bytes in body | 200 OK, template applied |

**Also relevant** - to *download* a template first (before applying it elsewhere):

| Name in Collection | Method | Endpoint | Notes |
|-------------------|--------|----------|-------|
| Download Template | `POST` | `{{edgeUrl}}/dm/template` | Body: JSON with device IDs and flags to include/exclude components |


---
