API Reference
Complete SDK reference documentation for classes, methods, and type definitions in the HFortix-FortiOS library.
Note
Looking for API endpoints (CMDB, Monitor, Log, Service)? See API Endpoints for the complete endpoint catalog.
SDK Components
Main Client Classes
FortiOS REST API Client |
FortiOS is the single entry point for interacting with FortiOS devices.
It supports both synchronous (default) and asynchronous operation via the
mode parameter: FortiOS(host=..., token=..., mode="async").
API Handlers
The API handlers provide access to the four main API categories:
CMDB Handler - Configuration management (561 endpoints)
Monitor Handler - Status and statistics (490 endpoints)
Log Handler - Historical data queries (286 endpoints)
Service Handler - Operations and actions (11 endpoints)
See API Endpoints for complete endpoint documentation.
Response Objects
Zero-maintenance wrapper for FortiOS API responses. |
|
A list of FortiObject instances with convenient access to raw API response. |
|
Response wrapper for endpoints that return binary/text content. |
All endpoint methods return FortiObject (single object) or
FortiObjectList (collections); content-type endpoints return
ContentResponse.
Transactions
FortiOS batch transaction manager. |
|
Exception raised for transaction-related errors. |
Support for atomic configuration changes (FortiOS 6.4.0+) via
with fgt.transaction() as txn:.
Error Handling
Base exception for all Fortinet API errors |
|
Generic API error with optional metadata |
|
HTTP 401 - Authentication failed (invalid credentials) |
|
HTTP 403 - Authorization failed (insufficient permissions) |
|
HTTP 404 - Resource not found |
|
Duplicate entry exists (error code -5, -15, -100, etc.) |
|
Invalid value provided (error code -651, -1, -50, etc.) |
Exception classes re-exported from hfortix_core.exceptions. Note that
AuthenticationError and AuthorizationError inherit from
FortinetError directly, not from APIError.
Type Definitions
The library includes comprehensive type hints for all endpoints and operations. See the individual endpoint documentation for parameter types and return types.
Advanced Features
Observability & Debugging
The SDK includes built-in observability features:
Request/Response Logging
Performance Metrics
Audit Trail
Debug Mode
FortiManager Proxy
The SDK supports managing multiple FortiGates through FortiManager with automatic ADOM and device routing.
FortiManager Proxy Client. |
|
A FortiOS client that routes all API calls through FortiManager. |
Custom Wrappers
You can extend the client with your own custom methods and high-level abstractions
by subclassing or wrapping FortiOS.