# LitmusEdge Manager (LEM) - Product Router

> You are at https://api.litmus.io/lem/agents.md.
> Parent: https://api.litmus.io/agents.md
> Pick the component matching your task and fetch only that file.

---

## What LEM is

Centralized edge management for multiple Litmus Edge instances. Manages companies, projects, deploys apps and backups across fleets, centralizes Digital Twin asset models and the asset hierarchy.

- Three distinct URL prefixes - identify which one a category uses before constructing any URL:

| Prefix | Used by | Auth header |
|---|---|---|
| `{{LEM_URL}}/api/v1/...` | Main fleet API (~253 endpoints) | `X-AuthToken: {{LEM_AdminApiToken}}` |
| `{{LEM_URL}}/mpcs/...` | Marketplace catalog management (17 endpoints) | `Authorization: {{LEM_AdminApiToken}}` (3.0.x also accepts `X-AuthToken`) |
| `{{LEM_adminURL}}/admin/v1/...` | Admin console on port 8446 (~259 endpoints) | `X-AuthToken: {{LEM_AdminApiToken}}` |

- Version: this tree documents LEM 3.0.x (current LTS). The previous LTS, 2.31.x, is supported best-effort and is not in the split tree; fetch /collections.json (section `LitmusEdgeManager 2.31.x API Documentation`) only if you must inspect a 2.31.x endpoint.
- Migrating from 2.31.x? Fetch /reference/changelog-lem.md for breaking changes (Sites removed, template `friendlyName` required, Docker Pull JSON body), deprecations, and new operations.

---

## Authentication

LEM uses an admin API token, not OAuth2. Get one from Admin Console -> Settings -> Tokens. Set as `X-AuthToken` header (or `Authorization` for the `/mpcs/` paths only).

```
X-AuthToken: <admin-token>
```

The token does not expire automatically; revoke from Admin Console.

Variables (`LEM_URL`, `LEM_adminURL`, `LEM_AdminApiToken`, and the captured IDs): /reference/variables.md

---

## Pagination and limits

Paginated list endpoints (devices, system events/logs, certificates, licenses, backups) take `limit` (page size) and `requestedPage` (0-indexed) query parameters and return the standard envelope:

```json
{ "pageNum": 0, "pagesCount": 3, "size": 10, "totalSize": 25, "elements": [ ... ] }
```

Iterate `requestedPage` until `pageNum + 1 == pagesCount`; requesting past the end returns `size: 0` with empty `elements`. No rate limit is enforced or advertised; self-throttle bulk loops.

---

## Top-level sections

| Section | What it covers | Fetch |
|---|---|---|
| Companies | Top-level company / project listing | /lem/companies.md |
| Edge Lifecycle Management | Per-edge operations: devices, deploys, backups, alerts, RBAC, licenses, HA, OAuth clients, edge and audit logs, platform rules | /lem/edge-lifecycle/agents.md |
| Digital Twins / Asset Management | DT2 asset models, asset hierarchy (templates, nodes, permissions), Asset Hub catalog, deploy to edge | /lem/digital-twins.md |
| Admin Console | LEM-instance admin: settings, integrations, license server, CA certificates, instance alerts, platform rules, async tasks, action log, logs | /lem/admin-console/agents.md |

---

## Quick path - LEM-specific keywords

| Keywords | Fetch |
|---|---|
| "edge device", "fleet", "list edges" | /lem/edge-lifecycle/edge-devices.md |
| "company", "project" | /lem/companies.md |
| "deploy app to edge", "launch app on edge" | /lem/edge-lifecycle/applications.md (or /workflows/deploy-app-lem.md) |
| "backup edge", "restore edge" | /workflows/backup-restore-edge.md |
| "zero touch", "activation request" | /lem/edge-lifecycle/activation.md (or /workflows/provision-zero-touch.md) |
| "project alert", "trigger", "notification" | /lem/edge-lifecycle/alerts.md (or /workflows/create-project-alert.md) |
| "license", "feature flag", "license pool" | /lem/edge-lifecycle/licenses.md OR /lem/admin-console/license-server-mgmt.md |
| "asset model", "DT2", "asset hierarchy", "hierarchy template", "hierarchy node", "Asset Hub catalog" | /lem/digital-twins.md |
| "deploy digital twin model to edge", "push DT model", "deployed models" | /lem/digital-twins.md |
| "instance alert", "edge events registry", "webhook" | /lem/admin-console/instance-alerts.md |
| "marketplace catalog", "feature mgmt" | /lem/edge-lifecycle/features.md |
| "edge device template" | /lem/admin-console/edge-devices.md |
| "AI/ML model upload to LEM" | /lem/edge-lifecycle/ai-ml-models.md (or /workflows/upload-ml-model-lem.md) |
| "RBAC on the edge itself" | /lem/edge-lifecycle/rbac.md |
| "LEM admin users / teams / tokens" | /lem/admin-console/admin-console-settings.md |
| "system logs", "LEM audit records" | /lem/admin-console/logs.md |
| "edge logs", "query logs from an edge" | /lem/edge-lifecycle/edge-logs.md |
| "project audit log", "audit records" | /lem/edge-lifecycle/audit-logs.md |
| "high availability", "HA pair" | /lem/edge-lifecycle/device-ha.md |
| "OAuth client on an edge", "client credentials for an edge" | /lem/edge-lifecycle/oauth-clients.md |
| "log forwarding" (per edge) | /lem/edge-lifecycle/log-forwarding.md |
| "platform rule" | /lem/edge-lifecycle/platform-rules.md (project) or /lem/admin-console/platform-rules.md (instance) |
| "CA certificate" (LEM instance) | /lem/admin-console/ca-certificates.md |
| "async task", "instance task status" | /lem/admin-console/async-tasks.md |
| "action log retention" | /lem/admin-console/action-log.md |
| "marketplace secret" | /lem/admin-console/marketplace-secrets.md |
| "Asset Hub settings", "branch grant", "asset hierarchy access" | /lem/admin-console/asset-hub.md, /lem/admin-console/asset-hierarchy-access.md |
| "incident settings" | /lem/admin-console/incident-settings.md |
| "Kafka / Clickhouse / Syslog integration on LEM" | /lem/admin-console/integration.md |
| "Docker registry on LEM" | /lem/admin-console/docker-registry.md |
| "data lifecycle, partitions, archive, purge" | /lem/admin-console/data-lifecycle.md |
| "WireGuard, remote access" | /lem/edge-lifecycle/remote-access.md |
| "device certificate" | /lem/edge-lifecycle/certificates.md |
| "software update" | /lem/edge-lifecycle/software-update.md |
| "events forwarding, event registry" | /lem/edge-lifecycle/events.md |
| "changelog", "what changed", "migrate from 2.31", "upgrade to 3.0", "deprecated endpoint" | /reference/changelog-lem.md |

---

## RBAC ambiguity - read this carefully

There are TWO different RBAC scopes in LEM:

- **Per-edge RBAC** (`/api/v1/loopedge-user/...`) - manages users on the LE itself, NOT LEM admin users. -> /lem/edge-lifecycle/rbac.md
- **LEM admin RBAC** (`/admin/v1/...` users/teams/tokens) - manages who can log into LEM itself. -> /lem/admin-console/admin-console-settings.md

Confusing the two will give you the wrong endpoints. Disambiguate before routing.

---

## When to back out

If your task is actually about:

- A single edge in isolation (not via LEM) -> /le/agents.md
- MQTT / UNS / namespace -> /luns/agents.md
- Cross-product or unsure -> /agents.md
