Skip to content

Automate FortiManager with Python objects#

pyfortinet is a Python library for the FortiManager JSON-RPC API. Work with addresses, groups, services, policies, and other supported resources as Python objects. The library handles session authentication, request construction, and typed GET responses.

Features#

  • High-level configuration models with Pydantic validation and API field aliases.
  • Synchronous and asynchronous clients with consistent object operations.
  • ADOM workspace locking and connection cleanup.
  • Background task polling with progress callbacks.
  • Dictionary requests and low-level clients for endpoints without a model.

Coverage is evolving. Check the code reference for available models and the target firmware's API reference for supported fields. Direct FortiGate connections, token/SAML authentication, and workflow session approval automation are not implemented.

Start with your task#

Goal Read
Install and connect Quickstart
Translate familiar JSON-RPC operations into Python API concepts
Manage objects, mappings, locks, and tasks How-tos
Find a resource by domain Object guides
Use addresses, services, VIPs, and IP pools Firewall families
Configure client behavior Advanced usage
Contribute or verify an implementation Developer guide

The code reference is generated from the library's docstrings and includes class and method examples. The user guide builds on that reference with complete workflows; the developer guide covers implementation and verification.