# Litmus API - Root Router

> You are at https://api.litmus.io/agents.md.
> This is a ROUTER, not a reference. Pick the URL below that matches your task and fetch only that.
> Do NOT fetch /collections.json. It is 30 MB / ~520,000 tokens and will exhaust your context.

---

## Layer to use

Use the highest layer that covers your task. Fall back only when needed.

| Layer | Best for | Fetch |
|---|---|---|
| **MCP Server** | LLM agents with an MCP client, no code | https://api.litmus.io/mcp-agents.md |
| **litmus-cli (standalone binary)** | **Preferred for agentic tasks** - full SDK surface as shell commands, JSON output | https://api.litmus.io/cli.md |
| **Python SDK** | Integrating Litmus into a Python project (Go and Rust SDKs are in the works, not yet public) | https://api.litmus.io/sdk-agents.md |
| **API Collection (this tree)** | Anything not in MCP/CLI/SDK | continue below |

If you are an AI agent that can run shell commands, `litmus-cli` is the recommended
default: install once, then discover and call any of ~570 SDK functions with
`litmus-cli list` / `litmus-cli run`. See https://api.litmus.io/cli.md.

---

## Pick a product

Fetch the product router for whichever product your task targets. Each product router has its own component index and auth instructions.

| Product | What it is | Fetch |
|---|---|---|
| **Litmus Edge (LE)** | Industrial edge data platform on a gateway or server. Devices, tags, OPC UA, apps, flows. | /le/agents.md |
| **Litmus Edge Manager (LEM)** | Centralized edge management. Multiple edges, RBAC, deploy, backup. | /lem/agents.md |
| **Litmus Unify (LUNS)** | MQTT-based Unified Namespace (Litmus Unify 2.0.x; older versions named Litmus UNS, `<v2.0.0`). Accounts and ACL rules, namespace, Kafka/connector integrations, node configuration. | /luns/agents.md |

If your task is a multi-step UI action (e.g. "deploy an application", "browse for tags") - fetch the workflow index first:

| Task type | Fetch |
|---|---|
| Multi-step workflow (UI action -> chain of API calls) | /workflows/agents.md |
| OAuth2 / authentication | /le/agents.md#authentication or /lem/agents.md#authentication or /luns/agents.md#authentication |
| Environment variables (`{{vars}}`: what to set vs what is captured) | /reference/variables.md |
| Tag value / DataHub / NATS message shape (the JSON a tag flows as) | /reference/devicehub-message-format.md |
| Analytics processor catalog (which processors exist on LE 4.0.x, params, required wire definitions) | /reference/analytics-processors.md |
| Version migration / changelog (LE 3.16.x to 4.0.x, LEM 2.26.x to 2.31.x) | /reference/changelog-le.md or /reference/changelog-lem.md |

Requests throughout this tree use `{{variable}}` placeholders (e.g. `{{edgeUrl}}`, `{{deviceID}}`). Every one is catalogued at /reference/variables.md, split into set-once configuration (URLs and credentials you edit before any call) and captured-at-runtime IDs (filled in by earlier responses). Fetch it when a placeholder is unclear or you need to know what to set.

---

## Quick path - task keywords -> URL

If your task contains any of these words, jump directly to the listed URL. Skip the product router.

| Keywords in task | Fetch |
|---|---|
| "create device", "add device", "new device" | /workflows/create-device-with-tags.md |
| "browse tags", "discover tags", "bulk tag" | /workflows/browse-bulk-tags.md |
| "OPC UA server", "expose tags", "OPC UA import" | /workflows/configure-opcua-server.md |
| "deploy app", "launch app" (LE) | /workflows/deploy-app.md |
| "deploy app to edge" (LEM) | /workflows/deploy-app-lem.md |
| "zero touch", "activation", "provision edge" | /workflows/provision-zero-touch.md |
| "backup edge", "restore edge" (LEM) | /workflows/backup-restore-edge.md |
| "create alert", "project alert", "trigger + action" | /workflows/create-project-alert.md |
| "MQTT account", "UNS account" | /workflows/provision-mqtt-account.md |
| "NATS client", "DataHub client", "access account", "NATS proxy", "connect to the message bus", "port 4222" | /workflows/authenticate-nats-datahub-client.md |
| "upload template", "apply template" | /workflows/apply-upload-template.md |
| "upload CA cert", "custom certificate" | /workflows/upload-ca-cert.md |
| "upload analytics model", "TensorFlow" | /workflows/upload-analytics-model.md |
| "upload AI model", "ML model" (LEM) | /workflows/upload-ml-model-lem.md |
| "create integration", "create connector", "Kafka", "InfluxDB", "Azure IoT" | /workflows/create-integration-instance.md |
| "create analytics", "build analytics", "set up analytics", "make an analytics flow", "analytics pipeline", "create processor", "OEE", "downtime KPI", "subscribe and publish one key", "JSONata processor", "Expression processor", "anomaly detection", "SPC", "transform data in analytics" | /workflows/build-analytics-pipeline.md |
| "analytics import", "import group", "import analytics", "analytics export", "export group", "export analytics", "BackupItem", "Import/Export analytics JSON" | /workflows/build-analytics-pipeline.md#one-shot-alternative-author-the-whole-group-as-json-and-import |
| "which analytics processors exist", "processor catalog", "available processors", "list analytics processors", "what does <processor> do", "params for <processor>", "<processor> parameters", "Moving Average params", "Compliance and Loss wires", "Production Time CTR" | /reference/analytics-processors.md |
| "tag", "register", "data point" | /le/devicehub/tags.md |
| "driver", "Modbus", "EtherNet/IP", "S7" | /le/devicehub/drivers.md |
| "digital twin model", "DT", "asset model" (LE) | /le/digital-twins.md |
| "asset", "DT2" (LEM, fleet-wide) | /lem/digital-twins.md |
| "flow", "Node-RED" | /le/flows.md |
| "analytics", "AI model", "tensor" | /le/analytics.md |
| "marketplace", "catalog", "edge app" | /le/applications.md |
| "MQTT topic", "namespace", "UNS rule" | /luns/uns.md |
| "MQTT broker config" | /luns/mqtt.md |
| "license", "feature flag" | /lem/edge-lifecycle/licenses.md OR /lem/admin-console/license-server-mgmt.md |
| "device template" | /lem/admin-console/edge-devices.md |
| "RBAC", "user", "permission" (per-edge) | /lem/edge-lifecycle/rbac.md |
| "RBAC", "user", "permission" (LEM admin) | /lem/admin-console/admin-console-settings.md |
| "logs", "system logs" | /lem/admin-console/logs.md OR /le/system/events.md |
| "Prometheus metrics" | check the component you care about (e.g. /le/devicehub/prometheus.md) |
| "variable", "{{...}}", "environment", "what do I set", "edgeUrl", "token" | /reference/variables.md |
| "changelog", "what changed", "migration", "upgrade", "deprecated endpoint" (LE 3.16.x to 4.0.x) | /reference/changelog-le.md |
| "changelog", "what changed", "migration", "upgrade", "deprecated endpoint" (LEM 2.26.x to 2.31.x) | /reference/changelog-lem.md |
| "tag payload", "message format", "DataHub message", "NATS payload", "tag value shape", "what does a tag look like" | /reference/devicehub-message-format.md |

---

## Term disambiguation

These terms are used by multiple products and components. Resolve before routing.

| Term | LE meaning | LEM meaning | LUNS meaning |
|---|---|---|---|
| **Device** | A physical machine LE talks to (PLC, sensor) | An LE instance under LEM management | n/a |
| **Browse** | Discover tags on a physical device | n/a | n/a |
| **Template** | LE config snapshot (System -> Templates) | Project template (Edge Lifecycle Management -> Templates) OR Device template (Admin Console -> Edge Devices -> Edge Device Templates) | n/a |
| **Digital Twin** | Models + Instances on a single edge | DT2 Asset Models (fleet-wide) | n/a |
| **Marketplace** | Apps installed on this edge | Marketplace catalogs (Admin Console / Features) | n/a |
| **Token** | OAuth2 Bearer (client credentials -> /auth/v3/oauth/token), or an API token over HTTP Basic Auth (token as username, empty password) | X-AuthToken header (admin API token) | OAuth2 Bearer (password grant) |
| **Provider** | Integration backend (Kafka, S3, Azure IoT, ...) | n/a | n/a |
| **Account** | n/a | n/a | MQTT broker user (client_id + creds + rules) |

---

## Pagination and rate limits

No product enforces or advertises an API rate limit: no `429` responses and no rate-limit headers. Self-throttle bulk loops (sequential or low concurrency) and cap page sizes yourself; the servers do not cap them for you.

| Product | Paging convention |
|---|---|
| **LE** | Most REST list endpoints return the complete set. Paged surfaces are GraphQL: events (`/events/query`) take `offset` / `count` variables and return `total`; Analytics and DeviceHub tag list queries take `Limit` / `SkipCount` and expose a `Last` boolean (the `ContinueFrom` cursor fields on tag lists are inert on 4.0.x). The server does NOT cap `count` (a count of 100000 returns 100000 rows), so pick a sane page size (<= 1000) and iterate. |
| **LEM** | Paginated lists (devices, logs, events, certificates, licenses, backups) take `limit` (page size) and `requestedPage` (0-indexed) query params and return the envelope `{pageNum, pagesCount, size, totalSize, elements[]}`. Iterate `requestedPage` until `pageNum + 1 == pagesCount`; past-the-end pages return `size: 0`. |
| **LUNS** | Result sets are small and returned whole. The only paged query is the node update log (`OffsetLine` / `LimitLine`). |

OAuth token lifetime varies per deployment (an `expires_in` of 300 seconds has been observed; do not assume 3600). Read `expires_in` from the token response and refresh early.

---

## When NOT to fetch this tree

| Scenario | Fetch instead |
|---|---|
| Need a pre-built solution (Kafka pipeline, Excel addin, CNC template) | https://docs.litmus.io/solutions |
| Need product UI / how-to guide | https://docs.litmus.io |
| Need to download software, manage licenses | https://portal.litmus.io |
| MCP tool exists for this | /mcp-agents.md |
| Generic / non-Litmus topic (Kafka itself, Azure docs, language q) | web search |

---

## Discovery for AI agents

- Machine-readable index: https://api.litmus.io/llms.txt
- Sitemap: https://api.litmus.io/sitemap.xml
- This whole tree is static markdown on Cloudflare Assets. Safe to fetch any single file in isolation.
