# LitmusEdgeManager 2.31.x API Documentation/Edge Lifecycle Management/Sites - LE, LEM, LUNS API Docs

## List Project Sites

**GET** `{{LEM_URL}}/api/v1/site/list/{{project_id}}`

# List Project Sites

Returns every site in the project. A **site** is a physical location (floor plan or map) onto which devices can be plotted as `points[]` with operational status overlays.
## Endpoint

```http
GET {{LEM_URL}}/api/v1/site/list/{{project_id}}
```
## 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 site records with `id`, `name`, `description`, `properties`, and a `mapDefinition` (`{imageUrl, imageWidth, imageHeight, points[]}`).

## 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
[
    {
        "projectId": "462j1mq70mph31wa100t1yuxa",
        "id": "11ey2tij52w5amjn85q988rsc",
        "name": "site_name",
        "description": null,
        "properties": {},
        "mapDefinition": {
            "imageUrl": "https://10.17.3.103:443/api/v1/image/site-image-11ey2tij52w5amjn85q988rsc",
            "imageWidth": 1991,
            "imageHeight": 1260,
            "points": [
                {
                    "x": 1126.8945244956772,
                    "y": 461.3114754098361,
                    "name": "New point",
                    "status": "OPERATIONAL",
                    "description": "Point description",
                    "entity": {
                        "type": "DEVICE",
                        "status": "OPERATIONAL",
                        "id": 0,
                        "entityId": "1a5wiavluwxuhwai5leb1v0hc",
                        "display": "MANAGED"
                    }
                }
            ]
        },
        "deleted": false
    }
]
```

---

## Add Site

**POST** `{{LEM_URL}}/api/v1/site`

# Add Site

Creates a new site in the project. The site starts without an image; attach one via `Add Image to Site`.
## Endpoint

```http
POST {{LEM_URL}}/api/v1/site
```
## Authentication

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

```json
{
  "projectId": "{{project_id}}",
  "name": "api_test",
  "description": "api description",
  "mapDefinition": {},
  "properties": {}
}
```

## Response

`201 Created`. Returns the new site record (including its `id`).

## 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
{
    "projectId": "{{project_id}}",
    "mapDefinition": {},
    "properties": {},
    "name": "api_test",
    "description": "api description"
}
```

### Response

**Status**: 201 Created

```json
{
    "projectId": "project_id",
    "id": "bn92dvp4d77kmv2u6bxob41q8",
    "name": "api_test",
    "description": "api description",
    "properties": {},
    "mapDefinition": {
        "imageUrl": null,
        "imageWidth": 0,
        "imageHeight": 0,
        "points": []
    },
    "deleted": false
}
```

---

## Remove Site

**DELETE** `{{LEM_URL}}/api/v1/site/{{site_id}}`

# Remove Site

Permanently deletes a site by ID.
## Endpoint

```http
DELETE {{LEM_URL}}/api/v1/site/{{site_id}}
```
## 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**: 204 No Content

---

## Add Image to Site

**POST** `{{LEM_URL}}/api/v1/site/image/{{site_id}}`

# Add Image to Site

Uploads a floor-plan / map image for the site. The image is stored under `/api/v1/image/site-image-<siteId>` and referenced by `mapDefinition.imageUrl`.
## Endpoint

```http
POST {{LEM_URL}}/api/v1/site/image/{{site_id}}
```
## Authentication

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

Multipart `form-data` with `file` part (PNG/JPG).

## Response

`200 OK` -- `text/plain`. Returns the image URL.

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

### Response

**Status**: 200 OK

```plain
https://10.17.10.247:443/api/v1/image/site-image-5539uz4of3hyd6rb1lib547hh
```

---

