Skip to main content
tnesh
Staff & Editor
Staff & Editor
Mar 22, 2026 10:01 PM UTC

Technical Tip: How to reset password & configure password policy for administrator using JSON API

Description

 

This article describes how to reset the password and configure the password policy for FortiManager/FortiAnalyzer administrators using JSON API.

 

Scope

 

FortiManager, FortiAnalyzer.

 

Solution

 

Following is the base URL for FortiManager/FortiAnalyzer API request:

 

POST : https://{{host}}/jsonrpc

 

Before taking any of the steps below, obtain the JSON API Session ID using the following API request.

Note: The session ID will be used in rest of the JSON API request.

 

{     "id": 1,     "method": "exec",     "params": [{         "data": {             "user": "{{admin}}",             "passwd": "{{password}}"         },         "url": "/sys/login/user"     }] }

 

Scenario 1: Reset the administrator password.

  • Username: fpc1.
  • New password:  Fortinet@123.
  • URL: "/cli/global/system/admin/user/{{username}}".

 

{     "method": "update",     "params": [         {             "data": {                     "password": "Fortinet@123"             },             "url": "/cli/global/system/admin/user/fpc1"         }     ],     "session": "{{session}}",     "verbose": 1,     "id": 1 }

 

Scenario 2: Configure password policy:

  • Enable password policy.
  • Minimum length for password.
  • Password to contain letters, numbers, alphanumeric characters.

 

{     "method": "update",     "params": [         {             "data": {                 "minimum-length": 8,                 "must-contain": [                     "upper-case-letter",                     "lower-case-letter",                     "number",                     "non-alphanumeric"                 ],                 "status": "enable"             },             "url": "/cli/global/system/password-policy"         }     ],     "session": "{{session}}",     "verbose": 1,     "id": 1 }

 

Here is the password policy once the API is run successfully:

 

pwd-policy.png

 

Related documents:

Technical Tip: Using FortiManager API

Fortinet Development Network (FNDN) - FortiManager

Technical Tip: How to create new administrator for FortiManager/FortiAnalyzer using JSON API

Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024