List Expense Categories and Create an Expense
Learn the expense categories and how to create an expense using the FreshBooks API.
In this lesson, we’ll list the default expense categories given by FreshBooks. Next, we’ll create our expenses. FreshBooks offers the facility to record the expenses that are incurred by your business.
The following two endpoints are discussed in this lesson:
- List expense categories:
/accounting/account/{ACCOUNT_ID}/expenses/categories
- Create an expense:
/accounting/account/{ACCOUNT_ID}/expenses/expenses
The endpoints of the expenses require the user:expenses:read
and user:expenses:write
scope permissions to perform the job.
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 /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.
Note: Please use the "Regenerate the Access Token" lesson in the appendix to regenerate the access token.
Get hands-on with 1400+ tech skills courses.