Hello @Rostislav000 ,
You can't send cli commands to FortiGate via the API interface. FortiGate API has different API call URLs.
If you want to download the backup file via API you can use this request for that.
https://x.x.x.x/api/v2/cmdb/system/config/backup?scope=global&access_token=<Your_ACCESS_TOKEN_HERE>
Otherwise, you cannot get the entire configuration as API response output. If you want this, you need to call all API URL from FortiGate.
Also, I found one github link about that. You can use it if it works for you.
https://github.com/mcarneir0/fortigate-backup-api