PRODUCT DOCUMENTATION
SHARE TO SOCIAL

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

ParametersTypeDescription
fieldsStringThe 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
sizeIntegerIndicates 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
offsetIntegerIndicates the specified number of recommendations to skip before starting to return results.

Example—/cost-optimization/recommendations?offset=10
filterStringThe response is filtered according to the operator and specified value that is, filter=property:value
  • Filtering is supported only for the recommendationCategory and recommendationStatus fields.
  • The recommendationCategory field supports only a single value at a time. To get a list of available recommendation categories, use the GET /cost-optimization/recommendations/categories endpoint.
  • Only the Equals (:) operator is available when filtering using the recommendationStatus and recommendationCategory fields.

    Example—recommendationCategory:"Underutilized AWS EC2 instances"
  • For the recommendationStatus field, you can filter by multiple values using the OR (|) operator.

    Example—recommendationStatus:"SNOOZED"|"IGNORED"
  • When combining multiple filters for different fields, only the AND relation (represented by a comma (,) ) between filters can be used.

    Example—recommendationStatus:"SNOOZED",recommendationCategory:"Unattached Azure Disks"

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}

ParametersTypeDescription
idString(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
fieldsStringThe 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

ParameterTypeDescription
fieldsStringThe 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
sizeIntegerIndicates 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
offsetIntegerIndicates the specified number of categories to skip before starting to return results.

Example—/cost-optimization/recommendations/categories?offset=2
filterStringThe 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)