# Fortinet FortiGate

> Manage a FortiGate firewall: block and unblock IP addresses, keep address groups and policies up to date, check interfaces, VPN tunnels, routes, DHCP leases, firmware and logs, back up the configuration, and start workflows on security events, sign-in failures, configuration changes and links or tunnels going down.

App · 25 actions. Web page: https://docs.lodol.com/docs/integrations/fortinet-fortigate

## Actions

### Add to address group

Add firewall addresses to an address group, such as a block list a deny policy uses. Addresses already in it are left as they are.

**Inputs**

- Address group (`group`, text, required): The address group. Pick one, or give its name.
- Addresses (`addresses`, list, required): The addresses or groups to add.

**Outputs**

- `added` (list): The addresses added
- `already_members` (list): The addresses that were already in it
- `group` (text): The group
- `members` (list): Everything in the group now

**Example output**

```json
{
  "added": [
    "Blocked - 203.0.113.7"
  ],
  "already_members": [],
  "group": "Blocked hosts",
  "members": [
    "Blocked - 198.51.100.23",
    "Blocked - 203.0.113.7"
  ]
}
```

### Back up configuration

Get the FortiGate's configuration as text, as its own backup saves it, to store or compare. Passwords in it stay encrypted. Backing up the whole FortiGate needs an administrator profile with global access.

**Inputs**

- Scope (`scope`, text): Back up the whole FortiGate, or only the VDOM given when Fortinet FortiGate was connected. One of: `global` (Whole FortiGate (default)), `vdom` (Only the VDOM given when connecting). Default: `global`.

**Outputs**

- `configuration` (text): The configuration file's text
- `header` (text): Its first line, naming the model, version and build
- `scope` (text): global or vdom
- `size_bytes` (number): Its size in bytes

**Example output**

```json
{
  "configuration": "#config-version=FGT60F-7.4.4-FW-build2662-240514:opmode=0:vdom=0:user=lodol\n#conf_file_ver=1\n#buildno=2662\nconfig system global\n    set hostname \"HQ-FW01\"\nend\n",
  "header": "#config-version=FGT60F-7.4.4-FW-build2662-240514:opmode=0:vdom=0:user=lodol",
  "scope": "global",
  "size_bytes": 131
}
```

### Ban IP addresses

Ban (quarantine) IP addresses, so the FortiGate drops all their traffic, for a while or until removed.

**Inputs**

- IP addresses (`ip_addresses`, list, required): One or more IPv4 or IPv6 addresses, such as 203.0.113.7.
- For how long (`duration`, text): How long the ban lasts. One of: `3600` (1 hour), `86400` (1 day (default)), `604800` (1 week), `2592000` (30 days), `0` (Until removed). Default: `86400`.

**Outputs**

- `banned` (list): The addresses banned
- `count` (number): How many were returned
- `duration_seconds` (number): How long the ban lasts in seconds, 0 when permanent
- `permanent` (true/false): Whether the ban lasts until removed

**Example output**

```json
{
  "banned": [
    "203.0.113.7"
  ],
  "count": 1,
  "duration_seconds": 86400,
  "permanent": false
}
```

### Create firewall address

Create a firewall address for an IP address, subnet, range, domain name or country, to use in policies and address groups.

**Inputs**

- Name (`name`, text, required): The new address's name, unique on the FortiGate, such as Blocked - 203.0.113.7.
- Type (`address_type`, text): What the address matches. One of: `ipmask` (IP address or subnet), `iprange` (IP range), `fqdn` (Domain name (FQDN)), `geography` (Country). Default: `ipmask`.
- Subnet (`subnet`, text): An IP address or subnet, such as 203.0.113.7, 10.1.0.0/16 or 10.1.0.0 255.255.0.0. Only when Type is IP address or subnet.
- First IP (`start_ip`, text): The first address of the range, such as 10.0.0.10. Only when Type is IP range.
- Last IP (`end_ip`, text): The last address of the range, such as 10.0.0.50. Only when Type is IP range.
- Domain name (`fqdn`, text): A domain name, such as updates.example.com. Only when Type is Domain name (FQDN).
- Country (`country`, text): The two-letter country code, such as US or FR. Only when Type is Country.
- Interface (`interface`, text): Tie the address to one interface. Leave empty for any.
- Comment (`comment`, text): A comment shown in FortiGate.

**Outputs**

- `address` (object): The address, as it is now
- `created` (true/false): Always true once created

**Example output**

```json
{
  "address": {
    "cidr": "203.0.113.7/32",
    "comment": "Added by a Lodol workflow",
    "country": "",
    "end_ip": "",
    "fqdn": "",
    "interface": "",
    "name": "Blocked - 203.0.113.7",
    "start_ip": "",
    "subnet": "203.0.113.7 255.255.255.255",
    "type": "ipmask",
    "uuid": "6f3c2a1e-8a43-51ee-1c2a-7c9d0b1e4f2a"
  },
  "created": true
}
```

### Create firewall policy

Create an IPv4 firewall policy that accepts or denies traffic. It goes to the end of the list unless you place it above another policy.

**Inputs**

- Name (`name`, text, required): The policy's name, up to 35 characters.
- Incoming interfaces (`incoming_interfaces`, list, required): Where the traffic comes in, such as wan1.
- Outgoing interfaces (`outgoing_interfaces`, list, required): Where the traffic goes out, such as internal.
- Sources (`sources`, list, required): The source addresses or groups. Choose all for any address.
- Destinations (`destinations`, list, required): The destination addresses or groups. Choose all for any address.
- Services (`services`, list, required): The services it matches. Choose ALL for every service.
- Action (`policy_action`, text): Accept or deny the traffic. One of: `accept`, `deny`. Default: `accept`.
- Schedule (`schedule`, text): When the policy applies. Leave empty for always.
- NAT (`nat`, true/false): Translate the source address to the outgoing interface's, as for internet access. Only when Action is Accept.
- Logging (`log_traffic`, text): Which of its sessions to log. One of: `utm` (Security events only (default)), `all` (All sessions), `disable` (No logging). Default: `utm`.
- Enabled (`enabled`, true/false): Turn the policy on now. Defaults to on. Default: `true`.
- Comments (`comments`, text): A comment shown in FortiGate.
- Place above (`place_before`, text): Put the new policy just above this one, so it is checked first. Leave empty to add it at the end.

**Outputs**

- `created` (true/false): Always true once created
- `moved` (true/false): Whether it was placed above another policy
- `policy` (object): The policy, as it is now
- `policy_id` (number): The new policy's ID

**Example output**

```json
{
  "created": true,
  "moved": true,
  "policy": {
    "action": "deny",
    "comments": "Drops traffic from hosts on the block list",
    "dstaddr": [
      "all"
    ],
    "dstintf": [
      "internal"
    ],
    "enabled": true,
    "logtraffic": "all",
    "name": "Block bad hosts",
    "nat": false,
    "policy_id": 12,
    "schedule": "always",
    "service": [
      "ALL"
    ],
    "srcaddr": [
      "Blocked hosts"
    ],
    "srcintf": [
      "wan1"
    ],
    "status": "enable",
    "uuid": "9a8b7c6d-8a43-51ee-1c2a-7c9d0b1e4f2a"
  },
  "policy_id": 12
}
```

### Delete firewall address

Delete a firewall address. FortiGate refuses while a policy or address group still uses it.

**Inputs**

- Address (`name`, text, required): The firewall address. Pick one, or give its name.

**Outputs**

- `deleted` (true/false): Always true once deleted
- `name` (text): The deleted address

**Example output**

```json
{
  "deleted": true,
  "name": "Blocked - 203.0.113.7"
}
```

### Delete firewall policy

Delete a firewall policy.

**Inputs**

- Policy (`policy_id`, text, required): The firewall policy. Pick one, or give its ID number.

**Outputs**

- `deleted` (true/false): Always true once deleted
- `policy_id` (number): The deleted policy's ID

**Example output**

```json
{
  "deleted": true,
  "policy_id": 12
}
```

### Get firewall address

Get one firewall address by its name.

**Inputs**

- Address (`name`, text, required): The firewall address. Pick one, or give its name.

**Outputs**

- `address` (object): The address

**Example output**

```json
{
  "address": {
    "cidr": "203.0.113.7/32",
    "comment": "Added by a Lodol workflow",
    "country": "",
    "end_ip": "",
    "fqdn": "",
    "interface": "",
    "name": "Blocked - 203.0.113.7",
    "start_ip": "",
    "subnet": "203.0.113.7 255.255.255.255",
    "type": "ipmask",
    "uuid": "6f3c2a1e-8a43-51ee-1c2a-7c9d0b1e4f2a"
  }
}
```

### Get firewall policy

Get one firewall policy by its ID.

**Inputs**

- Policy (`policy_id`, text, required): The firewall policy. Pick one, or give its ID number.

**Outputs**

- `policy` (object): The policy

**Example output**

```json
{
  "policy": {
    "action": "deny",
    "comments": "Drops traffic from hosts on the block list",
    "dstaddr": [
      "all"
    ],
    "dstintf": [
      "internal"
    ],
    "enabled": true,
    "logtraffic": "all",
    "name": "Block bad hosts",
    "nat": false,
    "policy_id": 12,
    "schedule": "always",
    "service": [
      "ALL"
    ],
    "srcaddr": [
      "Blocked hosts"
    ],
    "srcintf": [
      "wan1"
    ],
    "status": "enable",
    "uuid": "9a8b7c6d-8a43-51ee-1c2a-7c9d0b1e4f2a"
  }
}
```

### Get firmware

Get the FortiOS version the FortiGate runs and the newer versions FortiGuard offers it.

**Inputs**: None.

**Outputs**

- `available` (list): Every version FortiGuard offers it
- `current` (object): The version it runs
- `latest_version` (text): The newest version offered, or the one it runs
- `newer` (list): The offered versions newer than it runs, newest first
- `update_available` (true/false): Whether a newer version is offered

**Example output**

```json
{
  "available": [
    {
      "build": 2702,
      "major": 7,
      "minor": 4,
      "patch": 5,
      "version": "v7.4.5"
    }
  ],
  "current": {
    "build": 2662,
    "major": 7,
    "minor": 4,
    "patch": 4,
    "version": "v7.4.4"
  },
  "latest_version": "v7.4.5",
  "newer": [
    {
      "build": 2702,
      "major": 7,
      "minor": 4,
      "patch": 5,
      "version": "v7.4.5"
    }
  ],
  "update_available": true
}
```

### Get resource usage

Get the FortiGate's current CPU, memory and disk use and its number of sessions.

**Inputs**: None.

**Outputs**

- `cpu_percent` (number): CPU in use, in percent
- `disk_percent` (number): Log disk in use, in percent
- `memory_percent` (number): Memory in use, in percent
- `session_setup_rate` (number): New sessions a second
- `sessions` (number): Sessions open now

**Example output**

```json
{
  "cpu_percent": 4,
  "disk_percent": 12,
  "memory_percent": 46,
  "session_setup_rate": 38,
  "sessions": 1532
}
```

### Get system status

Get the FortiGate's host name, model, serial number and FortiOS version.

**Inputs**: None.

**Outputs**

- `build` (number): Its FortiOS build number
- `hostname` (text): The FortiGate's host name
- `log_disk_status` (text): Whether it has a log disk, such as available
- `model` (text): Its model code, such as FGT60F
- `model_name` (text): Its product name, such as FortiGate
- `model_number` (text): Its model number, such as 60F
- `serial` (text): Its serial number
- `vdom` (text): The VDOM Lodol works in
- `version` (text): Its FortiOS version, such as v7.4.4

**Example output**

```json
{
  "build": 2662,
  "hostname": "HQ-FW01",
  "log_disk_status": "available",
  "model": "FGT60F",
  "model_name": "FortiGate",
  "model_number": "60F",
  "serial": "FGT60FTK21000001",
  "vdom": "root",
  "version": "v7.4.4"
}
```

### List address groups

List the FortiGate's address groups and the addresses in each.

**Inputs**

- Name contains (`name_contains`, text): Only those whose name or comment contains this text.

**Outputs**

- `count` (number): How many were returned
- `groups` (list): The groups

**Example output**

```json
{
  "count": 1,
  "groups": [
    {
      "comment": "Hosts the block policy denies",
      "members": [
        "Blocked - 203.0.113.7",
        "Blocked - 198.51.100.23"
      ],
      "name": "Blocked hosts",
      "uuid": "1d2e3f4a-8a43-51ee-1c2a-7c9d0b1e4f2a"
    }
  ]
}
```

### List banned IP addresses

List the IP addresses the FortiGate has banned (quarantined), by its intrusion prevention, DoS policies or an administrator, and when each ban ends.

**Inputs**: None.

**Outputs**

- `banned` (list): The banned addresses
- `count` (number): How many were returned

**Example output**

```json
{
  "banned": [
    {
      "created": "2026-11-17T09:30:12Z",
      "expires": "2026-11-18T09:30:12Z",
      "ip_address": "203.0.113.7",
      "ipv6": false,
      "permanent": false,
      "source": "ips"
    }
  ],
  "count": 1
}
```

### List DHCP leases

List the addresses the FortiGate's DHCP servers have handed out, with each device's MAC address and host name.

**Inputs**

- Interface (`interface`, text): Only leases on this interface. Leave empty for every interface.

**Outputs**

- `count` (number): How many were returned
- `leases` (list): The leases

**Example output**

```json
{
  "count": 1,
  "leases": [
    {
      "expires": "2026-11-18T09:41:52Z",
      "hostname": "frontdesk-pc",
      "interface": "internal",
      "ip": "192.168.1.110",
      "mac": "a4:83:e7:12:34:56",
      "reserved": false,
      "status": "leased",
      "vendor_class": "MSFT 5.0"
    }
  ]
}
```

### List event logs

List the FortiGate's newest event log entries of one kind, such as system events or VPN events.

**Inputs**

- Log (`log_type`, text): Which event log to read. One of: `system` (System (default)), `user` (User authentication), `vpn`, `router` (Routing), `ha` (High availability), `wireless`, `endpoint` (Endpoint control), `security-rating` (Security rating). Default: `system`.
- Kept in (`source`, text): Where the FortiGate keeps its logs. Models with a log disk keep them on disk. One of: `memory` (Memory (default)), `disk`. Default: `memory`.
- How many (`limit`, number): How many entries to return, 1 to 1,000. Defaults to 100. From 1 to 1000.
- Offset (`offset`, number): How many of the newest entries to skip. Use 'next_offset' from an earlier step to read on. At least 0.

**Outputs**

- `count` (number): How many were returned
- `log_type` (text): The log read
- `logs` (list): The entries, newest first
- `next_offset` (number): The offset of the entry after these
- `source` (text): memory or disk
- `total_lines` (number): How many entries the log holds

**Example output**

```json
{
  "count": 1,
  "log_type": "system",
  "logs": [
    {
      "action": "login",
      "date": "2026-11-17",
      "details": {
        "method": "https",
        "ui": "https(203.0.113.10)",
        "vd": "root"
      },
      "dstip": "198.51.100.2",
      "eventtime": "1763372512123456789",
      "level": "information",
      "logdesc": "Admin login successful",
      "logid": "0100032001",
      "msg": "Administrator admin logged in successfully from https(203.0.113.10)",
      "srcip": "203.0.113.10",
      "status": "success",
      "subtype": "system",
      "time": "09:41:52",
      "type": "event",
      "user": "admin"
    }
  ],
  "next_offset": 1,
  "source": "memory",
  "total_lines": 1
}
```

### List firewall addresses

List the FortiGate's firewall addresses, the named hosts, subnets, ranges and domains its policies match.

**Inputs**

- Name contains (`name_contains`, text): Only those whose name or comment contains this text.
- Type (`address_type`, text): Only addresses of this type. Leave empty for every type. One of: `ipmask` (IP address or subnet), `iprange` (IP range), `fqdn` (Domain name (FQDN)), `geography` (Country).

**Outputs**

- `addresses` (list): The addresses
- `count` (number): How many were returned

**Example output**

```json
{
  "addresses": [
    {
      "cidr": "203.0.113.7/32",
      "comment": "Added by a Lodol workflow",
      "country": "",
      "end_ip": "",
      "fqdn": "",
      "interface": "",
      "name": "Blocked - 203.0.113.7",
      "start_ip": "",
      "subnet": "203.0.113.7 255.255.255.255",
      "type": "ipmask",
      "uuid": "6f3c2a1e-8a43-51ee-1c2a-7c9d0b1e4f2a"
    }
  ],
  "count": 1
}
```

### List firewall policies

List the FortiGate's IPv4 firewall policies in the order they are checked, with what each matches and does.

**Inputs**

- Name contains (`name_contains`, text): Only those whose name or comment contains this text.
- Uses address (`address`, text): Only policies whose sources or destinations include this address or group.

**Outputs**

- `count` (number): How many were returned
- `policies` (list): The policies, in order

**Example output**

```json
{
  "count": 1,
  "policies": [
    {
      "action": "deny",
      "comments": "Drops traffic from hosts on the block list",
      "dstaddr": [
        "all"
      ],
      "dstintf": [
        "internal"
      ],
      "enabled": true,
      "logtraffic": "all",
      "name": "Block bad hosts",
      "nat": false,
      "policy_id": 12,
      "schedule": "always",
      "service": [
        "ALL"
      ],
      "srcaddr": [
        "Blocked hosts"
      ],
      "srcintf": [
        "wan1"
      ],
      "status": "enable",
      "uuid": "9a8b7c6d-8a43-51ee-1c2a-7c9d0b1e4f2a"
    }
  ]
}
```

### List interfaces

List the FortiGate's interfaces with their link status, address and traffic counts.

**Inputs**

- Interface (`interface_name`, text): Only this interface. Leave empty for every interface.

**Outputs**

- `count` (number): How many were returned
- `down_count` (number): How many have their link down
- `interfaces` (list): The interfaces, by name

**Example output**

```json
{
  "count": 1,
  "down_count": 0,
  "interfaces": [
    {
      "alias": "Internet",
      "ip": "198.51.100.2",
      "link_up": true,
      "mac": "00:09:0f:09:00:01",
      "mask": 24,
      "name": "wan1",
      "rx_bytes": 2919332001,
      "rx_errors": 0,
      "speed": 1000,
      "status": "up",
      "tx_bytes": 482193344,
      "tx_errors": 0
    }
  ]
}
```

### List IPsec VPN tunnels

List the FortiGate's IPsec VPN tunnels, whether each is up, and its traffic.

**Inputs**

- Tunnel (`tunnel`, text): Only the tunnel with this name. Leave empty for every tunnel.

**Outputs**

- `count` (number): How many were returned
- `down_count` (number): How many are down
- `tunnels` (list): The tunnels

**Example output**

```json
{
  "count": 1,
  "down_count": 0,
  "tunnels": [
    {
      "comments": "VPN to the branch office",
      "incoming_bytes": 18233411,
      "is_up": true,
      "name": "branch-office",
      "outgoing_bytes": 9922311,
      "phase2": [
        {
          "incoming_bytes": 18233411,
          "name": "branch-office",
          "outgoing_bytes": 9922311,
          "status": "up"
        }
      ],
      "remote_gateway": "203.0.113.50",
      "status": "up"
    }
  ]
}
```

### List routes

List the routes in the FortiGate's IPv4 routing table.

**Inputs**

- Interface (`interface`, text): Only routes out of this interface. Leave empty for every route.
- Destination contains (`destination_contains`, text): Only routes whose destination contains this text, such as 10.1.

**Outputs**

- `count` (number): How many were returned
- `routes` (list): The routes

**Example output**

```json
{
  "count": 1,
  "routes": [
    {
      "destination": "0.0.0.0/0",
      "distance": 10,
      "gateway": "198.51.100.1",
      "interface": "wan1",
      "is_tunnel_route": false,
      "metric": 0,
      "priority": 1,
      "type": "static"
    }
  ]
}
```

### Remove from address group

Remove firewall addresses from an address group. A group can't be left empty.

**Inputs**

- Address group (`group`, text, required): The address group. Pick one, or give its name.
- Addresses (`addresses`, list, required): The addresses or groups to remove.

**Outputs**

- `group` (text): The group
- `members` (list): Everything in the group now
- `not_members` (list): The addresses that weren't in it
- `removed` (list): The addresses removed

**Example output**

```json
{
  "group": "Blocked hosts",
  "members": [
    "Blocked - 198.51.100.23"
  ],
  "not_members": [],
  "removed": [
    "Blocked - 203.0.113.7"
  ]
}
```

### Set firewall policy status

Enable or disable a firewall policy.

**Inputs**

- Policy (`policy_id`, text, required): The firewall policy. Pick one, or give its ID number.
- Enabled (`enabled`, true/false, required): On to enable the policy, off to disable it.

**Outputs**

- `enabled` (true/false): Whether it is now enabled
- `policy` (object): The policy, as it is now
- `policy_id` (number): The policy's ID

**Example output**

```json
{
  "enabled": true,
  "policy": {
    "action": "deny",
    "comments": "Drops traffic from hosts on the block list",
    "dstaddr": [
      "all"
    ],
    "dstintf": [
      "internal"
    ],
    "enabled": true,
    "logtraffic": "all",
    "name": "Block bad hosts",
    "nat": false,
    "policy_id": 12,
    "schedule": "always",
    "service": [
      "ALL"
    ],
    "srcaddr": [
      "Blocked hosts"
    ],
    "srcintf": [
      "wan1"
    ],
    "status": "enable",
    "uuid": "9a8b7c6d-8a43-51ee-1c2a-7c9d0b1e4f2a"
  },
  "policy_id": 12
}
```

### Unban IP addresses

Lift the FortiGate's ban on IP addresses.

**Inputs**

- IP addresses (`ip_addresses`, list, required): One or more IPv4 or IPv6 addresses, such as 203.0.113.7.

**Outputs**

- `count` (number): How many were returned
- `unbanned` (list): The addresses unbanned

**Example output**

```json
{
  "count": 1,
  "unbanned": [
    "203.0.113.7"
  ]
}
```

### Update firewall address

Change a firewall address's value, comment, interface or name. What you leave empty stays as it is.

**Inputs**

- Address (`name`, text, required): The firewall address. Pick one, or give its name.
- New type (`address_type`, text): Change what the address matches. Leave empty to keep its type. One of: `ipmask` (IP address or subnet), `iprange` (IP range), `fqdn` (Domain name (FQDN)), `geography` (Country).
- Subnet (`subnet`, text): An IP address or subnet, such as 203.0.113.7, 10.1.0.0/16 or 10.1.0.0 255.255.0.0. Leave empty to keep it.
- First IP (`start_ip`, text): The first address of the range, such as 10.0.0.10. Leave empty to keep it.
- Last IP (`end_ip`, text): The last address of the range, such as 10.0.0.50. Leave empty to keep it.
- Domain name (`fqdn`, text): A domain name, such as updates.example.com. Leave empty to keep it.
- Country (`country`, text): The two-letter country code, such as US or FR. Leave empty to keep it.
- Interface (`interface`, text): Tie the address to one interface. Leave empty for any. Leave empty to keep it.
- Comment (`comment`, text): A comment shown in FortiGate. Leave empty to keep it.
- New name (`new_name`, text): Rename the address. Leave empty to keep it.

**Outputs**

- `address` (object): The address, as it is now
- `changed` (list): The fields that were changed
- `updated` (true/false): Always true once updated

**Example output**

```json
{
  "address": {
    "cidr": "203.0.113.7/32",
    "comment": "Added by a Lodol workflow",
    "country": "",
    "end_ip": "",
    "fqdn": "",
    "interface": "",
    "name": "Blocked - 203.0.113.7",
    "start_ip": "",
    "subnet": "203.0.113.7 255.255.255.255",
    "type": "ipmask",
    "uuid": "6f3c2a1e-8a43-51ee-1c2a-7c9d0b1e4f2a"
  },
  "changed": [
    "comment"
  ],
  "updated": true
}
```
