# API: Get accounts

# getAccounts

Get list of accounts.

TIP

This API call uses pagination for results.

# Optional parameters

Parameter Description
filter[client_name] Filter by client name
filter[domain] Filter by domain
filter[product_id] Filter by product id
filter[status] Filter by status
filter[next_due] Filter by next due date, format: YYYY-MM-DD
filter[billingcycle] Filter by billing cycle
filter[server_id] Filter by server id
filter[form_name] Filter by form name
filter[category_id] Filter by related orderpage/category id
page Which page to return
list Status of accounts to list, possible values: all, all_active, all_pending, all_suspended, all_terminated, all_fraud, all_cancelled

# Request

GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=getAccounts

# PHP Samples

$url = 'http://url_to_hb.com/admin/api.php';
$post = [
  'call' => 'getAccounts',
  'api_id' => $API_ID,
  'api_key' => $API_KEY,

];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);

$return = json_decode($data, true);
print_r($return);
include 'class.hbwrapper.php';
HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key');
$params = [

];
$return = HBWrapper::singleton()->getAccounts($params);
print_r($return);
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = [

];
$return = $api->getAccounts($params);
print_r($return);

# Response

{
    "success": true,
    "accounts": [
        {
            "id": "49",
            "manual": "0",
            "domain": "ultimatehost.com",
            "billingcycle": "Hourly",
            "status": "Pending",
            "total": "6.00",
            "next_due": "2012-01-09",
            "name": "Ultimate",
            "type": "1",
            "lastname": "Customer",
            "firstname": "Random",
            "client_id": "2",
            "currency_id": "0"
        },
        {
            "id": "48",
            "manual": "0",
            "domain": "hostbasic.com",
            "billingcycle": "Monthly",
            "status": "Active",
            "total": "16.00",
            "next_due": "2012-01-09",
            "name": "Standard",
            "type": "1",
            "lastname": "Doe",
            "firstname": "John",
            "client_id": "1",
            "currency_id": "0"
        }
    ],
    "call": "getAccounts",
    "server_time": 1323445664,
    "info": [
        "order_created"
    ]
}
Last Updated: 9/30/2024, 2:47:06 PM