FortiGate API connection
Management API for config and policy features.
With FortiGate API connection, you can access Hotspot module, FortiGate View features, FortiGate ARP (IP-MAC mapping) table and FortiGate configuration settings. You can follow the steps below to activate the FortiGate API connection.
Note: Before you set up the API Connection, please go to Device > Device Settings Make sure your device is in the Registered Devices tab, otherwise An error will be received during the API connection. For device registration, you can review Add Device.
1 - Defining Profile for FortiGate
Go to System > Administrator Profiles on Fortigate. For FortiGate API and SSH connection, it is recommended to create a profile on FortiGate with the following rights.
Important Notice: If you want to use configuration backup service, the user to whom you provide the Fortigate Api connection must have a “Super_Admin” profile. Configuration backups taken outside of “Super_Admin” privileges may malfunction due to authorization restrictions. If you do not want to use the configuration backup service, you can define a profile with “Read-Only” authorization.
Note: “User & Device” right is used in Hotspot transactions. If you do not want to use the hotspot service, you can define a profile with “Read-Only” authorization.
| Module | Permission level |
|---|---|
| Hotspot | User & Device > Read/Write | System > Read |
| FortigateView | Read Only |
| ARP Table | Read Only |
| Fortigate Config Backup | Superadmin |
| All | Superadmin |

2 - Selecting Device to Authorize
Open the Unauthorized Devices tab on the Device > FortiGate API Settings page.
In the tab that opens, hover over your device and click the Authorize button.

3 - Defining Authorization Settings
FortiOS 7.6.4 and Later
- On the FortiGate, go to System > Administrator.
- Follow Create New > REST API admin.
- On the page that opens, enter a username and select the profile you created in the previous step in the Administrator Profile field.
- Disable the PKI Group and CORS Allow Origin fields. If you wish, you can enter Trusted Hosts for security.
- After completing the settings, click OK. After this step, your API Key appears in the New API key for FloggerRestApi field.
- Copy this API Key and keep it.
- Then go back to the FortiLogger interface and fill in the fields that open in the left menu:
- Enter the username, password and port. The port information may be different from the default port numbers according to the settings you have made before.
- Tick the I confirm that my version is 7.6.4 or above. box.
- Paste the API Key you copied into the API Key field.
- Finally, tick Enable SSH Connection and press the Connect Device button to complete the process.
After the processes are completed, the connection information will be displayed on Status / Description.
Important warning
Due to 5651 law, DHCP(IP/MAC Matching) logs must be recorded. If you are performing the IP distribution on your network through Fortigate, the SSH Connection must be open. If you are performing the IP distribution through the DHCP role on the Windows server, you need to install the FortiLoggerClient service. For this, you can review our Installing FortiloggerClient Service.
Before FortiOS 7.6.4
After entering the username, password and port in the left menu (the port information may be different from the default port numbers according to the settings you have made before), tick the Enable SSH Connection box.
Complete the process with the Connect Device button. After the processes are completed, the connection information will be displayed on Status / Description.
Important warning
Due to 5651 law, DHCP(IP/MAC Matching) logs must be recorded. If you are performing the IP distribution on your network through Fortigate, the SSH Connection must be open. If you are performing the IP distribution through the DHCP role on the Windows server, you need to install the FortiLoggerClient service. For this, you can review our Installing FortiloggerClient Service.

4 - Testing the API Connection
You can verify that the connection is successful by clicking the Get API Information button.

ARP Table (IP-MAC Mapping)
If your DHCP is served by the FortiGate, FortiLogger reads the FortiGate ARP table and keeps which IP address belongs to which MAC address. For this:
- The Enable SSH Connection option must be ticked in the device’s API connection; FortiLogger connects to the FortiGate over SSH and runs the
get system arpcommand. - Read Only permission for the ARP table is enough in the administrator profile.
FortiLogger updates the ARP table every 10 hours, so records may not appear right away if you have just set up the connection. You see the records on Tools > IP Arp Table Log (the page title is Arp Table). On this page:
- The table is grouped by device and lists the latest 2000 records.
- The columns are Device Id, Date, MAC Address, IP Address, Age and Interface.
- If one MAC address has several IP addresses, they are listed one under another in the IP Address cell.
- You can export the table with the EXCEL button.
FortiGate API connection video
Was this page helpful?
Thanks for your feedback!