This chapter describes how to authenticate with the Lucidum API v2. The steps are:
-
Generate a bearer token
-
Include the bearer token in the header of each API request
Generating a Bearer Token for /CMDB/v2/data/ldg Endpoint #
The /CMDB/v2/data/ldg endpoint retrieves only enriched data from the Lucidum Data Group. This endpoint provides a more focused set of results for each asset or user.
To authenticate with the /CMDB/v2/data/ldg endpoint, use an action bearer token. This bearer token allows a Lucidum account to access the /CMDB/v2/data/ldg endpoint.
NOTE: For all other APIs, generate a standard bearer token associated with your Lucidum user account.
To generate the action bearer token:
-
Go to Settings > User Management.
-
Find your account. Click its Edit link.
-
Ensure that your account is assigned the Role Api_Users.
-
In the Edit User page, in the Roles field, click API_Users and click the right arrow button.
-
Click Save.
-
Go to the Actions page (left menu > Actions icon).
-
Find an enabled action. Click on its tile.
-
In the page for the action, click the Token icon (in the upper left).
-
In the Manage Action Tokens page, click on the Add Token (plus-sign) icon.
-
Enter a name for the Action Token.
-
The new Action Token appears in the Manage Action Tokens page. Click the View External API Script (code) icon.
-
In the script, find the Action Token. Save it somewhere safe.
-
You can copy this script (copy icon) and use it within Python code to make API calls to the Lucidum LDG.
Generating a Bearer Token for All Other Endpoints #
To authenticate with the Lucidum API v2, use a bearer token. The bearer token allows a Lucidum account to access the Lucidum API. You can generate the bearer token from the Lucidum UI.
Lucidum does not support SSO access for the Lucidum API.
To generate the Token:
-
Go to Settings > User Management.
-
Find your account. Click its Edit link.
-
Ensure that your account is assigned the Role Api_Users.
-
In the Edit User page, in the Roles field, click API_Users and click the right arrow button.
-
In the Edit User page, click the button Generate ClientID/Secret.
-
Double-click on the Client ID field to copy the value. Save it somewhere safe.
-
Double-click on the Secret field to copy the value. Save it somewhere safe.
-
Click the button Generate Token.
-
Double-click on the Token field to copy the value. Save it somewhere safe. Lucidum will not display this value again.
-
Click the Confirm button.
Authentication in the Header #
To authenticate with the Lucidum API v2, include the bearer token or action bearer token in the header of each API request.
In Python, the header looks like this:
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer quoVnYQeDNicAOywkOKq'
}
In cURL the header looks like this:
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer quoVnYQeDNicAOywkOKq'
where:
-
-
-
quoVnYQeDNicAOywkOKq
is the bearer Token we generated in the Edit User page. -
Content-Type is JSON.
-
-