GET STARTED
Skip to main content

Quick start

This page explains the minimum steps required to establish the interaction flow with the Platform API.

The basic interaction flow resembles the following:

flow

Step 1: Get organization credentials

Organization credentials are required to use our API and properly install Lansweeper’s IT Agent.

To request organizational credentials, fill out the request form with your information.

We will securely provide you with the following credentials:

  • Client ID
  • Client secret
  • Organization ID

Step 2: Get an organization token

Once you’ve received your organization credentials, you can request an organization token using a REST call. This token authorizes onboarding a new site. Remember, in the Platform API, each of your customers should have a respective site that hosts their data and that the discovery sources are connected to to collect that data.

The endpoint for the call is:

https://apis.lansweeper.com/api/v2/oauth/token

For your call, input the following information:

  • client_id: Your client ID, provided in step 1.
  • client_secret: Your client secret, provided in step 1.
  • grant_type: client_credentials
{
"client_id": "{your_client_id}",
"client_secret": "{your_client_secret}",
"grant_type": "client_credentials"
}

The output of the call contains the following information:

  • access_token: Your orgToken. This JWT token is used in other requests as an Authorization header.
  • token_type: Format or type of token. In this case, Bearer.
  • expires_in: When the token expires. In this case, it is 86400 seconds, which is 24 hours.
Note

Your token expired after 24 hours. If your token has expired and you need to regenerate one, check out get token.

Errors

If you receive the following error, you have most likely used the wrong endpoint for your call. For example, you used the endpoint for the development environment rather than the production environment.

Error: Cannot read properties of undefined (reading 'address')

Step 3: Create a site for your first customer

Now that you have generated your orgToken (the access_token from the last step), you can create a site for your customer, which will be the platform that connects with the Discovery Sources and stores your customer’s data.

::: info Note These details should be stored and managed within your system for reference for future data calls. :::

For your call, input the following information:

  • OrganizationId: Your organization ID, provided in step 1.
mutation createOrgSite($organizationId: ID!)  {
organization(id: $organizationId) {
createOrgSite {
id
clientId
clientSecret
}
}
}

The output of the call contains the credentials required for step 4.

Step 4: Request site token

Once the Lansweeper Site is created, you can deploy a Lansweeper agent to scan your customer’s endpoints.

To begin, request the site token.

For your call, input the following information:

  • client_id: The client ID for your customer’s Lansweeper site, provided in step 3.
  • client_secret: The client secret for your customer’s Lansweeper site, provided step 3.
  • grant_type: client_credentials

The endpoint for the call is:

https://apis.lansweeper.com/api/v2/oauth/token

For your call, input the following information:

  • client_id: The client ID for your customer’s Lansweeper site, provided in step 3.
  • client_secret: The client secret for your customer’s Lansweeper site, provided step 3.
  • grant_type: client_credentials
{
"client_id": "{your_client_id}",
"client_secret": "{your_client_secret}",
"grant_type": "client_credentials"
}

The output of the call contains the following information:

  • access_token: Your site token. Will be used for the siteToken.
  • token_type: Format or type of token. In this case, Bearer.
  • expires_in: When the token expires. In this case, it is 86400 seconds, which is 24 hours.
Note

Your token expired after 24 hours. If your token has expired and you need to regenerate one, check out regenerate your token.

Errors

If you receive the following error, you have most likely used the wrong endpoint for your call. For example, you used the endpoint for the development environment rather than the production environment.

Error: Cannot read properties of undefined (reading 'address')

Step 5: Request a linking code for your customer’s site

A linking code is required to link a scanning agent from your customer’s endpoint to their site. The linking code is used as a configuration parameter within the agent installation script on the destination devices.

For your call, input the following information:

  • siteID: The site ID provided in step 3.
mutation getLinkingCode($siteId: ID!) {
orgSite(id: $siteId) {
linkingCode
}
}

The output of the call contains the following information:

  • linkingCode: Linking code required to link the agent to your customer’s Lansweeper Site.

Step 6: Install an IT Agent

Now you're ready to install an IT Agent, which is responsible for scanning your customer's endpoints and returning that information to your customer's site.