Time Entries
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. If you don’t specify a staff_id, it will default to using staff.current’s staff_id. Note: You cannot assign staff to time entries of projects to which they aren’t assigned.
Request
<?xml version="1.0" encoding="utf-8"?>
<request method="time_entry.create">
<time_entry>
<project_id>1</project_id> <!-- (Required) -->
<task_id>1</task_id> <!-- (Required) -->
<staff_id>1</staff_id> <!-- (Optional) -->
<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 xmlns="https://www.freshbooks.com/api/" 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 xmlns="https://www.freshbooks.com/api/" status="ok">
<time_entry>
<time_entry_id>211</time_entry_id>
<staff_id>1</staff_id>
<project_id>1</project_id>
<task_id>1</task_id>
<hours>2</hours>
<date>2009-03-13</date>
<notes>Sample Notes</notes>
<billed>0</billed> <!-- 1 or 0 (Read Only) -->
</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_id>211</time_entry_id>
</request>
Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok"/>
time_entry.list
Returns a list of timesheet entries ordered according to date.
Note: This method uses pagination.
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 xmlns="https://www.freshbooks.com/api/" status="ok">
<time_entries page="1" per_page="15" pages="10" total="142">
<time_entry>
<time_entry_id>211</time_entry_id>
<staff_id>1</staff_id>
<project_id>1</project_id>
<task_id>1</task_id>
<hours>2</hours>
<date>2009-03-13</date>
<notes>Sample Notes</notes>
<billed>0</billed> <!-- 1 or 0 (Read Only) -->
</time_entry>
<time_entry>
...
</time_entry>
...
</time_entries>
</response>