# LitmusEdgeManager 2.31.x API Documentation/Admin Console APIs/Data Lifecycle - LE, LEM, LUNS API Docs

## Partition Usage

**GET** `{{LEM_adminURL}}/admin/v1/system/partition-usage-objects`

# Partition Usage

Returns disk partition utilization for every mount point on the LEM host: `/`, `/var`, `/var/audit`, `/tmp`, ... Each entry has `mountPath`, `totalBytes`, `freeBytes`.
## Endpoint

```http
GET {{LEM_adminURL}}/admin/v1/system/partition-usage-objects
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## 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
[
    {
        "mountPath": "/var",
        "totalBytes": 232952692736,
        "freeBytes": 194628993024
    },
    {
        "mountPath": "/",
        "totalBytes": 32196526080,
        "freeBytes": 20966633472
    },
    {
        "mountPath": "/var/audit",
        "totalBytes": 4284481536,
        "freeBytes": 4220739584
    },
    {
        "mountPath": "/tmp",
        "totalBytes": 3210739712,
        "freeBytes": 3154063360
    }
]
```

---

## Disk Usage and Data Objects

**GET** `{{LEM_adminURL}}/admin/v1/system/disk-usage-objects`

# Disk Usage and Data Objects

Returns base-directory + data-directory totals plus a breakdown of LEM's persistent on-disk objects (`lem-upgrade`, `dlm-archive`, `kafka-data`, ...) with size and path.
## Endpoint

```http
GET {{LEM_adminURL}}/admin/v1/system/disk-usage-objects
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## 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
{
    "baseDirPath": "/opt/lem",
    "baseDirTotalBytes": 29346402304,
    "baseDirFreeBytes": 11359252480,
    "dataDirPath": "/var/lib/lem",
    "dataDirTotalBytes": 51460472832,
    "dataDirFreeBytes": 45458477056,
    "objects": [
        {
            "name": "lem-upgrade",
            "size": 3309727744,
            "path": "/var/lib/lem/lem-admin/lem-upgrade"
        },
        {
            "name": "dlm-archive",
            "size": 4096,
            "path": "/var/lib/lem/lem-admin/dlm-archive"
        },
        {
            "name": "kafka-data",
            "size": 92831744,
            "path": "/var/lib/lem/kafka"
        },
        {
            "name": "clickhouse-data",
            "size": 60813312,
            "path": "/var/lib/lem/clickhouse"
        },
        {
            "name": "prometheus-data",
            "size": 423399424,
            "path": "/var/lib/lem/prometheus-data"
        },
        {
            "name": "minio-storage",
            "size": 1842032640,
            "path": "/var/lib/lem/minio"
        },
        {
            "name": "mpcs-docker-registry",
            "size": 4096,
            "path": "/var/lib/lem/mpcs-docker-registry"
        },
        {
            "name": "others",
            "size": 273182720,
            "path": "/var/lib/lem"
        }
    ]
}
```

---

## Data Lifecycle Management Stats

**GET** `{{LEM_adminURL}}/admin/v1/dlm/stats`

# Data Lifecycle Management Stats

Returns DLM totals: current user-data size + max, current archive size + max.
## Endpoint

```http
GET {{LEM_adminURL}}/admin/v1/dlm/stats
```
## Authentication

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

```json
{
  "userdataSize": 35536508,
  "userdataMax": 42847534716,
  "archiveSize": 0,
  "archiveMax": 45459230720
}
```

## 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
{
    "userdataSize": 35536508,
    "userdataMax": 42847534716,
    "archiveSize": 0,
    "archiveMax": 45459230720
}
```

---

## Stats by Period/User Data Stats

**GET** `{{LEM_adminURL}}/admin/v1/dlm/stats/userdata`

# Stats by Period / User Data Stats

Returns per-(company, project, period) user-data size. `period` is `YYYYMM`. Use to render a billing-style breakdown of data storage consumption.
## Endpoint

```http
GET {{LEM_adminURL}}/admin/v1/dlm/stats/userdata
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## 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
[
    {
        "company": "belden",
        "projectId": "8h0lim73udgl5r8ex4v0d1vr7",
        "projectName": "Docker",
        "period": "202310",
        "size": 2673
    },
    {
        "company": "hardware",
        "projectId": "2prp72ljt3e2149umck473xrl",
        "projectName": "Emerson",
        "period": "202310",
        "size": 1719
    },
    {
        "company": "hardware",
        "projectId": "cse9ecyxjifs7yhizoqiydyu3",
        "projectName": "Industrial",
        "period": "202310",
        "size": 305105
    },
    {
        "company": "production",
        "projectId": "ea13siviozaattgjd5unuoya7",
        "projectName": "GA",
        "period": "202310",
        "size": 35225384
    },
    {
        "company": "solutions",
        "projectId": "462j1mq70mph31wa100t1yuxa",
        "projectName": "parth",
        "period": "202310",
        "size": 1627
    }
]
```

---

## Archive Management

**GET** `{{LEM_adminURL}}/admin/v1/dlm/archive`

# Archive Management

Returns the archive index -- one entry per archived `.csv.gz` file. `filename` carries the full archive path (used by DLM purge policies that target `ARCHIVE` objects).
## Endpoint

```http
GET {{LEM_adminURL}}/admin/v1/dlm/archive
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## 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
[
    {
        "filename": "/solutions/462j1mq70mph31wa100t1yuxa/202310/raw/solutions-parth-202310-raw-20231101-213657.csv.gz",
        "createdAt": 1698874618036,
        "size": 640
    }
]
```

---

## Purge Policy

**GET** `{{LEM_adminURL}}/admin/v1/dlm/policy`

# Purge Policy

Returns the DLM purge policies in effect. Each policy targets a scope (`INSTANCE` / `COMPANY`), an object (`ARCHIVE` / `USERDATA`), a trigger type (`BY_SIZE_LEFT_PCT` / `BY_SIZE_BYTES`), and an action (`PURGE` / `ARCHIVE`).
## Endpoint

```http
GET {{LEM_adminURL}}/admin/v1/dlm/policy
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## 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
[
    {
        "policyId": 1,
        "company": null,
        "scope": "INSTANCE",
        "object": "ARCHIVE",
        "type": "BY_SIZE_LEFT_PCT",
        "action": "PURGE",
        "value": 20,
        "createdOn": 1695770545000,
        "updatedOn": 1695770559000
    },
    {
        "policyId": 2,
        "company": null,
        "scope": "INSTANCE",
        "object": "USERDATA",
        "type": "BY_SIZE_LEFT_PCT",
        "action": "ARCHIVE",
        "value": 20,
        "createdOn": 1695770570000,
        "updatedOn": null
    }
]
```

---

## Create Purge Policy

**POST** `{{LEM_adminURL}}/admin/v1/dlm/policy`

# Create Purge Policy

Creates a new DLM purge policy. Send `policyId: null` to let the server assign an ID.
## Endpoint

```http
POST {{LEM_adminURL}}/admin/v1/dlm/policy
```
## Authentication

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

```json
{
  "policyId": null,
  "scope": "COMPANY",
  "company": "solutions",
  "action": "ARCHIVE",
  "object": "USERDATA",
  "type": "BY_SIZE_BYTES",
  "value": 5
}
```

## 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.


### Request Body

```json
{
    "policyId": null,
    "scope": "COMPANY",
    "company": "solutions",
    "action": "ARCHIVE",
    "object": "USERDATA",
    "type": "BY_SIZE_BYTES",
    "value": 5
}
```

### Response

**Status**: 200 OK

```json
{
    "code": "S",
    "message": null,
    "messageDetails": null
}
```

---

