fortinet create api user via CLI
From cpwiki.net

To create a REST API administrator in the CLI:
config system api-user
edit "api-admin"
set comments <string>
set api-key ************
set accprofile "API profile"
set vdom "root"
set peer-auth enable
set peer-group <group>
config trusthost
edit 1
set ipv4-trusthost <class_ip&net_netmask>
next
...
end
next
end
Generate the API token:
# execute api-user generate-key <API username>