Overview

Introduction

The Clientbill API is an interface for easily viewing and managing your Clientbill data using SOAP. This API guide will provide step by step helping using the Clientbill API to perform any task. All examples in this guide use the NuSOAP SOAP Toolkit


API URL

Your API URL is unique to your account and is derived from your URL:

https://myaccount.clientbill.com/soapserver.php

Authentication

All staff members have access to the API using their email address and password. Staff member's access to the Clientbill API is limited by their group permissions.
In this example we are logging in with the account 'myaccount@clientbill.com'. In the case of this example the response from the SOAP server is an array with two values. The first value is a boolean that is used to determine if an API call was successful or not. The second value contains the response from the Clientbill API. In this example, the response will be the authentication hash, used to identify yourself in subsequent API calls. See the API Responses for more information regarding this.

<?php
    
$client = new nusoap_client("http://myaccount.clientbill.com/soapserver.php"false);
    
    
$client->setUseCurl(true);
    
$client->useHTTPPersistentConnection();
    
    
$params = array(
        
'email'         => 'myaccount@clientbill.com',
        
'password'      => md5('my_password'),
    );

    
$response $client->call('cb_setAuthCredentials'$params);
    
    if(
$response[0] !== true)
    {
        echo 
"Error:" $response[1];
    }
    else
    {
        
$auth_string $response[1];
    }
?>

API Responses

Any call to a valid API function will result in an array with two values being returned.

The first value is a boolean flag that is set to true when the API call was successful and false when one or more errors that prevented the request from completed occurs.


Success response example

An example response from the cb_setAuthCredentials API function:

Array(
      [0] => true,
      [1] => 922f903f3f69933643aa08f3df1959a7
)

Failed response example

An example response from an API function call you do not have permission to access:

Array(
      [0] => false,
      [1] => <ul><li style="color:red;">Insufficient permissions to perform the requested operation.</li></ul>
)

The second value holds the response from the API function called. If an error occurred, this response will be a list of the errors that prevented the request from being completed. If no errors occurred, the response will hold the data that was requested via the API function call.