Hi bremboy79,
You don't have to use PHP. The Remote API (XML/JSON API) is an HTTP based API...PHP just happens to be the most common language that we see used.
What you'd do is make a call as root (or a reseller account with 'list-accts' privilege) to get a list of all the cPanel accounts, listaccts.
Next you'd make the cPanel API2 call Email::listpopswithdisk for each one of those accounts (which would produce a list of all email accounts for that cPanel user).
When you make the cPanel API2 call you can do it as the user (if you have their password) or you can do it as someone who has authority over them (aka, their reseller or root). If you perform cPanel API call as someone other than the user, make sure to use a WHM port.
The following code illustrates how one would make the calls if they were using the PHP client class that we provide; If you are familiar with another interpreted language (or shell scripting and cURL) then you should have little trouble porting the PHP client class and doing the illustrated logic below
PHP Code:
<?php
include "xmlapi.php";
$pass = 'someSecret';
$auser = 'root';
$server = "dev.david.tld"; //or IP address
$port = 2087;
$remote_api = new xmlapi($server);
// I'm using regular user/password authentication for simplicity
// Alternatively, you can use a password hash which would be almost as easy and
// absolve you from having to put the root password in plain text in a script
$remote_api->password_auth($auser, $pass);
$remote_api->set_port($port);
$remote_api->set_output('json');
// if you want to see debug in the console, uncomment the following line
// $remote_api->set_debug(1);
// get list of accounts
$json_list = $remote_api->xmlapi_query('listaccts', array( 'api.version'=> 1));
$list = json_decode($json_list, true);
if ( ! is_array($list)
|| ! array_key_exists('data', $list)
|| ! is_array($list['data'])
|| ! array_key_exists('acct', $list['data'])
) {
// do your own error handling here
die("Invalid response!");
}
// this will hold all the data we intend to get
$email_list = array();
// iterate through the cpanel accounts and fetch a list of their email accounts
foreach ($list['data']['acct'] as $acct) {
$username = $acct['user'];
$json_emails = $remote_api->api2_query($username, 'Email', 'listpopswithdisk', array());
$acct_emails = json_decode($json_emails, true);
if ( is_array($acct_emails)
&& array_key_exists('cpanelresult', $acct_emails)
&& is_array($acct_emails['cpanelresult'])
&& array_key_exists('data', $acct_emails['cpanelresult'])
&& is_array($acct_emails['cpanelresult']['data'])
) {
foreach ($acct_emails['cpanelresult']['data'] as $an_email) {
// store whatever detail you want for later use in your report;
// something like the following
array_push(
$email_list,
array(
'cpanel_account' => $username,
'domain' => $an_email['domain'],
'email' => $an_email['user'],
'full_email' => $an_email['email'],
)
);
}
}
}
# do something with the data...I'll just dump it for example purposes
var_dump($email_list);
?>
On my test server it shows me that I host only two email accounts on the entire server, each on a different domain, but ultimately owned by the same cPanel account...a real server would be quite different and have lots of data 
Code:
array(2) {
[0]=>
array(4) {
["cpanel_account"]=>
string(4) "dave"
["domain"]=>
string(16) "aioeiri21123.net"
["email"]=>
string(2) "t4"
["full_email"]=>
string(19) "t4@aioeiri21123.net"
}
[1]=>
array(4) {
["cpanel_account"]=>
string(4) "dave"
["domain"]=>
string(8) "dave.net"
["email"]=>
string(2) "t2"
["full_email"]=>
string(11) "t2@dave.net"
}
Regards,
-DavidN