Valkyrian Labs logo

Installation

Install forti-api from the APT repository, vendor it, or build it from source.

Installation

forti-api is header-only. nlohmann/json 3.12.0 ships with it (installed under forti_api/third_party, so it never conflicts with a system nlohmann-json); libcurl is the only system dependency.

Requirements

A C++23 compiler is required; forti-api is tested with GCC 13 and 14 and with Apple Clang. Link libcurl.

Install forti-api

Pick the method that fits your project: the APT package (Debian and Ubuntu), the Homebrew formula (macOS and Linux), vendored headers, or a build from source.

libforti-api-dev is published to the ValkyrianLabs APT repository:

1sudo install -d -m 0755 /etc/apt/keyrings2sudo curl -fsSL https://apt.valkyrianlabs.com/pubkey.gpg \3  -o /etc/apt/keyrings/valkyrianlabs.gpg4sudo chmod 0644 /etc/apt/keyrings/valkyrianlabs.gpg5 6echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/valkyrianlabs.gpg] https://apt.valkyrianlabs.com stable main" | \7  sudo tee /etc/apt/sources.list.d/valkyrianlabs.list > /dev/null8 9sudo apt update10sudo apt install -y libforti-api-dev

The package installs the headers to /usr/include/forti_api and a pkg-config file:

1c++ -std=c++23 app.cpp $(pkg-config --cflags --libs forti-api)

With Meson, dependency('forti-api') finds it through pkg-config.

Install locations

MethodHeaderspkg-config file
APT/usr/include/forti_apiinstalled; pkg-config forti-api
Homebrewthe Homebrew prefixforti-api.pc in the Homebrew prefix
Vendoringwherever you copy include/ and third_party/nlohmann/include/none
Meson subprojectnot installednot installed
From source<prefix>/include/forti_api<prefix>/share/pkgconfig/forti-api.pc

Next steps

Quick start

Connect to a FortiGate and read, change and create objects.

Configuration

Environment variables and fortiapi::Config fields.