Getting Cost Optimization Recommendations Details
Last updated - 29 July, 2025
You can use LogicMonitor REST API v3 to get cost optimization recommendations details. You must authenticate yourself before making the API request.
Getting a List of Recommendations
The recommendations list includes details about the cloud provider, associated resources, recommendation specifics, and so on. You can use the following query parameters to control the content and format of the response.
URI: GET
/cost-optimization/recommendations
Parameters | Type | Description |
fields | String | The response is filtered to include only the specified fields for each object. You can provide a list of properties separated by a comma (, ).Example— /cost-optimization/recommendations?fields=resourceDisplayName,cloudAccountId |
size | Integer | Indicates the number of recommendations to return in the response. A maximum of 500 results can be requested in a GET call. A default page size of 50 is used if this parameter is not specified.Example— /cost-optimization/recommendations?size=25 |
offset | Integer | Indicates the specified number of recommendations to skip before starting to return results. Example— /cost-optimization/recommendations?offset=10 |
filter | String | The response is filtered according to the operator and specified value that is, filter=property:value
|
The following example displays how an API request in Python script returns a list of recommendations in the api.logicmonitor.com portal, where the result is filtered based on recommendationStatus
set to "ACTIVE"
.
#!/bin/env python
import requests
import json
import hashlib
import base64
import time
import hmac
import getpass
#Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
#Note: The below is provided for illustration purposes only.
AccessId = getpass.getpass("Enter your AccessId: ")
AccessKey = getpass.getpass("Enter your AccessKey: ")
Company = 'apiAccount'
#Request Info
httpVerb ='GET'
resourcePath = '/cost-optimization/recommendations'
queryParams = '?filter=recommendationStatus:"ACTIVE"&size=5'
data = ''
#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath +queryParams
#Get current time in milliseconds
epoch = str(int(time.time() * 1000))
#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath
#Construct signature
digest = hmac.new(
AccessKey.encode('utf-8'),
msg=requestVars.encode('utf-8'),
digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(digest.encode('utf-8')).decode('utf-8')
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + str(signature) + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth,'X-Version':'3'}
#Make request
response = requests.get(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
The following example displays how an API request in Python script returns a list of recommendations in the api.logicmonitor.com portal, where the result is filtered based on the resourceDisplayName
and cloudAccountId
fields and recommendationStatus
set to ACTIVE
.
#!/bin/env python
import requests
import json
import hashlib
import base64
import time
import hmac
import getpass
#Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
#Note: The below is provided for illustration purposes only.
AccessId = getpass.getpass("Enter your AccessId: ")
AccessKey = getpass.getpass("Enter your AccessKey: ")
Company = 'apiAccount'
#Request Info
httpVerb ='GET'
resourcePath = '/cost-optimization/recommendations'
queryParams = '?fields=resourceDisplayName,cloudAccountId&filter=recommendationStatus:"ACTIVE"&size=3&offset=1'
data = ''
#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath +queryParams
#Get current time in milliseconds
epoch = str(int(time.time() * 1000))
#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath
#Construct signature
digest = hmac.new(
AccessKey.encode('utf-8'),
msg=requestVars.encode('utf-8'),
digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(digest.encode('utf-8')).decode('utf-8')
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + str(signature) + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth,'X-Version':'3'}
#Make request
response = requests.get(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Getting Details of a Specific Recommendation
You can use the following query parameters to control the content and format of the response.
URI: GET /cost-optimization/recommendations/{id}
Parameters | Type | Description |
id | String | (Mandatory) An alphanumeric ID of the recommendation. It is delimited with hyphens (- ) and written in the sequence: the recommendation’s database ID- the associated resource ID- the recommendation type. The ID corresponds with the ID returned by the id field in the GET /cost-optimization/recommendations endpoint.Example— /cost-optimization/id=123-456-EBS_UNATTACHED |
fields | String | The response is filtered to include only the specified fields for each object. You can provide a list of properties separated by a comma (, ).Example— /cost-optimization/recommendations?fields=resourceDisplayName,cloudAccountId |
The following example displays how an API request in Python script returns details of a recommendation with id=12041-3054082-AZURE_DISK_UNATTACHED
in the api.logicmonitor.com portal.
#!/bin/env python
import requests
import json
import hashlib
import base64
import time
import hmac
import getpass
#Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
#Note: The below is provided for illustration purposes only.
AccessId = getpass.getpass("Enter your AccessId: ")
AccessKey = getpass.getpass("Enter your AccessKey: ")
Company = 'apiAccount'
#Request Info
httpVerb ='GET'
resourcePath = '/cost-optimization/recommendations/12041-3054082-AZURE_DISK_UNATTACHED'
queryParams = ''
data = ''
#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath +queryParams
#Get current time in milliseconds
epoch = str(int(time.time() * 1000))
#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath
#Construct signature
digest = hmac.new(
AccessKey.encode('utf-8'),
msg=requestVars.encode('utf-8'),
digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(digest.encode('utf-8')).decode('utf-8')
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + str(signature) + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth,'X-Version':'3'}
#Make request
response = requests.get(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Getting a List of Recommendations Categories
You can use this API endpoint to get a static list of currently available recommendation categories offered by LogicMonitor. You can use the following query parameters to control the content and format of the response.
URI: GET /cost-optimization/recommendations/categories
Parameter | Type | Description |
fields | String | The response is filtered to include only the specified fields for each object. You can provide a list of properties separated by comma (, ).Example— /cost-optimization/recommendations/categories?fields=Name,description |
size | Integer | Indicates the number of results to display. A maximum of 500 results can be requested in a GET call. A default page size of 50 is used if a value is not specified.Example— /cost-optimization/recommendations/categories?size=5 |
offset | Integer | Indicates the specified number of categories to skip before starting to return results. Example— /cost-optimization/recommendations/categories?offset=2 |
filter | String | The response is filtered according to the operator and specified value that is, filter=property:value Example— /cost-optimization/recommendations/categories?filter=description~"AWS" |
The following example displays how an API request in Python script returns a list of all recommendation categories in the api.logicmonitor.com portal.
#!/bin/env python
import requests
import json
import hashlib
import base64
import time
import hmac
import getpass
#Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
#Note: The below is provided for illustration purposes only.
AccessId = getpass.getpass("Enter your AccessId: ")
AccessKey = getpass.getpass("Enter your AccessKey: ")
Company = 'apiAccount'
#Request Info
httpVerb ='GET'
resourcePath = '/cost-optimization/recommendations/categories'
queryParams = '?filter=description~"AWS"'
data = ''
#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath +queryParams
#Get current time in milliseconds
epoch = str(int(time.time() * 1000))
#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath
#Construct signature
digest = hmac.new(
AccessKey.encode('utf-8'),
msg=requestVars.encode('utf-8'),
digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(digest.encode('utf-8')).decode('utf-8')
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + str(signature) + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth,'X-Version':'3'}
#Make request
response = requests.get(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)