FreshBooks is a web based accounting application that makes it easy for you to track the time you spend on projects and invoice your clients. The company behind it is very web savvy and has managed to deliver a well documented, easy to use API for third party integration. This module aims to provide a full integration of the FreshBooks API for use by this and other Drupal modules.

This module requires PHP5 with SimpleXML and cURL support.

Getting Started


This branch requires PHP 5.4 or higher, as that is the minimum for Drupal 8 core.

It uses the same library as the 7.x-3.x branch. The library, once install in sites/all/libraries (or your site-specific libraries folder), can be instantiated using the FreshBooksApiFactory, or, using the freshbooks.api service:

$api = Drupal::service('freshbooks.api');


This branch requires PHP 5.3 or higher, as the new client library uses namespaces. Unfortunately, this means that the objects returned by the API do not map to native PHP objects yet.

The modules requires the Libraries API module, and the FreshBooks API PHP client. You'll have to download the dev version and drop it in sites/all/libraries/freshbooks-api.


The only thing you need to do to get started is get your API credentials by browsing to the "Enable FreshBooks API" settings page in your account. Once you agree to the terms of service, an API URL and authentication token will be displayed. These must be plugged into the settings form at Administer > Settings > FreshBooks.

Once your API credentials have been entered, you can browse to the simple test page to make sure you can make the connection. The test attempts to establish a connection to FreshBooks and displays an appropriate message depending on whether or not your credentials authenticate.


NOTE: Version 2.x of the FreshBooks API module is a rewrite that wraps around the FreshBooks PHP library by Milan Rukavina. Its interface is not compatible with modules and site code that was written for version 1.x.

  1. Download the zip file for version 1.2 of the FreshBooks PHP library by Milan Rukavina. Later versions may be compatible, but have not been tested.
  2. Under your Drupal site folder, create a libraries folder (i.e. sites/ or sites/all/libraries).
  3. Extract the contents of the library/FreshBooks folder from the zip file into libraries/freshbooks-php. When done, the path from the root of the Drupal install to the file HttpClient.php should be something like sites/ or sites/all/libraries/freshbooks-php/HttpClient.php.
  4. Install the Libraries API module.
  5. Install the 2.x FreshBooks API module.
  6. Visit Administer > Site Configuration > FreshBooks to supply and test your FreshBooks API access credentials.

API Integration Status

The following FreshBooks API requests are currently supported:


  • Client requests - client.create, client.update, client.get, client.delete, client.list

The DrupalFreshBooks class also defines a custom method used to verify a set of API credentials.


The FreshBooks PHP library natively supports almost all of the FreshBooks API that was published on as of February 2, 2010.

FreshBooks Extended API

In addition, enabling the included "FreshBooks Extended API" sub-module adds support for features FreshBooks added on February 23, 2010, including auto-billing, webhooks, client "view links", and the following additional calls:

  • callback.create
  • callback.verify
  • callback.resendToken
  • callback.list
  • callback.delete

As of June 2010, the following API call is known to be unsupported:

  • gateway.list

If there is an API call that the FreshBooks API supports that this module does not appear to support, please open a feature request.

FreshBooks Webhooks API

Enabling the included "FreshBooks Webhooks API" sub-module (which depends upon the "FreshBooks Extended API" sub-module) enables a Drupal site to respond to Webhooks call-backs by implementing special Drupal hooks. See freshbooks_webhooks/hooks.php for examples and documentation on all currently known webhooks hook implementations.

The callback URI on the FreshBooks site should be set to the menu path freshbooks/callback on the Drupal site (i.e. The FreshBooks Webhooks API module will automatically verify the callback with FreshBooks using the callback.verify API call. Incoming Webhooks callbacks should also generate entries in the watchdog log.



Development by rszrama.


Development by GuyPaddock, sponsored by Red Bottle Design, LLC.

If you like version 2.x of this module, please consider making a donation to Red Bottle Design, LLC.

Supporting organizations: 
sponsored development of the 3.x branch.

Project information