Skip to main content
hbac
Staff
Staff
May 7, 2026

Technical Tip: Changing admin password using REST API

  • May 7, 2026
  • 0 replies
  • 68 views

Description

This article describes how to change a super admin password using the REST API.

Scope

FortiGate.

Solution

First, create a REST API administrator by referring to this article: Technical Tip: How to create a REST API Admin user and assign it to an admin profile.


In this example, a 'curl' command was used to change an admin password.


curl -kv -X POST "https://192.168.1.99/api/v2/monitor/system/change-password/select" -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -d "{'mkey': 'admin', 'old_password': '<oldpassword>', 'new_password':'<newpassword>'}"


  1. Replace <token> with the actual API token.

  2. Replace <oldpassword> with the current super admin password.

  3. Replace <newpassword> with the desired new super admin password.

  4. Replace https://192.168.1.99 with the URL for accessing the FortiGate GUI including port number if not using 443.

  5. Replace 'admin' with the admin username for which the password will change.

Note: Make sure the REST API admin has enough privileges (Administrator profile) to change the password.


Related article:
Technical Tip: How to change local user's password using API