FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
donghee
Staff
Staff
Article Id 418647
Description This article describes the steps to resolve API connection failure in FortiGate. It provides a solution to help users identify and fix the issue.
Scope FortiGate.
Solution

To resolve the API connection failure in FortiGate, follow these steps:

  1. Check the API key and trusted host configuration. Ensure that the API key is correctly generated and the trusted host is configured correctly.
  2. Verify the API connection settings. Check the API connection protocol, port, and IP address to ensure they are correctly configured.
  3. Check the FortiGate logs for any error messages related to API connections. Use the command below to enable debug logging and check the logs for any errors.

 

diagnose debug application httpsd -1

[httpsd 3063 - 1761726418 info] fweb_debug_init[451] -- New GET request for "/api/v2/monitor/system/status" from "10.20.16.30:57437"
[httpsd 3063 - 1761726418 info] fweb_debug_init[453] -- User-Agent: "curl/8.13.0"
[httpsd 3063 - 1761726418 info] fweb_debug_init[455] -- Handler "api_monitor_v2-handler" assigned to request
[httpsd 3063 - 1761726418 info] api_access_check_for_api_key[638] -- No api-user found.
[httpsd 3063 - 1761726418 warning] _lock_out_check_and_lock_out[411] -- Failed api-key login attempt from 10.20.16.30. (2/3 attempts within 60s).
[httpsd 3063 - 1761726418 info] fweb_debug_final[319] -- Completed GET request for "/api/v2/monitor/system/status" (HTTP 401 Unauthorized) <--------- If there is an HTTP 401 Unauthorized error in the httpsd debug log, the issue is likely related to API configuration or misuse.  

 

4. If the issue persists, try regenerating the API key and updating the trusted host configuration.

 

Additionally, ensure that the FortiGate is configured to allow API connections. Check the FortiGate configuration to ensure that the API connection is enabled and the correct protocol and port are used.

 

For more information on configuring API connections in FortiGate, refer to the document below. 

 

Related document:

REST API administrator