Expenses

Expenses that are not associated with a client are represented by client_id as 0. Staff have access to the API calls listed below, but they can only access expenses that belong to them or are assigned to clients they are assigned to.

IMPORTANT: Expense amounts include taxes. If Expense amount = $100 and tax percent = 5%, then tax amount should be $4.76. This is because the before tax amount is $95.24 and the 5% tax is $4.76, which yields a total of $100, the expense amount.

expense.create

Create a new expense specifically for a client, and optionally one of their projects, or keep it generalized for a number of clients. If successful, returns the expense_id of the newly created item.

  • staff_id is a required field only for admin users. It is ignored for staff using the API.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="expense.create">
  <expense>
    <staff_id>0</staff_id>          <!-- (Required) Your staff ID number -->
    <category_id>5</category_id>    <!-- (Required) The ID associated with categories like Automobile, Contractors, etc -->

    <project_id>10</project_id>     <!-- (Optional) Related project as ID -->
    <client_id>10</client_id>       <!-- (Optional) Specifically assigned to this client -->
    <amount>29.95</amount>          <!-- (Required) Associated cost -->
    <vendor>FreshBooks</vendor>     <!-- (Optional) Associated vendor name -->
    <date>2008-11-01</date>         <!-- (Optional) Applicable date -->

    <notes>Software package.</notes>     <!-- (Optional) -->

    <!-- Inputs from the status field are not saved. Values can be integers-->
    <status>1</status>

    <tax1_name></tax1_name>              <!-- (Optional) -->
    <tax1_percent></tax1_percent>        <!-- (Optional) -->
    <tax1_amount></tax1_amount>          <!-- (Optional) -->
    <tax2_name></tax2_name>              <!-- (Optional) -->
    <tax2_percent></tax2_percent>        <!-- (Optional) -->
    <tax2_amount></tax2_amount>          <!-- (Optional) -->
  </expense>
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://www.freshbooks.com/api/" status="ok">
  <expense_id>433</expense_id>
</response>

expense.update

Update an existing expense with the given expense_id. Any expense fields left out of the request will remain unchanged.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="expense.update">
  <expense>
    <expense_id>433</expense_id>     <!-- Expense to update -->

    <!-- Remaining arguments same as expense.create -->
  </expense>
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok"/>

expense.get

Return the complete expense details associated with the given expense_id.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="expense.get">
  <expense_id>433</expense_id>
</request>

Response

<?xml version="1.0"?>
<response xmlns="http://www.freshbooks.com/api/" status="ok">
  <expense>

  <expense_id>433</expense_id>
  <staff_id>0</staff_id>
  <category_id>5</category_id>
  <project_id>10</project_id>
  <client_id>10</client_id>
  <amount>29.95</amount>
  <date>2008-11-01</date>
  <notes>Software package.</notes>
  <folder>active</folder>
  <vendor>FreshBooks</vendor>

  <status>1</status>

  <tax1_name></tax1_name>
  <tax1_percent></tax1_percent>
  <tax1_amount></tax1_amount>
  <tax2_name></tax2_name>
  <tax2_percent></tax2_percent>
  <tax2_amount></tax2_amount>

  </expense>
</response>

expense.delete

Delete an existing expense.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="expense.delete">
  <expense_id>433</expense_id>
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok"/>

expense.list

Returns a list of expense summaries. You can filter by client_id, category_id, project_id, date_from, date_to or vendor optionally.

Note: This method uses pagination.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="expense.list">

  <!--Filter by client (Optional) -->
  <client_id>3</client_id>
  <!--Filter by date range (Optional) -->
  <date_from>2009-10-31</date_from>
  <date_to>2010-2-28</date_to>
  <!--One of 'active', 'archived', 'deleted' (Optional) -->
  <folder>active</folder>
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="http://www.freshbooks.com/api/" status="ok">
  <expenses page="1" per_page="10" pages="4" total="47">

    <expense>

      <expense_id>430</expense_id>
      <staff_id>1</staff_id>
      <category_id>5</category_id>
      <project_id>10</project_id>
      <client_id>10</client_id>
      <amount>29.95</amount>
      <date>2008-11-01</date>
      <notes>Hardware.</notes>
      <vendor>FreshBooks</vendor>
      <status>1</status> <!-- Can be 0 (not assigned), 1 (unbilled) or 2 (invoiced)-->
      <folder>active</folder>
      <tax1_name></tax1_name>
	  <tax1_percent></tax1_percent>
	  <tax1_amount></tax1_amount>
	  <tax2_name></tax2_name>
	  <tax2_percent></tax2_percent>
	  <tax2_amount></tax2_amount>

    </expense>
    <expense>

      <expense_id>433</expense_id>
      <staff_id>2</staff_id>
      <category_id>5</category_id>
      <project_id>10</project_id>
      <client_id>10</client_id>
      <amount>29.95</amount>
      <date>2008-11-01</date>
      <notes>Software package.</notes>
      <status>1</status>
      <folder>active</folder>
      <tax1_name></tax1_name>
	  <tax1_percent></tax1_percent>
	  <tax1_amount></tax1_amount>
	  <tax2_name></tax2_name>
	  <tax2_percent></tax2_percent>
	  <tax2_amount></tax2_amount>

    </expense>
    ...
  </expenses>
</response>

Search