readAccounts MultiBrand Only

The readAccounts function attempts to return the requested data for accounts that match the given accountFilter.


The readAccounts function may return 1 or many account objects. See the documentation on the accountObject for a list of the data fields that could potentially be returned.

Note: The data fields returned depend on the type of data you ask for in your request.


accountObject[] accounts = bApi.readAccounts( filter accountFilter, 
	      includeinfo, status, pageNumber );


Name Type Required Description
filter accountFilter Yes The accountFilter allows you to read data from a specific account(s).
includeInfo boolean Yes Returns the GeneralSettings[], ContactInformation[], FormatSettings[], RepliesSettings[], and AccountAllocations[] associated with the account.
status string No The status of the account. Valid values are unrestricted, restricted, and inactive. unrestricted means the account is active and can function normally. inactive means the account has been manually deactivated and cannot send mail. Users will not be able to login (from the UI or the API) to accounts with a status of inactive. restricted means the account has a low sender rating and its outgoing messages are being throttled. restricted and inactive accounts can’t be updated using updateAccounts.
pageNumber int Yes Retrieves the next “batch” of objects as the value specified increases from 1. In order to obtain an entire set of objects for a given call, you should increase the number value assigned to pageNumber until no more objects are returned.

PHP Code Example

 * This example will read the details of your Bronto account and
 * print out both the name of the account, and the current number of
 * active contacts in the account. You can filter for a specific accountObject
 * by account name.
$client = new SoapClient('', array('trace' => 1,
                                 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
try {
  $token = "YOUR API TOKEN";
  print "logging in\n";
  $sessionId = $client->login(array('apiToken' => $token))->return;
  $session_header = new SoapHeader("",
                   array('sessionId' => $sessionId));
  // example with account name filter
  $filter = array('type' => 'AND',
          'name' => array('operator' => 'EqualTo',
                  'value' => 'YOUR ACCOUNT NAME TO FILTER')
  // example with no filter
  //$filter = array();
  print "reading account details\n";
  $accounts = $client->readAccounts(array('pageNumber' => 1,
                      'includeInfo' => true,
                      'filter' => $filter,
  // print matching results
  foreach ($accounts as $account) {
    print "name: " . $account->name . "\n";
    print "current active contacts: " . $account->generalSettings->currentContacts . "\n";
} catch (Exception $e) {
  print "uncaught exception\n";