Hi everyone,
Looking for help with a strange API authentication issue on one specific FortiGate.
Setup:
Problem: One firewall (let's call it FW-TEST) consistently returns HTTP 401 Unauthorized, while the exact same script works perfectly on the other 24 devices.
What I've tried:
Question: Has anyone encountered a situation where one FortiGate rejects API authentication while others with identical config work fine? Could there be hidden settings or firmware-specific quirks that affect API token validation?
Using FortiOS version if you know it, all devices on same version.
Any insights appreciated!
Thanks
Solved! Go to Solution.
You can try to run a debug on the non-working firewall while you test the API and see what the output is:
(global) # diagnose debug reset
(global) # diagnose debug enable
(global) # diagnose debug application httpsd -1
Thank you very much for your help!
I was then able to get the following logs:
[httpsd 903 - 1760533621 info] fweb_debug_init[610] -- New GET request for "/api/v2/monitor/system/config/backup" from "10.X.X.X:35924" [httpsd 903 - 1760533621 info] fweb_debug_init[612] -- User-Agent: "PostmanRuntime/7.48.0" [httpsd 903 - 1760533621 info] fweb_debug_init[614] -- Handler "api_monitor_v2-handler" assigned to request [httpsd 903 - 1760533621 warning] _extract_key_param[97] -- REST API key in URL parameters is disabled. [httpsd 903 - 1760533621 warning] _extract_key_param[97] -- REST API key in URL parameters is disabled. [httpsd 903 - 1760533621 info] fweb_debug_final[487] -- Completed GET request for "/api/v2/monitor/system/config/backup" (HTTP 401 Unauthorized)
Then I found the problem — the parameter set rest-api-key-url-query was disabled.
You need to enable it:
config system global set rest-api-key-url-query enable end
That solved the problem!
It’s still strange that this was the only firewall that needed that parameter activated — perhaps a new requirement of the 50G version?
Anyway, have a great day everyone!
You can try to run a debug on the non-working firewall while you test the API and see what the output is:
(global) # diagnose debug reset
(global) # diagnose debug enable
(global) # diagnose debug application httpsd -1
Thank you very much for your help!
I was then able to get the following logs:
[httpsd 903 - 1760533621 info] fweb_debug_init[610] -- New GET request for "/api/v2/monitor/system/config/backup" from "10.X.X.X:35924" [httpsd 903 - 1760533621 info] fweb_debug_init[612] -- User-Agent: "PostmanRuntime/7.48.0" [httpsd 903 - 1760533621 info] fweb_debug_init[614] -- Handler "api_monitor_v2-handler" assigned to request [httpsd 903 - 1760533621 warning] _extract_key_param[97] -- REST API key in URL parameters is disabled. [httpsd 903 - 1760533621 warning] _extract_key_param[97] -- REST API key in URL parameters is disabled. [httpsd 903 - 1760533621 info] fweb_debug_final[487] -- Completed GET request for "/api/v2/monitor/system/config/backup" (HTTP 401 Unauthorized)
Then I found the problem — the parameter set rest-api-key-url-query was disabled.
You need to enable it:
config system global set rest-api-key-url-query enable end
That solved the problem!
It’s still strange that this was the only firewall that needed that parameter activated — perhaps a new requirement of the 50G version?
Anyway, have a great day everyone!
User | Count |
---|---|
2640 | |
1400 | |
810 | |
685 | |
455 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.