
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2025 06:40 PM
Hello, I am trying to make a simple query through the lansweeper API, and I have not been able to do it. I want to obtain a list of the assets there are. For that I have created a user "Apiaccess" of the type "Personal Access Token" (PAT), I already have my access codes. but I don't know which URL I should send the query to. Could you tell me that please? Thanks PS: I can't find it in the documentation.
- Labels:
-
API & Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2025 06:18 PM
Hello, thanks for the response. I finally have the postman software installed. I have tried to follow the instructions in the documentation, but I haven't been able to do anything. Create a user to use the TAP type API, I have my token but I don't know how to use it. Could you give me an example? since the manual shows the login of another type.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 12:55 AM
Hi Mr Nico
All of the necessary steps to start making API calls can be found under here: https://developer.lansweeper.com/docs/data-api/get-started/welcome/
Lansweeper Developer Hub
Welcome | Documentation – Lansweeper
Lansweeper's Data API enables you to programmatically interact with Lansweeper Sites, providing quick and easy access to Lansweeper's discovered IT, OT, and Cloud asset data.
The URL you should be using is https://api.lansweeper.com/api/v2/graphql
https://developer.lansweeper.com/docs/data-api/get-started/endpoint
Lansweeper Developer Hub

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 10:44 PM
Thanks for the help, I'm already making some progress, I'm creating a script in powershell that gives me all the inventory I have in lansweeper, the problem I have now is that when I run it it gives me an error "Invoke-RestMethod: {"errors" :[{"message":"Cannot query field 'allAssets' on type 'Query'."}]}"
I know these are basic questions, I'm not an expert in using APIs either, but I need to be able to do this, which I think is basic. What else could be going wrong?
My Script
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "Token xxxxxxxxxxxxxxxxxxxxxxxx"
}
$query = @"
{
allAssets {
items {
id
name
type
status
}
}
}
"@
$body = @{
query = $query
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri "https://api.lansweeper.com/api/v2/graphql" -Method Post -Headers $headers -Body $body -Verbose
if ($response -eq $null) {
Write-Output "Error."
} else {
$response
}
