FortiGate

Security API key FortiOS: using APIs

Read system status and firewall policies, list firewall addresses and keep address objects in a declared state on a FortiGate from any Windmill script, flow or app.

Set up in 3 steps

1

Create a REST API administrator

On the FortiGate, go to System > Administrators > Create New > REST API Admin. Give it an admin profile scoped to what your flows need, restrict trusted hosts to your Windmill workers' addresses, and copy the generated token. It is shown only once.

2

Add the resource

In Windmill, open Resources, add a FortiGate resource, and enter the FortiGate's HTTPS admin address (with the port if it isn't 443) and the token. If the FortiGate uses a private CA, trust that CA on your workers. The scripts never disable certificate checks.

3

Run your first script

Start with Get system status. On a multi-VDOM FortiGate, pass vdom to each script. Upsert firewall address runs as a dry run by default and returns the diff; set dry_run to false to apply it.

Scripts

Building blocks, if none of the projects above fit. Fork one, run it, or call it as a step inside your own flow.

Submit a script →

Resource type

The shape of the credential every script on this page expects.

FieldTypeRequiredWhat it is
base_urlstringYesHTTPS address of the FortiGate admin interface, e.g. https://fortigate.example.com (add :port if the admin HTTPS port is not 443). No trailing slash. The certificate must match this address and be trusted by the Windmill worker (DENO_CERT or SSL_CERT_FILE): a default self-signed certificate is rejected.
tokenstringYesAPI token generated when creating a REST API administrator (System > Administrators > Create New > REST API Admin). Sent as a Bearer token.

Questions

How do I page through large tables?

The list scripts take start and count and return next_start. Pass it back as start until it comes back null.

Can I manage FortiGates through FortiManager instead?

Yes. If your FortiGates are managed by FortiManager, use the FortiManager integration so changes go through policy packages and don't drift from the FortiManager database.

Is my token stored on the hub?

Never. It lives only in your own Windmill workspace, encrypted at rest.