Hello Samuel,
Very cool you shared what worked for you here. Many people have been through this problem, just as I have.
A tip, instead of putting API and filling all these login and password options, just fill this field:
$config['password_cpanel_webmail_host'] = 'mail.yourdomain.com';
The "cpanel_webmail" you added there at the beginning in $config['password_driver'] is pulling only the "cPanel Webmail Driver options" fields, so you don't need to fill the "cPanel Driver options" fields.
Remembering that the current cPanel version (100.0.5) is using the version 1.4.12 of Rouncube. As pointed out in the link below, the old "cpanel" driver (incompatible with the current cPanel because of XMLAPI.PHP) has been removed and the current "cpanel_webmail" has been renamed to "cpanel".
https://github.com/roundcube/roundcubemail/issues/7780 So you need to remember to change "cpanel_webmail" to "cpanel" in upcoming updates.