FortiOS 5.6.11 Rest API - Reference
FortiOS 5.6.11 Rest API - Reference
Version 5.6.11
FORTINET DOCUMENT LIBRARY
https://docs.fortinet.com
FORTINET VIDEO GUIDE
https://video.fortinet.com
FORTINET BLOG
https://blog.fortinet.com
CUSTOMER SERVICE & SUPPORT
https://support.fortinet.com
NSE INSTITUTE
https://training.fortinet.com
FORTIGUARD CENTER
https://fortiguard.com/
FEEDBACK
Email: techdoc@fortinet.com
Change Log 5
Introduction 6
What's New in the REST API 6
Authentication 6
Session-based authentication 6
Token-based authentication 8
Authorization 11
Supported HTTP methods 11
Response codes 11
Debugging 12
CMDB API 14
URL path 14
URL parameters 14
Generic parameters 15
Specific parameters 15
Body data 16
Limitation 16
Filter with multiple key/value pairs 17
Filter Syntax 17
Filter Operators 17
Combining Filters 17
Reserved Characters 18
List of Methods 18
collection 19
resource 19
Examples 22
Retrieve table 22
Retrieve table schema 23
Retrieve table default 23
Purge table 23
Retrieve object 23
Create object 24
Edit object 24
Delete object 24
Clone object 24
Move object 25
Append child object 25
Edit child object 25
Delete child object 25
Purge child table 25
Retrieve complex table 26
This document provides the REST API information supported in FortiOS 5.6.11. This document covers a reference of
the REST API supported by the FortiOS GUI.
FortiOS 5.6.11 supports the following REST APIs:
l CMDB API
l Retrieve object meta data (default, schema)
l Retrieve object/table (with filter, format, start, count, other flags)
l Create object
l Modify object
l Delete object
l Clone object
l Move object
l Monitor API
l Retrieve/Reset endpoint stats (with filter, start, count)
l Perform endpoint operations
l Upload/Download file
l Restore/Backup config
l Upgrade/Downgrade firmware
l Restart/Shutdown FGT
Authentication
Starting in FortiOS 5.6.1, there are two ways that user can authenticate against the API:
l Session-based authentication (legacy)
l Token-based authentication (5.6.1 and newer)
Session-based authentication
As the name suggests, the authentication is valid per login session. The user needs to send a login request to obtain a
authentication cookie and CSRF token to be used for subsequent requests. The user then needs to send a logout
request to invalidate the authentication cookie and CSRF token.
Authentication Cookie
Authentication cookie (APSCOOKIE) is provided by the API after a successful login request. All subsequent requests
must include this cookie to be authorized by the API. Any request without the cookie or with mismatched cookie will be
denied access to the API (HTTP 401 error code).
CSRF Tokens
Cross-Site Request Forgery (CSRF) Tokens are alphanumeric values that are passed back-and-forth between client and
server to ensure that a user's form submission does not originate from an offsite document.
The CSRF token is available in the session ccsrftoken cookie, which must be included in the request header under
X-CSRFTOKEN. See test script sample for how to handle CSRF token.
Only write requests (HTTP POST/PUT/DELETE) need CSRF tokens. Read requests (HTTP
GET) do not require CSRF tokens.
To authenticate with the FortiGate and request a session, send a POST request to the log in request handler with your
username and password.
The request body must contain the following keys in URL form encoding:
ajax Int (1) Required: Format the response for easier parsing. Enable using 1.
Example:
POST /logincheck
username=AdminUser&secretkey=AdminPassword&ajax=1
Ensure that you're using the correct protocol. By default, a FortiGate? will redirect HTTP requests to HTTPS and your
login requests may fail. As well, FortiGate? 's will use a self-signed server certificate by default. Refer to the
documentation for the specific library or framework that you're using to validate the certificate manually.
The response to this request will be in the following format:
<status_code><javascript>
For most uses, you only need to read the first character of the response body to get the response status code.
Code Description
* In some cases users may receive a successful login status but not be completely authenticated, such as when there is
a post-login-banner configured.
** For Two-Factor log in, make another POST request with the same username and password, but include the token_
code parameter with the value of the one-time-password.
Once you've received a successful login status, read each Set-Cookie header and retain the following Cookies:
Name Description
APSCOOKIE_<NUMBER> This cookie authenticates you with the FortiGate . You must present this cookie
with every subsequent request you make after logging in.
ccsrftoken This is the (c)CSRF token. As described in Authorization on page 11, you must
provide the value of this cookie as a X-CSRFTOKEN header. *
*There may be two ccsrftoken cookies, one with a number suffix that matches the APSCOOKIE. For simplicity, you
don't need to locate that cookie and can rely on the ccsrftoken cookie.
Authenticated sessions will remain active with the device until any of the following occurs:
l The admin logs out
l The session remains inactive for longer than the timeout specified by the admintimeout setting in config
system global
l The admin is disconnected by another admin
There are a limited number of admins that can have active sessions on the device, therefore it's recommended that you
log out when you're finished using the device.
To log out, a POST request to the /logout URL will remove the current session.
Token-based authentication
The authentication is done via a single API token. This token is only generated once when creating an API admin. The
user must store this token in a safe place because it cannot be retrieved again. The user can however regenerate the
token at any time. Each API request must include the token in order to be authenticated as the associated API admin.
Only HTTPS access is allowed with token-based authentication to ensure maximum security.
In order to use the token-based authentication, user must first create a special API admin. The user can assign vdom
provision and admin profile to this API admin which defines the admin's privileges.
GUI does not allow user to pick super admin or prof_admin profile for API admin to
encourage user to use a special profile.
Trusted host
At least one trusted host must be configured for the API admin. The user can define multiple trusted host/subnet. IPv6
hosts are also supported.
PKI Certificate
Token-based also supports certificate matching as an extra layer of security (set PKI group in api-user). Both client
certificate and token must match to be granted access to the API. PKI option is enabled by default.
CORS permission
Token-based also supports Cross Origin Resource Sharing (CORS) allowing third-party web apps to make API requests
to FGT using the token. CORS is disabled by default.
After creating the api-user, user can generate new token via CLI command, GUI, or REST API. The token is only shown
once and cannot be retrieved after. The user needs to generate new token if they forget.
CLI command:
execute api-user generate-key [API user name]
The bearer of this API key will be granted all access privileges assigned to the api-user api-
admin.
REST API
The API token can be included in any REST API request via either request header or URL parameter
The user needs to explicitly add the following field to the request header: 'Authorization': 'Bearer ' +
[api_token]
Authorization: Bearer fccys3cfbhyhqbqghkyzm1QGNnm31r
The user needs to explicitly include the following field in the request URL parameter: access_token=[api_token]
Authorization
After the request is authenticated, the API will check if the associated admin has the permission to perform the
operation. Each admin or API admin has an admin profile and vdom scope which define the privileges of the admin. For
example, if the admin has vdom scope set to "vdom1" and a profile that only has read-only permission to Firewall
objects access group, the admin can only access vdom1 resource, and cannot make change to Firewall objects (policy,
address, etc).
Each endpoint requires specific group permission defined in 'Access Group' of the endpoint summary table. Request to
the endpoint will be checked against this access group to ensure the admin has proper permission to access the
resource. Make sure the administrative account you login with has the permissions required to perform the intended
actions.
Admin with read-only permission to the resource can only send read requests (HTTP GET) to the resource. Admin with
write permission to the resource can send read/write requests (HTTP GET/POST/PUT/DELETE) to the resource. Admin
with no permission to the resource cannot access the resource.
Request with insufficient profile permission will return 403 error.
For any action other than GET, you must provide the X-CSRFTOKEN header in the request. The value of this header is
the value of the ccsrftoken cookie that is provided by the FortiGate when you log in.
If the request is submitted using HTTP POST , the HTTP method can also be overridden using the "X-HTTP-Method-
Override" HTTP header.
Response codes
FortiOS APIs use well-defined HTTP status codes to indicate the results of queries to the API.
The following table shows how some of the HTTP status codes are used in the context of FortiOS REST APIs.
403 - Forbidden Request is missing CSRF token or administrator is missing access profile
permissions.
405 - Method Not Allowed Specified HTTP method is not allowed for this resource.
413 - Request Entity Too Large Request cannot be processed due to large entity.
424 - Failed Dependency Fail dependency can be duplicate resource, missing required parameter, missing
required attribute, invalid attribute value.
429 - Too many requests The request is actively blocked by FGT due to a rate limit. For example, if an
admin uses invalid credentials too many times, there will be a timeout before
they can try again.
500 - Internal Server Error Internal error when processing the request.
Debugging
Verbose debug output can be enabled in the FortiGate CLI with the following commands:
diagnose debug enable
diagnose debug application httpsd -1
This will produce the following output when the REST API for IPv4 policy statistics is queried:
[httpsd 228 - 1418751787] http_config.c[558] ap_invoke_handler -- new request (handler='api_
monitor_v2-handler', uri='/api/v2/monitor/firewall/policy', method='GET')
[httpsd 228 - 1418751787] http_config.c[562] ap_invoke_handler -- User-Agent: Mozilla/5.0
(Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/39.0.2171.71 Safari/537.36
[httpsd 228 - 1418751787] http_config.c[565] ap_invoke_handler -- Source: 192.168.1.100:56256
Destination: 192.168.1.99:443
[httpsd 228 - 1418751787] api_monitor.c[1427] api_monitor_v2_handler -- received api_monitor_
v2_request from '192.168.1.100'
[httpsd 228 - 1418751787] aps_access.c[3652] aps_chk_rolebased_perm -- truncated URI
(/api/v2/monitor/firewall/policy) to (/api/v2/monitor) for permission check
[httpsd 228 - 1418751787] api_monitor.c[1265] handle_req_v2_vdom -- attempting to change from
vdom "root" to vdom "root"
[httpsd 228 - 1418751787] api_monitor.c[1280] handle_req_v2_vdom -- new API request
(action='select',path='firewall',name='policy',vdom='root',user='admin')
[httpsd 228 - 1418751787] api_monitor.c[1286] handle_req_v2_vdom -- returning to original vdom
"root"
[httpsd 228 - 1418751787] http_config.c[581] ap_invoke_handler -- request completed
(handler='api_monitor_v2-handler' result==0)
This debug will also include all requests to/from the FortiOS web interface, in addition to
REST API requests.
CMDB API is used to retrieve and modify CLI configurations. For example, create/edit/delete firewall policy.
URL path
All CMDB requests start with '/api/v2/cmdb/'. Below is the format of CMDB URL path.
/api/v2/cmdb/<path>/<name>/<mkey>(optional)/<child_name>(optional)/<child_mkey>(optional)/
CMDB URL path follows CLI commands syntax with an exception of vdom configuration.
For operations on the entire table, mkey is not needed. For instance, add new entry, get all entries, purge table.
For operations on a specific resource, mkey is required. For example, edit/delete/clone/move a firewall policy.
For operations on the child table, child_name is required. For example, retrieve child table, purge child table, add new
entry to child table.
For operations on the child table entry, child_mkey is required. For example, delete/move child object.
URL parameters
In addition to the URL path, user can specify URL parameters which are appended to the URL path.
Generic parameters
Specific parameters
Each CMDB method may require extra URL parameters which are unique to the method. Those extra parameters are
documented in the "Extra Parameters" section of each CMDB method.
Below are some examples.
skip=1 GET Return a list of all firewall policy but only show
/api/v2/cmdb/firewall/policy/?skip=1 relevant attributes
filter=type== GET /api/v2/cmdb/firewall/address Return all addresses with type fqdn or ipmask
fqdn,type==ipmask&filter= /?filter=type==fqdn,type== which has visibility enabled
visibility==enable ipmask&filter=visibility==enable
Body data
Beside URL parameters, some POST/PUT requests also require body data, which must be included in the HTTP body.
For example, to create/edit firewall address object, user needs to specify the new/edit object data.
GET/DELETE requests do not accept body data.
Limitation
If the body data has the same name as some reserved URL parameters, such as name, path, or action, the request
would fail due to the conflict. For example, firewall policy has 'name' and 'action' attribute which conflict with the
reserved URL parameter 'name' and 'action'. POST/PUT with normal method would fail with 405 error. A workaround is
to enclosed all object data in a 'json' keyword so the API can correctly identify object data. For example:
Filtering multiple key/value pairs are also supported for all CMDB retrieval requests via 'filter' URL parameter.
Filter Syntax
Filter Operators
Operator Description
Combining Filters
Reserved Characters
The following characters need to be escaped if they are part of a filter pattern.
, \,
\ \\
List of Methods
resource GET default Return the CLI default values for this object type.
resource GET default Return the CLI default values for entire CLI tree.
resource GET schema Return the CLI schema for this object type.
collection
GET
Extra parameters
datasource boolean Enable to include datasource information for each linked object. No
with_meta boolean Enable to include meta information about each object (type id, No
references, etc).
skip boolean Enable to call CLI skip operator to hide skipped properties. No
filter string Comma separated list of key value pairs to filter on. Filters will be No
logically OR'd together.
key string If present, objects will be filtered on property with this name. No
pattern string If present, objects will be filtered on property with this value. No
resource
GET: default
Summary Return the CLI default values for this object type.
GET: default
Summary Return the CLI default values for entire CLI tree.
GET: schema
GET: schema
DELETE
POST
GET
Extra parameters
datasource boolean Enable to include datasource information for each linked object. No
with_meta boolean Enable to include meta information about each object (type id, No
references, etc).
skip boolean Enable to call CLI skip operator to hide skipped properties. No
PUT
PUT: move
Extra parameters
before string The ID of the resource that this resource will be moved before. No
after string The ID of the resource that this resource will be moved after. No
POST: clone
Extra parameters
DELETE
GET
Examples
Retrieve table
Purge table
Retrieve object
Create object
Edit object
PUT /api/v2/cmdb/ ?vdom=root {"entries":[{"id":1, Edit profile1 to add child object '1'
application/list/profile1 "application": which has child table 'applications',
[{"id":31236}, vdom root
{"id":31237}]}]}
Delete object
Clone object
Move object
Monitor API is used to perform specific actions on endpoint resources. For example, retrieve/close firewall sessions,
restart/shutdown FGT, backup/restore config file.
URL path
All Monitor API requests start with '/api/v2/monitor/'. Below is the format of Monitor URL path:
/api/v2/monitor/<uri>/
Each Monitor endpoint has a specific URI, which are provided by the URI field of each endpoint.
URL parameters
In addition to the URL path, user can specify URL parameters which are appended to the URL path.
Generic parameters
Specific parameters
Each Monitor endpoint may require extra URL parameters which are unique to the endpoint. Those extra parameters
are documented in the "Extra Parameters" section of each endpoint.
Required parameters are marked with "required: true" flag.
Below are some examples.
Body data
Beside URL parameters, some POST requests also require body data, which must be included in the HTTP body. The
extra body data are documented in "Extra Parameters" section of each endpoint.
GET requests do not accept body data.
Required body data are marked with "required: true" flag.
Below are some examples.
POST /api/v2/monitor/firewall/ {'pro': "udp", 'saddr': "192.168.100.110", Close the specific ipv4 firewall
session/close?vdom=root 'daddr': "96.45.33.73", 'sport': 55933, sessions
'dport': 8888}
File upload
File upload is supported for some endpoints. For example, upload VM license, restore config file. The upload file must
be stored in the HTTP body. There are two different methods to do so: via JSON data or multi-part file.
The upload file can be encoded directly into the HTTP body as JSON data using the 'file_content' field.
data={"source": "upload",
"scope": "vdom",
"file_content": b64encode(open("vd1.conf.txt", "r").read())})
Another way to store upload file in HTTP body is to include it as a multi-part file.
The multi-part file does not need to be encoded in base64 format.
For instance, below is how you can upload/restore config file via multi-part file using Python Requests module.
self.session.post(url='/api/v2/monitor/system/config/restore',
params={"vdom": "vdom1"},
data={"source": "upload",
"scope": "vdom"},
files=[('random_name',
('random_conf.conf', open("vd1.conf.txt", "r"), 'text/plain'))])
File download
File download is also supported in some endpoints. For example, download CA certificate, backup config file.
The downloaded file is stored in the response's raw content, not JSON data.
For example, here is the request to download global certificate name Fortinet_Factory, type local, scope
global:
GET /api/v2/monitor/system/certificate/download?mkey=Fortinet_Factory&type=local&scope=global
When sending file download request via a browser, the browser automatically checks the response's header for
'Content-Disposition': attachment. If present, the browser will download the file to local directory using the
name.
When sending file download request via a script, the script will need to manually perform the above steps to convert the
response's content into a file. For example, the script needs to check the response header for 'Content-
Disposition': attachment, and write the content into a local file with the given name.
List of Methods
firewall/acl/clear_counters/ POST Reset counters for one or more IPv4 ACLs by policy ID.
firewall/acl6/clear_counters/ POST Reset counters for one or more IPv6 ACLs by policy ID.
firewall/policy/clear_counters/ POST Reset traffic statistics for one or more IPv4 policies by policy
ID.
firewall/policy6/clear_counters/ POST Reset traffic statistics for one or more IPv6 policies by policy
ID.
firewall/proxy-policy/select/ GET List traffic statistics for all explicit proxy policies.
firewall/proxy-policy/clear_ POST Reset traffic statistics for one or more explicit proxy policies by
counters/ policy ID.
firewall/session/clear_all/ POST Immediately clear all active IPv4 and IPv6 sessions and IPS
sessions of current VDOM.
firewall/session/close/ POST Close a specific firewall session that matches all provided
criteria.
firewall/address-fqdns/select/ GET List of FQDN address objects and the IPs they resolved to.
firewall/address-dynamic/select/ GET List of Dynamic SDN address objects and the IPs they resolve
to.
firewall/address6-dynamic/select/ GET List of IPv6 Dynamic SDN address objects and the IPs they
resolve to.
fortiview/statistics/select/ GET Retrieve drill-down and summary data for FortiView (both
realtime and historical).
geoip/geoip-query/select/ GET Retrieve location details for IPs queried against FortiGuard's
geoip service.
license/database/upgrade/ POST Upgrade IPS database on this device using uploaded file.
license/forticare-resellers/select/ GET Get current FortiCare resellers for the requested country.
log/current-disk-usage/select/ GET Return current used, free and total disk bytes.
log/historic-daily-remote- GET Returns the amount of logs in bytes sent daily to a remote
logs/select/ logging service (FortiCloud or FortiAnalyzer).
log/stats/select/ GET Return number of logs sent by category per day for a specific
log device.
system/admin/toggle-vdom- POST Toggles VDOM mode on/off. Enables or disables VDOM mode
mode/ if it is disabled or enabled respectively.
system/api-user/generate-key/ POST Generate a new api-key for the specified api-key-auth admin.
The old api-key will be replaced. The response contains the
only chance to read the new api-key plaintext in the api_key
field.
system/global-resources/select/ GET Retrieve current usage of global resources as well as both the
default and user configured maximum values.
system/dhcp/select/ GET Returns a list of all DHCP IPv4 and IPv6 DHCP leases.
system/firmware/select/ GET Retrieve a list of firmware images available to use for upgrade
on this device.
system/firmware/upgrade/ POST Upgrade firmware image on this device using uploaded file.
system/fsck/start/ POST Set file system check flag so that it will be executed on next
device reboot.
system/resource/usage/ GET Retreive current and historical usage data for a provided
resource.
system/available- GET Retrieve a list of all interfaces along with some meta
interfaces/select/ information regarding their availability.
system/acquired-dns/select/ GET Retrieve a list of interfaces and their acquired DNS servers.
system/usb-log/start/ POST Start backup of logs from current VDOM to USB drive.
system/botnet/select/ GET List all known IP-based botnet entries in FortiGuard botnet
database.
system/compliance/run/ POST Immediately run compliance checks for the selected VDOM.
system/config/restore/ POST Restore system configuration from uploaded file or from USB.
system/object/usage/ GET Retrieve all objects that are currently using as well as objects
that can use the given object.
vpn-certificate/crl/import/ POST Import certificate revocation lists (CRL) from file content.
vpn-certificate/csr/generate/ POST Generate a certificate signing request (CSR) and a private key.
The CSR can be retrieved / downloaded from CLI, GUI and
REST API.
system/check-port- GET Check whether a list of TCP port ranges is available for a
availability/select/ certain service.
user/banned/add_users/ POST Immediately add one or more users to the banned list.
user/fortitoken/send-activation/ POST Send a FortiToken activation code to a user via SMS or Email.
user/fsso/refresh-server/ POST Refresh remote agent group list for all fsso agents.
webfilter/override/select/ GET List all administrative and user initiated webfilter overrides.
vpn/ssl/clear_tunnel/ POST Remove all active tunnel sessions in current virtual domain.
wifi/managed_ap/upgrade/ POST Upgrade firmware image on the given FortiAP using uploaded
file.
wifi/interfering_ap/select/ GET Retrieve a list of interfering APs for one FortiAP radio.
endpoint-control
profile: xml
URI endpoint-control/profile/xml/
Action xml
Extra parameters
registration-password: check
URI endpoint-control/registration-password/check/
Action check
Extra parameters
record-list: select
URI endpoint-control/record-list/select/
Action select
Extra parameters
intf_name string Filter: Name of interface where the endpoint was detected. No
registration: summary
URI endpoint-control/registration/summary/
Action summary
registration: quarantine
URI endpoint-control/registration/quarantine/
Action quarantine
Extra parameters
registration: unquarantine
URI endpoint-control/registration/unquarantine/
Action unquarantine
Extra parameters
registration: block
URI endpoint-control/registration/block/
Action block
Extra parameters
registration: unblock
URI endpoint-control/registration/unblock/
Action unblock
Extra parameters
registration: deregister
URI endpoint-control/registration/deregister/
Action deregister
Extra parameters
installer: select
URI endpoint-control/installer/select/
Action select
Extra parameters
min_version string Filter: Minimum installer version. (String of the format n[.n[.n]]). No
installer: download
URI endpoint-control/installer/download/
Action download
Extra parameters
avatar: download
URI endpoint-control/avatar/download/
Action download
Extra parameters
alias string Alias of the device. Used to lookup device avatar when endpoint No
avatar is not available.
firewall
health: select
URI firewall/health/select/
Action select
local-in: select
URI firewall/local-in/select/
Action select
acl: select
URI firewall/acl/select/
Action select
acl: clear_counters
Summary Reset counters for one or more IPv4 ACLs by policy ID.
URI firewall/acl/clear_counters/
Action clear_counters
Extra parameters
acl6: select
URI firewall/acl6/select/
Action select
acl6: clear_counters
Summary Reset counters for one or more IPv6 ACLs by policy ID.
URI firewall/acl6/clear_counters/
Action clear_counters
Extra parameters
internet-service-match: select
URI firewall/internet-service-match/select/
Action select
Extra parameters
policy: select
URI firewall/policy/select/
Action select
policy: reset
URI firewall/policy/reset/
Action reset
policy: clear_counters
Summary Reset traffic statistics for one or more IPv4 policies by policy ID.
URI firewall/policy/clear_counters/
Action clear_counters
Extra parameters
policy6: select
URI firewall/policy6/select/
Action select
policy6: reset
URI firewall/policy6/reset/
Action reset
policy6: clear_counters
Summary Reset traffic statistics for one or more IPv6 policies by policy ID.
URI firewall/policy6/clear_counters/
Action clear_counters
Extra parameters
proxy-policy: select
URI firewall/proxy-policy/select/
Action select
proxy-policy: clear_counters
Summary Reset traffic statistics for one or more explicit proxy policies by policy ID.
URI firewall/proxy-policy/clear_counters/
Action clear_counters
Extra parameters
policy-lookup: select
Summary Performs a policy lookup by creating a dummy packet and asking the kernel which
policy would be hit.
URI firewall/policy-lookup/select/
Action select
Extra parameters
session: select
URI firewall/session/select/
Action select
Extra parameters
session: clear_all
Summary Immediately clear all active IPv4 and IPv6 sessions and IPS sessions of current
VDOM.
URI firewall/session/clear_all/
Action clear_all
session: close
Summary Close a specific firewall session that matches all provided criteria.
URI firewall/session/close/
Action close
Extra parameters
session-top: select
URI firewall/session-top/select/
Action select
Extra parameters
filter object A map of filter keys to string values. The key(s) may be srcintf, No
source, dstintf, srcintfrole, dstintfrole, destination, policyid,
application, web_category_id, web_domain, country.
shaper: select
URI firewall/shaper/select/
Action select
shaper: reset
URI firewall/shaper/reset/
Action reset
load-balance: select
URI firewall/load-balance/select/
Action select
Extra parameters
address-fqdns: select
Summary List of FQDN address objects and the IPs they resolved to.
URI firewall/address-fqdns/select/
Action select
ippool: select
URI firewall/ippool/select/
Action select
address-dynamic: select
Summary List of Dynamic SDN address objects and the IPs they resolve to.
URI firewall/address-dynamic/select/
Action select
address6-dynamic: select
Summary List of IPv6 Dynamic SDN address objects and the IPs they resolve to.
URI firewall/address6-dynamic/select/
Action select
fortiview
statistics: select
Summary Retrieve drill-down and summary data for FortiView (both realtime and historical).
URI fortiview/statistics/select/
Action select
Extra parameters
session: cancel
URI fortiview/session/cancel/
Action cancel
Extra parameters
sandbox-file-details: select
URI fortiview/sandbox-file-details/select/
Action select
Extra parameters
checksum string Checksum of a specific file that has been analyzed by the connected Yes
FortiSandbox.
geoip
geoip-query: select
Summary Retrieve location details for IPs queried against FortiGuard's geoip service.
URI geoip/geoip-query/select/
Action select
Extra parameters
ip_addresses string One or more IP address strings to query for location details. Yes
ips
rate-based: select
URI ips/rate-based/select/
Action select
license
status: select
URI license/status/select/
Action select
database: upgrade
URI license/database/upgrade/
Action upgrade
Extra parameters
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
forticare-resellers: select
URI license/forticare-resellers/select/
Action select
Extra parameters
forticare-org-list: select
URI license/forticare-org-list/select/
Action select
log
current-disk-usage: select
URI log/current-disk-usage/select/
Action select
device: state
URI log/device/state/
Action state
forticloud: select
URI log/forticloud/select/
Action select
fortianalyzer: select
URI log/fortianalyzer/select/
Action select
Extra parameters
fortianalyzer-queue: select
Summary Retrieve information on FortiAnalyzer's queue state. Note:- FortiAnalyzer logs are
queued only if upload-option is realtime.
URI log/fortianalyzer-queue/select/
Action select
Extra parameters
hourly-disk-usage: select
URI log/hourly-disk-usage/select/
Action select
historic-daily-remote-logs: select
Summary Returns the amount of logs in bytes sent daily to a remote logging service
(FortiCloud or FortiAnalyzer).
URI log/historic-daily-remote-logs/select/
Action select
stats: select
Summary Return number of logs sent by category per day for a specific log device.
URI log/stats/select/
Action select
Extra parameters
stats: reset
URI log/stats/reset/
Action reset
forticloud-report: download
URI log/forticloud-report/download/
Action download
Extra parameters
ips-archive: download
Summary Download IPS/application control packet capture files. Uses configured log
display device.
URI log/ips-archive/download/
Action download
Extra parameters
pcap_no int Packet capture roll number (required when log device is 'disk') No
pcap_category int Packet capture category (required when log device is 'disk') No
policy-archive: download
URI log/policy-archive/download/
Action download
Extra parameters
av-archive: download
URI log/av-archive/download/
Action download
Extra parameters
router
ipv4: select
URI router/ipv4/select/
Action select
Extra parameters
count int Maximum number of entries to return (Default for all routes). No
ipv6: select
URI router/ipv6/select/
Action select
Extra parameters
count int Maximum number of entries to return (Default for all routes). No
statistics: select
URI router/statistics/select/
Action select
Extra parameters
ip_version int IP version (4|6). If not present, IPv4 and IPv6 will be returned. No
lookup: select
URI router/lookup/select/
Action select
Extra parameters
policy: select
URI router/policy/select/
Action select
policy6: select
URI router/policy6/select/
Action select
system
admin: toggle-vdom-mode
Summary Toggles VDOM mode on/off. Enables or disables VDOM mode if it is disabled or
enabled respectively.
URI system/admin/toggle-vdom-mode/
Action toggle-vdom-mode
api-user: generate-key
Summary Generate a new api-key for the specified api-key-auth admin. The old api-key will
be replaced. The response contains the only chance to read the new api-key
plaintext in the api_key field.
URI system/api-user/generate-key/
Action generate-key
Extra parameters
config-revision: select
URI system/config-revision/select/
Action select
config-revision: update-comments
URI system/config-revision/update-comments/
Action update-comments
Extra parameters
config-revision: delete
URI system/config-revision/delete/
Action delete
Extra parameters
config-revision: file
URI system/config-revision/file/
Action file
Extra parameters
config-revision: info
URI system/config-revision/info/
Action info
Extra parameters
config-revision: save
URI system/config-revision/save/
Action save
Extra parameters
current-admins: select
URI system/current-admins/select/
Action select
disconnect-admins: select
URI system/disconnect-admins/select/
Action select
Extra parameters
id int Admin ID No
time: set
URI system/time/set/
Action set
Extra parameters
year int Specifies the year for setting/updating time manually. Yes
month int Specifies the month (0 - 11) for setting/updating time manually. Yes
day int Specifies the day for setting/updating time manually. Yes
hour int Specifies the hour (0 - 23) for setting/updating time manually. Yes
minute int Specifies the minute (0 - 59) for setting/updating time manually. Yes
second int Specifies the second (0 - 59) for setting/updating time manually. Yes
time: select
URI system/time/select/
Action select
os: reboot
URI system/os/reboot/
Action reboot
Extra parameters
os: shutdown
URI system/os/shutdown/
Action shutdown
Extra parameters
global-resources: select
Summary Retrieve current usage of global resources as well as both the default and user
configured maximum values.
URI system/global-resources/select/
Action select
vdom-resource: select
Summary Retrieve VDOM resource information, including CPU and memory usage.
URI system/vdom-resource/select/
Action select
dhcp: select
Summary Returns a list of all DHCP IPv4 and IPv6 DHCP leases.
URI system/dhcp/select/
Action select
Extra parameters
scope string Scope from which to retrieve DHCP leases [vdom*|global]. Global No
scope is only accessible for global administrators.
dhcp: revoke
URI system/dhcp/revoke/
Action revoke
Extra parameters
dhcp6: revoke
URI system/dhcp6/revoke/
Action revoke
Extra parameters
firmware: select
Summary Retrieve a list of firmware images available to use for upgrade on this device.
URI system/firmware/select/
Action select
firmware: upgrade
URI system/firmware/upgrade/
Action upgrade
Extra parameters
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
firmware: upgrade-paths
URI system/firmware/upgrade-paths/
Action upgrade-paths
fsck: start
Summary Set file system check flag so that it will be executed on next device reboot.
URI system/fsck/start/
Action start
storage: select
URI system/storage/select/
Action select
change-password: select
URI system/change-password/select/
Action select
password-policy-conform: select
URI system/password-policy-conform/select/
Action select
csf: select
Summary Retrieve a full tree of downstream FortiGates registered to the Security Fabric.
URI system/csf/select/
Action select
modem: select
URI system/modem/select/
Action select
modem: reset
URI system/modem/reset/
Action reset
modem: connect
URI system/modem/connect/
Action connect
modem: disconnect
URI system/modem/disconnect/
Action disconnect
modem: update
URI system/modem/update/
Action update
3g-modem: select
URI system/3g-modem/select/
Action select
resource: usage
Summary Retreive current and historical usage data for a provided resource.
URI system/resource/usage/
Action usage
Extra parameters
sniffer: select
URI system/sniffer/select/
Action select
sniffer: restart
URI system/sniffer/restart/
Action restart
Extra parameters
sniffer: start
URI system/sniffer/start/
Action start
Extra parameters
sniffer: stop
URI system/sniffer/stop/
Action stop
Extra parameters
sniffer: download
URI system/sniffer/download/
Action download
Extra parameters
fsw: select
URI system/fsw/select/
Action select
Extra parameters
poe boolean Filter: Retrieve PoE statistics for ports of configured FortiSwitches. No
Port power usage is in Watt units.
port_stats boolean Filter: Retrieve tx/rx statistics for ports of configured FortiSwitches. No
fsw: update
URI system/fsw/update/
Action update
Extra parameters
fsw: restart
URI system/fsw/restart/
Action restart
Extra parameters
fsw: upgrade
Summary Upgrade firmware image on the given FortiSwitch using uploaded file.
URI system/fsw/upgrade/
Action upgrade
Extra parameters
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
fsw: poe-reset
URI system/fsw/poe-reset/
Action poe-reset
Extra parameters
fsw-firmware: select
URI system/fsw-firmware/select/
Action select
Extra parameters
switch-controller
managed-switch: dhcp-snooping
URI switch-controller/managed-switch/dhcp-snooping/
Action dhcp-snooping
managed-switch: faceplate-xml
URI switch-controller/managed-switch/faceplate-xml/
Action faceplate-xml
Extra parameters
validate-switch-prefix: select
URI switch-controller/validate-switch-prefix/select/
Action select
Extra parameters
interface: select
URI system/interface/select/
Action select
Extra parameters
available-interfaces: select
Summary Retrieve a list of all interfaces along with some meta information regarding their
availability.
URI system/available-interfaces/select/
Action select
Extra parameters
acquired-dns: select
URI system/acquired-dns/select/
Action select
resolve-fqdn: select
URI system/resolve-fqdn/select/
Action select
Extra parameters
usb-log: select
Summary Retrieve information about connected USB drives, including estimated log sizes.
URI system/usb-log/select/
Action select
usb-log: start
URI system/usb-log/start/
Action start
usb-log: stop
URI system/usb-log/stop/
Action stop
ipconf: select
URI system/ipconf/select/
Action select
Extra parameters
fortiguard: update
URI system/fortiguard/update/
Action update
fortiguard: clear-cache
URI system/fortiguard/clear-cache/
Action clear-cache
fortiguard: test-availability
URI system/fortiguard/test-availability/
Action test-availability
fortiguard: server-info
URI system/fortiguard/server-info/
Action server-info
fortimanager: status
URI system/fortimanager/status/
Action status
fortimanager: config
URI system/fortimanager/config/
Action config
available-certificates: select
URI system/available-certificates/select/
Action select
Extra parameters
certificate: download
URI system/certificate/download/
Action download
Extra parameters
debug: select
URI system/debug/select/
Action select
Extra parameters
debug: download
URI system/debug/download/
Action download
com-log: dump
URI system/com-log/dump/
Action dump
com-log: update
URI system/com-log/update/
Action update
com-log: download
URI system/com-log/download/
Action download
botnet: stat
URI system/botnet/stat/
Action stat
botnet: select
Summary List all known IP-based botnet entries in FortiGuard botnet database.
URI system/botnet/select/
Action select
Extra parameters
botnet-domains: select
Summary List all known domain-based botnet entries in FortiGuard botnet database.
URI system/botnet-domains/select/
Action select
Extra parameters
botnet-domains: stat
URI system/botnet-domains/stat/
Action stat
ha-statistics: select
URI system/ha-statistics/select/
Action select
ha-history: select
URI system/ha-history/select/
Action select
ha-checksums: select
URI system/ha-checksums/select/
Action select
ha-peer: select
URI system/ha-peer/select/
Action select
Extra parameters
serial_no string Serial number of the HA member. If not specified, fetch information No
for all HA members
vcluster_id int Virtual cluster number. If not specified, fetch information for all active No
vclusters
ha-peer: update
URI system/ha-peer/update/
Action update
Extra parameters
ha-peer: disconnect
URI system/ha-peer/disconnect/
Action disconnect
Extra parameters
interface string Name of the interface which should be assigned for management. Yes
mask string Full network mask to assign to the selected interface. Yes
link-monitor: select
URI system/link-monitor/select/
Action select
Extra parameters
compliance: run
URI system/compliance/run/
Action run
config: restore
URI system/config/restore/
Action restore
Extra parameters
source string Configuration file data source [upload | usb | revision]. Yes
usb_filename string When using 'usb' source: the filename to restore from the connected No
USB device.
config_id int When using 'revision' source: valid ID of configuration stored on disk No
to revert to.
scope string Specify global or VDOM only restore [global | vdom]. Yes
vdom string If 'vdom' scope specified, the name of the VDOM to restore No
configuration.
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
config: backup
URI system/config/backup/
Action backup
Extra parameters
usb_filename string When using 'usb' destination: the filename to save to on the No
connected USB device
scope string Specify global or VDOM only backup [global | vdom]. Yes
vdom string If 'vdom' scope specified, the name of the VDOM to backup No
configuration.
config: usb-filelist
URI system/config/usb-filelist/
Action usb-filelist
sandbox: status
URI system/sandbox/status/
Action status
sandbox: stats
URI system/sandbox/stats/
Action stats
object: usage
Summary Retrieve all objects that are currently using as well as objects that can use the
given object.
URI system/object/usage/
Action usage
Extra parameters
timezone: select
URI system/timezone/select/
Action select
vmlicense: upload
URI system/vmlicense/upload/
Action upload
Extra parameters
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
sensor-info: select
URI system/sensor-info/select/
Action select
audit: select
URI system/audit/select/
Action select
fortiguard-blacklist: select
URI system/fortiguard-blacklist/select/
Action select
Extra parameters
vpn-certificate
ca: import
URI vpn-certificate/ca/import/
Action import
Extra parameters
scep_url string SCEP server URL. Required for import via SCEP No
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
crl: import
URI vpn-certificate/crl/import/
Action import
Extra parameters
scope string Scope of CRL [vdom*|global]. Global scope is only accessible for No
global administrators
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
local: import
URI vpn-certificate/local/import/
Action import
Extra parameters
certname string Certificate name for pkcs12 and regular certificate types. No
password string Optional password for pkcs12 and regular certificate types. No
key_file_ string Key content encoded in BASE64 for regular certificate type. No
content
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
remote: import
URI vpn-certificate/remote/import/
Action import
Extra parameters
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
csr: generate
Summary Generate a certificate signing request (CSR) and a private key. The CSR can be
retrieved / downloaded from CLI, GUI and REST API.
URI vpn-certificate/csr/generate/
Action generate
Extra parameters
certname string Certicate name. Used to retrieve / download the CSR. Not included Yes
in CSR and key content.
subject string Subject (Host IP/Domain Name/E-Mail). Common Name (CN) of the Yes
certificate subject.
keytype string Generate a RSA or an elliptic curve certificate request [rsa|ec]. The Yes
Elliptic Curve option is unavailable if the FortiGate is a Low
Encryption Device (LENC)
orgunits array List of organization units. Organization Units (OU) of the certificate No
subject.
password string Password / pass phrase for the private key. If not provided, FortiGate No
generates a random one.
scep_url string SCEP server URL. If provided, use the url to enroll the csr through No
SCEP.
scep_password string SCEP challenge password. Some SCEP servers may require No
challege password. Provide it when SCEP server requires.
scope string Scope of CSR [vdom*|global]. Global scope is only accessible for No
global administrators
check-port-availability: select
Summary Check whether a list of TCP port ranges is available for a certain service.
URI system/check-port-availability/select/
Action select
Extra parameters
port_ranges array List of TCP port range objects to check against. Yes
service string The service in which the ports could be available. 'service' options are No
[reserved | sysglobal | webproxy | ftpproxy | sslvpn | slaprobe | fsso |
ftm_push]. If 'service' is not specified, the port ranges availablity is
checked against all services.
extender-controller
extender: select
URI extender-controller/extender/select/
Action select
Extra parameters
extender: reset
URI extender-controller/extender/reset/
Action reset
Extra parameters
user
firewall: select
URI user/firewall/select/
Action select
Extra parameters
firewall: deauth
URI user/firewall/deauth/
Action deauth
Extra parameters
user_type string User type [proxy|firewall]. Required for both proxy and firewall users. No
id int User ID. Required for both proxy and firewall users. No
ip string User IP address. Required for both proxy and firewall users. No
all boolean Set to true to deauthenticate all users. Other parameters will be No
ignored.
banned: select
URI user/banned/select/
Action select
banned: clear_users
URI user/banned/clear_users/
Action clear_users
Extra parameters
ip_addresses array List of banned user IPs to clear. IPv4 and IPv6 addresses are Yes
allowed.
banned: add_users
URI user/banned/add_users/
Action add_users
Extra parameters
ip_addresses array List of IP Addresses to ban. IPv4 and IPv6 addresses are allowed. Yes
banned: clear_all
URI user/banned/clear_all/
Action clear_all
fortitoken: select
URI user/fortitoken/select/
Action select
fortitoken: activate
URI user/fortitoken/activate/
Action activate
Extra parameters
tokens array List of FortiToken serial numbers to activate. If omitted, all tokens No
will be used.
device: select
URI user/device/select/
Action select
Extra parameters
fortilink_ boolean Add port and switch info for devices behind a managed FortiSwitch. No
visibility
intf_name string Filter: Name of interface where the device was detected. Only No
available when compliance_visibility is true.
master_mac string Filter: Master MAC of a device. Multiple entries could be returned. No
fortitoken: refresh
URI user/fortitoken/refresh/
Action refresh
Extra parameters
tokens array List of FortiToken serial numbers to refresh. If omitted, all tokens will No
be used.
fortitoken: provision
URI user/fortitoken/provision/
Action provision
Extra parameters
tokens array List of FortiToken serial numbers to provision. If omitted, all tokens No
will be used.
fortitoken: send-activation
URI user/fortitoken/send-activation/
Action send-activation
Extra parameters
token string FortiToken serial number. The token must be assigned to a Yes
user/admin.
sms_phone string Override SMS phone number. SMS provider must be set in the No
assigned user/admin.
fsso: refresh-server
Summary Refresh remote agent group list for all fsso agents.
URI user/fsso/refresh-server/
Action refresh-server
fsso: select
URI user/fsso/select/
Action select
utm
rating-lookup: select
URI utm/rating-lookup/select/
Action select
Extra parameters
app-lookup: select
Summary Query remote FortiFlow database to resolve hosts to application control entries.
URI utm/app-lookup/select/
Action select
Extra parameters
application-categories: select
URI utm/application-categories/select/
Action select
antivirus: stats
URI utm/antivirus/stats/
Action stats
virtual-wan
health-check: select
URI virtual-wan/health-check/select/
Action select
members: select
URI virtual-wan/members/select/
Action select
webfilter
override: select
URI webfilter/override/select/
Action select
override: delete
URI webfilter/override/delete/
Action delete
Extra parameters
malicious-urls: select
URI webfilter/malicious-urls/select/
Action select
malicious-urls: stat
URI webfilter/malicious-urls/stat/
Action stat
category-quota: select
URI webfilter/category-quota/select/
Action select
Extra parameters
category-quota: reset
URI webfilter/category-quota/reset/
Action reset
Extra parameters
fortiguard-categories: select
URI webfilter/fortiguard-categories/select/
Action select
Extra parameters
convert_ boolean Convert Unrated category id to the one for CLI use. No
unrated_id
trusted-urls: select
URI webfilter/trusted-urls/select/
Action select
vpn
ipsec: select
URI vpn/ipsec/select/
Action select
Extra parameters
ipsec: tunnel_up
URI vpn/ipsec/tunnel_up/
Action tunnel_up
Extra parameters
ipsec: tunnel_down
URI vpn/ipsec/tunnel_down/
Action tunnel_down
Extra parameters
ipsec: tunnel_reset_stats
URI vpn/ipsec/tunnel_reset_stats/
Action tunnel_reset_stats
Extra parameters
ssl: select
URI vpn/ssl/select/
Action select
ssl: clear_tunnel
URI vpn/ssl/clear_tunnel/
Action clear_tunnel
ssl: delete
URI vpn/ssl/delete/
Action delete
Extra parameters
ssl: stats
URI vpn/ssl/stats/
Action stats
wanopt
history: select
URI wanopt/history/select/
Action select
Extra parameters
history: reset
URI wanopt/history/reset/
Action reset
webcache: select
URI wanopt/webcache/select/
Action select
Extra parameters
webcache: reset
URI wanopt/webcache/reset/
Action reset
peer_stats: select
URI wanopt/peer_stats/select/
Action select
peer_stats: reset
URI wanopt/peer_stats/reset/
Action reset
webproxy
pacfile: download
URI webproxy/pacfile/download/
Action download
webcache
stats: select
URI webcache/stats/select/
Action select
Extra parameters
stats: reset
URI webcache/stats/reset/
Action reset
wifi
client: select
URI wifi/client/select/
Action select
Extra parameters
managed_ap: select
URI wifi/managed_ap/select/
Action select
Extra parameters
incl_local boolean Enable to include the local FortiWiFi device in the results. No
managed_ap: set_status
Summary Update administrative state for a given FortiAP (enable or disable authorization).
URI wifi/managed_ap/set_status/
Action set_status
Extra parameters
firmware: select
Summary Retrieve a list of current and recommended firmware for FortiAPs in use.
URI wifi/firmware/select/
Action select
Extra parameters
managed_ap: restart
URI wifi/managed_ap/restart/
Action restart
Extra parameters
managed_ap: upgrade
Summary Upgrade firmware image on the given FortiAP using uploaded file.
URI wifi/managed_ap/upgrade/
Action upgrade
Extra parameters
file_content string Provided when uploading a file: base64 encoded file data. Must not No
contain whitespace or other invalid base64 characters. Must be
included in HTTP body.
ap_status: select
URI wifi/ap_status/select/
Action select
interfering_ap: select
URI wifi/interfering_ap/select/
Action select
Extra parameters
euclid: select
URI wifi/euclid/select/
Action select
euclid: reset
URI wifi/euclid/reset/
Action reset
rogue_ap: select
URI wifi/rogue_ap/select/
Action select
Extra parameters
rogue_ap: clear_all
URI wifi/rogue_ap/clear_all/
Action clear_all
rogue_ap: set_status
URI wifi/rogue_ap/set_status/
Action set_status
Extra parameters
spectrum: select
URI wifi/spectrum/select/
Action select
Extra parameters
coverage
download: select
URI coverage/download/select/
Action select
Examples
POST /api/v2/monitor/ ?vdom=root {'policy': 1,} fwgrp.policy Reset traffic statistics for
firewall/policy6/ single IPv4 policy, vdom
clear_counters root
POST /api/v2/monitor/ ?vdom=root {'policy': [1, 2]} fwgrp.policy Reset traffic statistics for
firewall/policy6/ multiple IPv4 policies,
clear_counters vdom root
POST /api/v2/monitor/ ?vdom=root {'pro': "udp", 'saddr': sysgrp Immediately close specific
firewall/session/ "192.168.100.110", session matched with the
close 'daddr': "96.45.33. filter, vdom root
73", 'sport': 55933,
'dport': 8888}