Updating User Details

Last updated on 31 May, 2024

You can use LogicMonitor REST API v3 to update user details. You must authenticate yourself before making the API request.

To make partial updates to a user, make a PATCH request. To completely update a user, make a PUT request.

URI: PATCH /setting/admins{ID}

URI: PUT /setting/admins{ID}


  • As per the REST standards, any property which is not specified in the PUT request will revert to its default value.
  • To update the password, set the query parameter changePassword=true in the request.
idInteger(Mandatory) The ID of the user that you want to update.
changePasswordBooleanTo change the user’s password, set "changePassword": true. By default, it is set as false.
lastNameStringThe last name of the user.
Example – "lastName": "Potter"
noteStringAdd a note about the user.
Example – "note": "Harry Potter has super admin role."
viewPermissionJSON ObjectThe Account tabs visible to the user.
Example – { "Resources" : true, "Websites" : true, "Reports" : true, "Dashboards" : true, "Alerts" : true, "Settings" : true, "Maps" : true, "Logs" : true, "Traces" : true }
timezoneStringThe timezone of the user.
Example – "timezone": "America/Los Angeles"
rolesJSON Object(Mandatory) The roles assigned to the user. It includes the account privileges of the role. Privileges can be added to a role for each area of the account. The name, description, and group ID of the role, if two-factor authentication is required for this role, if the user is required to acknowledge the EULA, and so on is specified for the role. If a user is assigned multiple roles, the user’s privileges are a sum of the privileges of each of the assigned roles.

For example, if one assigned role provides view only permission to all resources, but another assigned role provides manage permission to all resources, then the user has both the view and manage permissions for all resources. If yet another assigned role provides view permission for all dashboards, but no permission for resources, the user still has manage permission for all resources and additionally has view permission for all dashboards.
smsEmailFormatStringIndicates the sms or fullText format. For SMS, 160 characters and for full text, all characters are allowed.
Example – "smsEmailFormat": "sms"
apionlyBooleanIndicates if the user is a API only user.
Example – "apionly": true

API only users can only access LogicMonitor REST API. The only relevant fields to them are the Username, API Tokens, Roles, Status, and Notes. They do not have passwords or other user interface-specific fields, making them more secure as a dedicated user for an API-based integration.
apiTokensJSON ObjectThe API token of the user. The apiTokens consists of
  • note – Note for the API token. Example – "note": "Harry Potter's API Token"
  • status – Indicates if the API token is enabled. 1 indicates disabled and 2 indicates enabled.
"apiTokens": [
{ "note": "Harry Potter's API Token", "status": 2 }
adminGroupIdsIntegerGroup ID(s) of groups with admin. Multiple group IDs are separated by a comma.
Example – "adminGroupIds": 1,2,3
passwordString(Mandatory) The password of the user.
Example – "password": "hPo131"
emailString(Mandatory) The email address of the user.
Example – "email": "[email protected]"
contactMethodStringThe method to contact the user. The supported contact methods are email and smsemail.
Example – "contactMethod": "email"
smsEmailStringThe sms email address of the user.
Example – "smsEmail": [email protected]
twoFAEnabledBooleanIndicates if two factor authentication is enabled for the user.
Example – "twoFAEnabled": true
firstNameStringThe first name of the user.
Example – "firstName": "Harry"
phoneStringThe phone number of the user.
Example – "phone": "9091929394"
createdByStringDetails of the user who created the user. It may be another user, SAML, or LogicMonitor.
Example – "createdBy": "Chief Admin" 
forcePasswordChangeBooleanIndicates if the user should be forced to change the password during the next login.
Example – "forcePasswordChange": false
acceptEULABooleanIndicates if the user has to accept the End User License Agreement (EULA).
Example – "acceptEULA": false
usernameString(Mandatory) The username of the user.
Example – "username": "Harry"
statusStringThe status of the user. The supported values are active and suspended.
Example – "status": "active"

The following Python script updates the user Sara, including the user’s password (hence the changePassword=true in the request) in account api.logicmonitor.com

#!/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: ")
UserPassword = getpass.getpass("Enter password for user : ")
Company = 'apiAccount'  
#Request Info
httpVerb ='PUT'
resourcePath = '/setting/admins/147'
queryParams ='?changePassword=true'
data = '{"roles":[{"name":"administrator"}],"email":"[email protected]","username":"sara","password":"%s","status":"active"} % (UserPassword)'
#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(
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.put(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Python 3