×
FreshBooks
Official App
Free – Google Play
Get it

FreshBooks API Documentation

Quick Start

The column on the right hand side has a curl call that demonstrates the required Headers and general format of requests to the FreshBooks API.

Requests are authenticated using OAuth2 Bearer tokens which you receive in exchange for a code we issue after a logged-in user performs an authorization grant request. You can create an OAuth application and get a client id and secret at the developer page

Introduction

The FreshBooks API is an interface for accessing your FreshBooks data using JSON. The API makes it easy to create web and desktop applications that integrate with your account. Possible uses for it include automatically creating and sending invoices when users sign up on your website, pulling lists of client information, copying data to 3rd party services, and more.

Check out our Scenarios and API Reference sections to see what to expect, and when you're ready, sign up for a FreshBooks account if you don't have one, and proceed to the developer page to create an application and start development.

Required Headers

There are three required headers for most calls:

  1. Content-Type: application/json

  2. Api-Version: alpha

  3. Authorization: Bearer

We need those three to understand, properly route, and authenticate your call. The black code pane on this page shows an example of a call which sends these headers correctly.

Next Steps

If you don't have one, create a FreshBooks Account. Then visit the developer page to create an application, and follow our OAuth documentation to start issuing Bearer tokens and making authenticated calls.

Sending Invoice 142571

curl -X PUT \
  -H "Authorization: Bearer <a token>" \
  -H "Api-Version: alpha" \
  -H "Content-Type: application/json" \
  -d '{
        "invoice": {
          "email_subject": "Some Subject",
          "email_body": "sample email body",
          "action_email": true
        }
      }' \
"https://api.freshbooks.com/accounting/invoices/
     invoices/142571"

Sending Invoice 142571


url = "https://api.freshbooks.com/accounting/invoices/invoices/142571"
headers = {'Authorization': 'Bearer <Bearer Token>', 'Api-Version': 'alpha', 'Content-Type': 'application/json'}
payload = {"invoice": {
              "email_subject": "Some Subject", 
              "email_body": "sample email body", 
              "action_email": true 
              } 
          }
res = requests.put(url, data=json.dumps(payload), headers=headers)