> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/l/lansweeper-cloud.md).

# Lansweeper Cloud

|                               |                                    |
| ----------------------------- | ---------------------------------- |
| Category                      | IT asset management                |
| Asset types                   | Devices, Users                     |
| Authentication                | Personal Access Token              |
| Direction                     | OctoXLabs → Lansweeper (read only) |
| Supported Lansweeper versions | Not specified                      |
| Available since               | Not specified                      |

Lansweeper Cloud is the hosted version of the Lansweeper IT asset inventory. OctoXLabs reads the assets and, optionally, the user accounts of your sites through the Lansweeper Data API (GraphQL) and adds them to the device and user inventories.

## Use cases

* **Find Lansweeper assets without EDR coverage.** List Lansweeper devices that CrowdStrike does not report.

```
Adapters = lansweeper-cloud AND NOT Adapters = falcon-crowdstrike
```

* **List assets by model.** Device model comes from `assetCustom.model`.

```
Adapters = lansweeper-cloud AND DeviceModel ~ <model>
```

* **List Lansweeper users by email domain.** The domain is taken from the email address.

```
Adapters = lansweeper-cloud AND Domain = <your domain>
```

## Before you begin

### Network

| Source              | Destination                           | Port | Protocol |
| ------------------- | ------------------------------------- | ---- | -------- |
| OctoXLabs connector | api.lansweeper.com (Domain parameter) | 443  | HTTPS    |

The connector always uses HTTPS. If a proxy is set, requests go through it.

### Required permissions

| Scope or role               | Permission               | Needed for |
| --------------------------- | ------------------------ | ---------- |
| Access to the sites to scan | Granted to the token     | Devices    |
| View Users                  | Required for Fetch Users | Users      |

Per the baseline, the token needs access to the sites you want to scan. Fetching users additionally requires the **View Users** permission.

## Create credentials in Lansweeper

{% stepper %}
{% step %}

### Open API clients

Log in to Lansweeper and go to **Settings > Developer tools > API clients**.
{% endstep %}

{% step %}

### Add a client

Click **Add new API client** and choose **Personal Access Token**.
{% endstep %}

{% step %}

### Set expiry and sites

Select an expiration time and grant access to the sites the token should query. Add the **View Users** permission if you want users.
{% endstep %}

{% step %}

### Copy the token

Copy the generated token and store it somewhere safe.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
Fields collected by default, so you do not need to add them: assetBasicInfo.name, assetBasicInfo.userDomain, assetBasicInfo.description, url, assetCustom.model, batteries.availability, cdromDrives.firmware, graphicsCards.manufacturer, memoryModules.size, networkAdapters.macAddress, networks.ipAddressV4, networks.configuration.state, portConnectors.maxSpeed, processors.family, systemEnclosures.chassisName, services.caption, services.lastChanged, services.pathName, services.startName, services.startMode, services.state.
{% endhint %}

## Connection parameters

| Parameter             | Required | Type            | Default            | Description                                                                                                                                                                                                                                            |
| --------------------- | -------- | --------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Domain                | No       | String          | api.lansweeper.com | Domain of the Lansweeper Cloud Data API.                                                                                                                                                                                                               |
| Personal Access Token | Yes      | String          | None               | PAT of an API client that has access to the sites you want to scan.                                                                                                                                                                                    |
| Site ID               | No       | String          | None               | ID of one site to scan. If empty, all sites authorized for the token are scanned.                                                                                                                                                                      |
| Fetch Users           | No       | Boolean         | True               | Also collect user accounts. Needs the View Users permission.                                                                                                                                                                                           |
| Custom Asset Fields   | No       | List of strings | None               | Extra Data API field paths in dotted notation, for example `assetCustom.serialNumber`. The API allows 30 fields per query and 21 are already used, so up to 9 can be added. A path may contain only letters, digits and underscores separated by dots. |
| Proxy                 | No       | String          | None               | Proxy address, used as `http://<value>` for HTTP and HTTPS.                                                                                                                                                                                            |
| Timeout               | No       | Integer         | 30                 | Seconds to wait for an API response.                                                                                                                                                                                                                   |

## What the connection test does

The test takes the first site (the Site ID, or the first authorized site) and runs the assets query for one asset. It then reports success. The result of the query is not checked, so a site with no assets still passes.

## API endpoints called

| Method | Path            | Purpose                                                                                                                                                                                                   |
| ------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| POST   | /api/v2/graphql | GraphQL endpoint. Queries: `authorizedSites` (sites), `site.assetResources` (assets, cursor paging, 100 per page), `site.accounts` (users: username, email, status, createdAt, joinedAt, lastTimeAccess). |

Authentication header: `Authorization: Token <PAT>`.

## Fields fetched

### Devices

| Lansweeper field                | OctoXLabs field                                                        |
| ------------------------------- | ---------------------------------------------------------------------- |
| networks.ipAddressV4            | IpAddresses (valid addresses only)                                     |
| networkAdapters.macAddress      | MacAddresses (first valid MAC is the primary key, else first valid IP) |
| assetCustom.model               | DeviceModel                                                            |
| memoryModules.size (sum, bytes) | TotalRam (GB)                                                          |

### Users

| Lansweeper field      | OctoXLabs field            |
| --------------------- | -------------------------- |
| email                 | Email (primary identifier) |
| username              | Username                   |
| Part of email after @ | Domain                     |
| createdAt             | CreatedTime                |
| lastTimeAccess        | Last logon time            |

Other collected asset fields, such as the asset name and the services, are kept as raw data. Not all of them have an explicit OctoXLabs mapping in this adapter.

## Troubleshooting

| Error message                                                                                     | Cause                                                                                   | Fix                                                                                            |
| ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| Invalid asset field path(s): {paths}                                                              | A Custom Asset Fields entry has a character that is not allowed.                        | Use dotted paths with letters, digits and underscores only.                                    |
| Lansweeper Data API allows at most 30 fields per query; up to 9 custom asset fields can be added. | Too many custom fields.                                                                 | Remove custom fields until the total is 30 or fewer.                                           |
| Status Code: `, followed by URL, Method and the response body`                                    | The API answered with a status other than 200. This is the shared REST connector error. | Read the status code and body in the message, then check the credentials, permissions and URL. |

## Change history
