The Lansweeper API can refer to the Data API, Platform API, or Device Recognition API. This article focuses on the Data API, which gives scripts access to asset data in your Lansweeper site. Use it to build custom integrations or pull data into reporting tools. For the full reference, see the Lansweeper Developer Portal.
What the Data API is
The Data API is a GraphQL API. You send every request as a POST to a single endpoint, with a JSON body that contains your query:
https://api.lansweeper.com/api/v2/graphql
The Data API returns the IT, OT, and cloud asset data in the sites your API client can access. If you use Lansweeper Classic, link your installation to a Lansweeper Platform site first. The Data API reads the data that the linked installation syncs to that site.
What you can do with the Data API
- Query asset data: list the sites you can access, retrieve assets with filters and pagination, get the full details of a single asset, and export large asset sets in bulk.
- Run actions: request an IT Agent scan or delete assets.
- Subscribe to webhooks: get notified when assets are created, updated, or deleted, when a new data source is added to the site, or when an export completes.
Common uses include syncing assets to a CMDB or service desk, feeding software asset management and security tools, and building custom reports.
To connect Lansweeper to another tool without writing code, browse the Explore the Marketplace articles or build a workflow with Flow Builder. To query your data from an AI assistant, use the Lansweeper MCP server.
Prerequisites
- A Lansweeper Platform site on a Pro or Enterprise plan.
- The API Client Admin role or the View API clients permission.
- A tool that can send HTTP requests, such as cURL, Postman, or a scripting language.
Choose an authentication method
Every request needs an API client. Lansweeper Platform supports 2 types:
| Detail | Personal access token (PAT) | OAuth |
|---|---|---|
| Best for | Scripts and internal tools that you run yourself | Applications that other Lansweeper users connect to their own sites |
| How it works | You generate a token and send it with every request | Users authorize your application, which exchanges an authorization code for an access token |
| Expiry | You set the expiry date when you create the token | Access tokens expire, and your application renews them with a refresh token |
| Request header | Authorization: Token <your-token> |
Authorization: Bearer <access-token> |
If you're building your first integration, start with a PAT.
Create a personal access token
- Sign in to Lansweeper Platform.
- Select your profile picture, then select Account settings.
- Select Developer tools > API clients > Create API client.
- Select Personal Access Token (PAT), then select Next step.
- Enter the API client name and integration, set the expiry date, and select the sites the token can access.
- Select Create.
- Copy the token and store it somewhere safe.
Lansweeper doesn't store the token, so you can't view it again after you close the dialog. If you lose it, select the token under Developer tools, then select Refresh token.
To set up an OAuth client instead, follow the OAuth section of the Developer Portal quickstart.
Send your first request
To check that your token works, list the sites it can access. Replace YOUR_TOKEN with your PAT:
curl --request POST "https://api.lansweeper.com/api/v2/graphql" \
--header "Authorization: Token YOUR_TOKEN" \
--header "Content-Type: application/json" \
--data '{"query": "{ authorizedSites { sites { id name } } }"}'
In Windows Command Prompt, use this equivalent command:
curl --request POST "https://api.lansweeper.com/api/v2/graphql" ^
--header "Authorization: Token YOUR_TOKEN" ^
--header "Content-Type: application/json" ^
--data-raw "{ \"query\": \"{ authorizedSites { sites { id name } } }\"}"
The response returns the ID and name of each site. Most other queries need a site ID, so note the one you want to use:
{
"data": {
"authorizedSites": {
"sites": [
{
"id": "401dxxxx-xxxx-xxxx-xxxx-xxxxxxxx48ca",
"name": "Main office"
}
]
}
}
}
From here, use the assetResources query to retrieve assets from that site. The getting data guide on the Developer Portal shows how to choose fields, filter, and paginate.
Data API limits
The Data API limits how much you can request, so plan your integration around these values:
| Limit | Value |
|---|---|
| Requests per minute | 150 |
| Synchronous requests per hour | 2,000 |
| Bulk exports per hour | 100, with 1 export running at a time |
| Webhook notifications per hour | 2,000 |
| Fields (element paths) per request | 30 |
| Filter conditions per request | 100 |
| Response size | 4 MB per response or page |
If you go over the per-minute limit, wait before you retry. Any request sent while you're blocked resets the counter. For the full list, see Data API restrictions.
Find more on the Developer Portal
The Lansweeper Developer Portal holds the technical documentation for building on Lansweeper:
- Data API: the quickstart, guides for querying data, actions, and webhooks, and the full type reference.
- Platform API: for software vendors who want to embed Lansweeper discovery in their own product. If your organization already has a Lansweeper subscription, use the Data API instead.
- Device Recognition API: documentation for building integrations with Lansweeper Device Recognition.