FreshBooks API Guide

Timesheet

Staff access

Staff have access to the API calls listed below if the Time Tracking tab is enabled for staff. Each staff member can only create time entries against projects to which he or she is assigned.

time_entry.create

Create a new timesheet entry

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="time_entry.create">
  <time_entry>
    <project_id>1</project_id>        # Associated project_id (Required)
    <task_id>1</task_id>              # Associated task_id    (Required)
    <hours>4.5</hours>                # (Optional)
    <notes>Phone consultation</notes> # (Optional)
    <date>2007-01-01</date>           # (Optional)
  </time_entry>
</request>

Response

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

time_entry.update

Update an existing time_entry.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="time_entry.update">
  <time_entry>
    <time_entry_id>211</time_entry_id>

    # Remaining params are same as time_entry.create
  </time_entry>
</request>

Response

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

time_entry.get

Retrieve a single time_entry record.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="time_entry.get">
  <time_entry_id>211</time_entry_id>
</request>

Response

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

time_entry.delete

Delete an existing time_entry. This action is not recoverable.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="time_entry.delete">
  <time_entry>211</time_entry>
</request>

Response

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

time_entry.list

Returns a list of timesheet entries in ordered according to date.

Filters

  • project_id
  • task_id
  • date_from
  • date_to

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="time_entry.list">
  <page>1</page>                        # The page number to show (Optional)
  <per_page>15</per_page>               # Number of results per page, default 25 (Optional)
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
  <time_entries page="1" per_page="15" pages="10" total="142">
    <time_entry>...</time_entry>
    <time_entry>...</time_entry>
    ...
  </time_entries>
</response>