List Expense Categories and Create an Expense

Learn what are the expense categories and how to create an expense using the FreshBooks API.

Overview

The endpoints of the expenses require the user:expenses:read and user:expenses:write scope permissions to perform the job. The following two endpoints are discussed in this lesson:

  • List expense categories: {base_url}/accounting/account/{ACCOUNT_ID}/expenses/categories
  • Create an expense: {base_url}/accounting/account/{ACCOUNT_ID}/expenses/expenses

List expense categories

FreshBooks offers some default categories and sub-categories for grouping expenses, so tracking them becomes easier.

This section explains how we can get a list of all the default categories available for expenses. We use the https://api.freshbooks.com/accounting/account/{ACCOUNT_ID}/expenses/categories endpoint to get a list of expense categories.

Request parameters

This endpoint does not take any request parameters. However, we can add query parameters using include[]. The syntax to use include is as follows:

/expenses/categories?include[]=<VALUE>

We have two values that can be passed as a query parameter to include. These are as follows:

  • expense_usage_all_time: This parameter adds the expense usage in the category for all time.
  • expense_usage_this_year: This parameter includes the expense usage in the category for the current year.

Get hands-on with 1200+ tech skills courses.