bin/api: much better output and error reporting.