Test Fortinet APIs straight from your browser
Everything runs in this page (Swagger UI in JavaScript) — no app, no proxy. Requests go
directly from your browser to your device; the token is only sent there as
Authorization: Bearer … and is kept in this tab's session storage (gone when you close the
tab).
FortiGate — create a REST API admin and allow this site as a CORS origin:
config system api-user
edit "swagger"
set accprofile "super_admin_readonly"
set cors-allow-origin "https://fnsysctl.net"
set comment "This user has been creaate with the template of fnsysctl.net, please delete me once tested"
config trusthost
edit 1
set ipv4-trusthost <your-public-or-lan-ip> or use our IP
next
end
next
end
execute api-user generate-key swagger
Read-only on purpose. The template uses the
super_admin_readonly profile so the token has the least possible exposure — in case the API
user is forgotten and not removed after testing. Read calls (GET) and the API check work as is.
Want to test write calls (POST / PUT /
DELETE — Try it out sends real changes)? Change the API user's profile to one with
write access first, otherwise the device answers 403 Forbidden:
config system api-user
edit "swagger"
set accprofile "super_admin"
next
end
When you're done: set it back to super_admin_readonly, or better remove the user
completely with config system api-user → delete "swagger" → end.
Same principle on other products: give the API token a read-only admin profile unless you need writes.
- Other products need their own API token and must allow requests from
https://fnsysctl.net(CORS). Not every product offers a CORS setting — then the browser blocks the call and only the documentation part is usable. - FortiManager / FortiAnalyzer / FortiSandbox use JSON-RPC: every call is sent as
POST /jsonrpc; the target is theurlinside the request body. - Self-signed certificate? Open https://your-device once in a new tab and accept the warning.
“Failed to fetch” almost always means: CORS not allowed, certificate not accepted, trusthost doesn't include your IP, or your browser blocked access to a private network address (Chrome asks for permission — allow it).