# LitmusEdgeManager 2.31.x API Documentation/Companies - LE, LEM, LUNS API Docs

## List Company with Basic Statistics

**GET** `{{LEM_URL}}/api/v1/company/list/stats`

# List Company with Basic Statistics

Returns a flat summary of every company in the LEM installation with top-level counters. Used by the LEM home dashboard.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/company/list/stats
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Parameters

None.

## Response

`200 OK` -- `application/json`. Array of company-stat objects.

| Field                  | Type    | Description                                                       |
|------------------------|---------|-------------------------------------------------------------------|
| `companyName`          | string  | Lowercase slug used in path parameters (`{{company_name}}`).      |
| `companyRealName`      | string  | Display name shown in the LEM UI.                                 |
| `totalNumOfProjects`   | integer | Number of projects in the company.                                |
| `totalNumOfDevices`    | integer | Number of edge devices registered to projects in this company.    |
| `totalNumOfModels`     | integer | Number of digital twin models defined.                            |

```json
[
  {
    "companyName": "production",
    "companyRealName": "Production",
    "totalNumOfProjects": 2,
    "totalNumOfDevices": 2,
    "totalNumOfModels": 1
  }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
[
    {
        "companyName": "production",
        "companyRealName": "Production",
        "totalNumOfProjects": 2,
        "totalNumOfDevices": 2,
        "totalNumOfModels": 1
    },
    {
        "companyName": "solutions",
        "companyRealName": "Solutions",
        "totalNumOfProjects": 1,
        "totalNumOfDevices": 1,
        "totalNumOfModels": 0
    },
    {
        "companyName": "hardware",
        "companyRealName": "Hardware",
        "totalNumOfProjects": 2,
        "totalNumOfDevices": 5,
        "totalNumOfModels": 0
    },
    {
        "companyName": "trace-test",
        "companyRealName": "trace-test",
        "totalNumOfProjects": 1,
        "totalNumOfDevices": 0,
        "totalNumOfModels": 0
    },
    {
        "companyName": "ccsj",
        "companyRealName": "CCSJ",
        "totalNumOfProjects": 1,
        "totalNumOfDevices": 0,
        "totalNumOfModels": 0
    }
]
```

---

## Company List with Details

**GET** `{{LEM_URL}}/api/v1/company/list`

# Company List with Details

Returns every company with the **full** record: name, description, teams (with users), quotas, license, deletion flag, and company type (`USER` / `RESELLER` / etc.). Useful for company-admin UIs that need to render the org chart.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/company/list
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Response

`200 OK` -- `application/json`. Array of company objects.

| Field           | Type     | Description                                                       |
|-----------------|----------|-------------------------------------------------------------------|
| `name`          | string   | Lowercase slug (`{{company_name}}`).                              |
| `realName`      | string   | Display name.                                                     |
| `description`   | string   | Free-form description.                                            |
| `teams`         | object[] | Teams with their `users[]` lists. Each user has `username` and `attrs`. |
| `quotas`        | object   | Resource quotas (`null` when unset).                              |
| `license`       | object   | License binding (`null` when unset).                              |
| `deleted`       | boolean  | `true` if the company has been soft-deleted.                       |
| `companyType`   | string   | `USER`, `RESELLER`, `INTERNAL`, ...                                |

```json
[
  {
    "name": "production",
    "realName": "Production",
    "description": "",
    "teams": [
      {
        "name": "OWNER",
        "users": [ { "username": "demo", "attrs": {} } ]
      }
    ],
    "quotas": null,
    "license": null,
    "deleted": false,
    "companyType": "USER"
  }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
[
    {
        "name": "production",
        "realName": "Production",
        "description": "",
        "teams": [
            {
                "name": "OWNER",
                "users": [
                    {
                        "username": "demo",
                        "attrs": {}
                    }
                ]
            }
        ],
        "quotas": null,
        "license": null,
        "deleted": false,
        "companyType": "USER"
    },
    {
        "name": "solutions",
        "realName": "Solutions",
        "description": "",
        "teams": [
            {
                "name": "OWNER",
                "users": [
                    {
                        "username": "demo",
                        "attrs": {}
                    },
                    {
                        "username": "parthshah",
                        "attrs": {}
                    },
                    {
                        "username": "stefanzippel",
                        "attrs": {}
                    },
                    {
                        "username": "amen",
                        "attrs": {}
                    }
                ]
            }
        ],
        "quotas": null,
        "license": null,
        "deleted": false,
        "companyType": "USER"
    },
    {
        "name": "hardware",
        "realName": "Hardware",
        "description": "",
        "teams": [
            {
                "name": "OWNER",
                "users": [
                    {
                        "username": "demo",
                        "attrs": {}
                    },
                    {
                        "username": "tracesakima",
                        "attrs": {}
                    },
                    {
                        "username": "chingchi",
                        "attrs": {}
                    }
                ]
            }
        ],
        "quotas": null,
        "license": null,
        "deleted": false,
        "companyType": "USER"
    },
    {
        "name": "trace-test",
        "realName": "trace-test",
        "description": "",
        "teams": [
            {
                "name": "OWNER",
                "users": [
                    {
                        "username": "tracesakima",
                        "attrs": {}
                    }
                ]
            }
        ],
        "quotas": null,
        "license": null,
        "deleted": false,
        "companyType": "USER"
    },
    {
        "name": "ccsj",
        "realName": "CCSJ",
        "description": "",
        "teams": [
            {
                "name": "OWNER",
                "users": [
                    {
                        "username": "chingchi",
                        "attrs": {}
                    }
                ]
            }
        ],
        "quotas": null,
        "license": null,
        "deleted": false,
        "companyType": "USER"
    }
]
```

---

## Return Company Details

**GET** `{{LEM_URL}}/api/v1/company?name={{company_name}}`

# Return Company Details

Returns one company by `name` query parameter. Same shape as one element of `Company List with Details`, but with richer team-user records (each user includes `attrs` like `status: "ONBOARD"`).

## Endpoint

```http
GET {{LEM_URL}}/api/v1/company?name={{company_name}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Query parameters

| Parameter   | Type   | Required | Description                                                       |
|-------------|--------|----------|-------------------------------------------------------------------|
| `name`      | string | Yes      | Lowercase company slug (from `List Company with Basic Statistics`). |

## Response

`200 OK` -- `application/json`. Single company object.

```json
{
  "name": "solutions",
  "realName": "Solutions",
  "description": "",
  "teams": [
    {
      "name": "OWNER",
      "users": [
        { "username": "demo",         "attrs": { "status": "ONBOARD" } },
        { "username": "parthshah",    "attrs": { "status": "ONBOARD" } },
        { "username": "stefanzippel", "attrs": { "status": "ONBOARD" } }
      ]
    }
  ]
}
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
{
    "name": "solutions",
    "realName": "Solutions",
    "description": "",
    "teams": [
        {
            "name": "OWNER",
            "users": [
                {
                    "username": "demo",
                    "attrs": {
                        "status": "ONBOARD"
                    }
                },
                {
                    "username": "parthshah",
                    "attrs": {
                        "status": "ONBOARD"
                    }
                },
                {
                    "username": "stefanzippel",
                    "attrs": {
                        "status": "ONBOARD"
                    }
                },
                {
                    "username": "amen",
                    "attrs": {
                        "status": "ONBOARD"
                    }
                }
            ]
        }
    ],
    "quotas": null,
    "license": null,
    "deleted": false,
    "companyType": "USER"
}
```

---

## Get Password Policy

**GET** `{{LEM_URL}}/api/v1/password-policy`

# Get Password Policy

Returns the configured password policies. Each LEM installation has at least one default policy (`defaultPolicy: true`). Custom policies can be associated with specific edge devices via `Edge Lifecycle Management > Edge Devices > Device Details > Policy`.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/password-policy
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Response

`200 OK` -- `application/json`. Array of policy objects.

| Field                       | Type    | Description                                                       |
|-----------------------------|---------|-------------------------------------------------------------------|
| `id`                        | string  | Policy ID. The default uses `default_password_policy`; custom policies use UUIDs. |
| `name`                      | string  | Display name.                                                     |
| `description`               | string  | Free-form description.                                            |
| `updated`                   | integer | Last-modified timestamp (Unix epoch milliseconds).                |
| `defaultPolicy`             | boolean | `true` for the default policy.                                    |
| `minPasswordLen` / `maxPasswordLen` | integer | Hard length bounds.                                       |
| `autoGeneratedPasswordLen`  | integer | Length of LEM-generated passwords (e.g. when creating users).      |
| `minUppercaseChars` / `minLowercaseChars` / `minDigits` / `minSpecialChars` | integer | Composition requirements. |
| `specialChars`              | string  | Set of characters classified as "special".                        |

```json
[
  {
    "id": "default_password_policy",
    "name": "Default password policy",
    "description": "Default password policy",
    "updated": 1689673006000,
    "defaultPolicy": true,
    "minPasswordLen": 8,
    "maxPasswordLen": 256,
    "autoGeneratedPasswordLen": 12,
    "minUppercaseChars": 1,
    "minLowercaseChars": 1,
    "minDigits": 1,
    "minSpecialChars": 1,
    "specialChars": "~!@#$%^&*()_-{}[]|;:,.<>?/"
  }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
[
    {
        "id": "default_password_policy",
        "name": "Default password policy",
        "description": "Default password policy",
        "updated": 1689673006000,
        "defaultPolicy": true,
        "minPasswordLen": 8,
        "maxPasswordLen": 256,
        "autoGeneratedPasswordLen": 12,
        "minUppercaseChars": 1,
        "minLowercaseChars": 1,
        "minDigits": 1,
        "minSpecialChars": 1,
        "specialChars": "~!@#$%^&*()_-{}[]|;:,.<>?/"
    }
]
```

---

## Projects Within Company

**GET** `{{LEM_URL}}/api/v1/project?companyName={{company_name}}`

# Projects Within Company

Returns every project inside one company with their full configuration: description, teams, properties, data TTL, allocated slots, MQTT topics, triggers, action templates.

A **project** is the operational scope inside a company. Devices, alerts, integrations, and member assignments all live inside a project (`Edge Lifecycle Management > Settings > Members`).

## Endpoint

```http
GET {{LEM_URL}}/api/v1/project?companyName={{company_name}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Query parameters

| Parameter      | Type   | Required | Description                                              |
|----------------|--------|----------|----------------------------------------------------------|
| `companyName`  | string | Yes      | Company slug.                                            |

## Response

`200 OK` -- `application/json`. Array of project objects.

| Field                      | Type      | Description                                                                                |
|----------------------------|-----------|--------------------------------------------------------------------------------------------|
| `id`                       | string    | Project ID. Used in subsequent `Edge Lifecycle Management > *` endpoints.                  |
| `companyName`              | string    | Parent company slug.                                                                       |
| `name` / `description`     | string    | Display name and description.                                                              |
| `teams`                    | object    | Map of `roleName -> team membership` for project-scoped permissions.                       |
| `properties`               | object    | Project-level toggles (`STORE_OMA_DATA`, `STORE_RAW_DATA`, `KEEP_DELETED_INTERVAL`, `DATAENRICHER_INTEGRATION`, ...). |
| `dataTtl`                  | integer   | Days to retain device data.                                                                |
| `topics`                   | string[]  | MQTT topics the project participates in.                                                   |
| `numberOfAllocatedSlots`   | integer   | Slot allocation from the company's license.                                                |
| `keys`                     | object[]  | Project-scoped API keys (managed via `Settings > Credentials - MQTT`).                      |
| `triggers`                 | object    | Map of `triggerID -> trigger config` for project alert triggers.                            |
| `actionTemplates`          | object    | Map of `templateID -> action template` for alert notifications.                             |
| `deleted`                  | boolean   | Soft-delete flag.                                                                          |

```json
[
  {
    "id": "cfpc2znv3va0fca5d49hlf2ge",
    "companyName": "solutions",
    "name": "project1",
    "description": "",
    "properties": {
      "KEEP_DELETED_INTERVAL": "24",
      "STORE_OMA_DATA": "false",
      "DATAENRICHER_INTEGRATION": "off",
      "STORE_RAW_DATA": "false"
    },
    "dataTtl": 30,
    "topics": [],
    "numberOfAllocatedSlots": 0,
    "keys": [],
    "deleted": false,
    "actionTemplates": {},
    "triggers": {}
  }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
[
    {
        "id": "cfpc2znv3va0fca5d49hlf2ge",
        "companyName": "solutions",
        "name": "project1",
        "description": "",
        "teams": {},
        "properties": {
            "KEEP_DELETED_INTERVAL": "24",
            "STORE_OMA_DATA": "false",
            "DATAENRICHER_INTEGRATION": "off",
            "STORE_RAW_DATA": "false"
        },
        "dataTtl": 30,
        "topics": [],
        "numberOfAllocatedSlots": 0,
        "keys": [],
        "deleted": false,
        "actionTemplates": {},
        "triggers": {
            "de586p1vfrm361yk36gsts3q1": {
                "id": "de586p1vfrm361yk36gsts3q1",
                "name": "Monitor alert failures",
                "description": null,
                "simpleRules": null,
                "eventRules": null,
                "rawDataRules": null,
                "metricRules": null,
                "advancedRules": null,
                "deduplicate": true,
                "severity": 2,
                "subject": "Monitor alert failures",
                "message": "Monitor alert failures",
                "messageResolved": null,
                "tags": null,
                "deviceId": null,
                "actions": null,
                "active": true,
                "showOnDashboard": true,
                "scopeType": "SYSTEM",
                "sourceType": "DATA",
                "updatedOn": 1699642005025,
                "notifyContinuously": false,
                "notifyGracePeriod": 0,
                "alertDelay": 0
            }
        },
        "billingPlanCode": null,
        "createdAt": null,
        "grafanaOrgId": 14,
        "subnetId": 1,
        "latestBackupsToKeep": 3,
        "pubSubKeyRotationIntervalSec": 0,
        "pubSubKeyRotationDaysOfWeek": [],
        "pubSubKeyRotationTime": null,
        "pubSubKeyRotationWindowSec": 0
    },
    {
        "id": "462j1mq70mph31wa100t1yuxa",
        "companyName": "solutions",
        "name": "project2",
        "description": "",
        "teams": {},
        "properties": {
            "KEEP_DELETED_INTERVAL": "24",
            "STORE_OMA_DATA": "false",
            "DATAENRICHER_INTEGRATION": "off",
            "STORE_RAW_DATA": "false"
        },
        "dataTtl": 30,
        "topics": [],
        "numberOfAllocatedSlots": 0,
        "keys": [],
        "deleted": false,
        "actionTemplates": {
            "bp0pgdjum4l1ltore344h9j1p": {
                "id": "bp0pgdjum4l1ltore344h9j1p",
                "name": "apiEMail",
                "type": "EMAIL",
                "limit": {
                    "maxActionsPerInterval": 1,
                    "updateIntervalSeconds": 3600
                },
                "recipients": [
                    "parth.shah@litmus.io"
                ],
                "subject": null,
                "message": null
            }
        },
        "triggers": {
            "6u98gdlpwxuypstkb7826beb9": {
                "id": "6u98gdlpwxuypstkb7826beb9",
                "name": "Monitor alert failures",
                "description": null,
                "simpleRules": null,
                "eventRules": null,
                "rawDataRules": null,
                "metricRules": null,
                "advancedRules": null,
                "deduplicate": true,
                "severity": 2,
                "subject": "Monitor alert failures",
                "message": "Monitor alert failures",
                "messageResolved": null,
                "tags": null,
                "deviceId": null,
                "actions": null,
                "active": true,
                "showOnDashboard": true,
                "scopeType": "SYSTEM",
                "sourceType": "DATA",
                "updatedOn": 1691100533111,
                "notifyContinuously": false,
                "notifyGracePeriod": 0,
                "alertDelay": 0
            }
        },
        "billingPlanCode": null,
        "createdAt": null,
        "grafanaOrgId": 5,
        "subnetId": 1,
        "latestBackupsToKeep": 3,
        "pubSubKeyRotationIntervalSec": 0,
        "pubSubKeyRotationDaysOfWeek": [],
        "pubSubKeyRotationTime": null,
        "pubSubKeyRotationWindowSec": 0
    },
    {
        "id": "2uqgh8aiy8z827jgllw5678j3",
        "companyName": "solutions",
        "name": "project3",
        "description": "",
        "teams": {},
        "properties": {
            "KEEP_DELETED_INTERVAL": "24",
            "STORE_OMA_DATA": "false",
            "DATAENRICHER_INTEGRATION": "off",
            "STORE_RAW_DATA": "false"
        },
        "dataTtl": 30,
        "topics": [],
        "numberOfAllocatedSlots": 0,
        "keys": [],
        "deleted": false,
        "actionTemplates": {},
        "triggers": {
            "51spxt03jnmls15uqgakhloyj": {
                "id": "51spxt03jnmls15uqgakhloyj",
                "name": "Monitor alert failures",
                "description": null,
                "simpleRules": null,
                "eventRules": null,
                "rawDataRules": null,
                "metricRules": null,
                "advancedRules": null,
                "deduplicate": true,
                "severity": 2,
                "subject": "Monitor alert failures",
                "message": "Monitor alert failures",
                "messageResolved": null,
                "tags": null,
                "deviceId": null,
                "actions": null,
                "active": true,
                "showOnDashboard": true,
                "scopeType": "SYSTEM",
                "sourceType": "DATA",
                "updatedOn": 1711618164572,
                "notifyContinuously": false,
                "notifyGracePeriod": 0,
                "alertDelay": 0
            }
        },
        "billingPlanCode": null,
        "createdAt": null,
        "grafanaOrgId": 20,
        "subnetId": 1,
        "latestBackupsToKeep": 3,
        "pubSubKeyRotationIntervalSec": 0,
        "pubSubKeyRotationDaysOfWeek": [],
        "pubSubKeyRotationTime": null,
        "pubSubKeyRotationWindowSec": 0
    }
]
```

---

