Time Entries
Time Entries represent time spent working for a client or project.
Access Requirements
Access | Requires Authorization |
Scopes | user:time_entries:read |
Important Note
When using GET calls for Projects and Time Tracking, please leave out the Content Type from your header.
Includes
There are no includes for time entries.
Filters
Filter Type | Name | Description |
---|---|---|
Bool | billable | true returns entries that can be automatically added to an invoice |
Bool | billed | true returns entries that have already been added to an invoice |
Equals | client_id | matches exact client id |
Bool | include_deleted | true returns deleted time entries |
Bool | team | true returns entries logged by all members of the business |
Bool | include_unlogged | true returns entries currently in progress for a running timer |
Datetime | started_from | matches entries that take place at or after the specified UTC date/time |
Datetime | started_to | matches entries that take place before or at the specified UTC date/time |
Datetime | updated_since | matches entries that have been updated at or after the specified UTC date/time |
Int | identity_id | matches entries logged against a specific teammate or user |
Field Descriptions
underlined fields are required on creation
Field | Type | Description |
---|---|---|
billable | bool | True for entries that can be automatically added to an invoice |
billed | bool | True for entries that have already been added to an invoice or manually marked as billed |
client_id | int | The unique identifier of the client to be billed for this entry |
duration | int | The length of time in seconds |
internal | bool | True if the time entry is not assigned to a client |
is_logged | bool | False if the time entry is being created from a running timer |
note | string | A short description of the work being done during the time |
project_id | int | The unique identifier of the project worked on during the time |
service_id | int | The unique identifier of the project service worked on during the time |
started_at | int | The date/time in UTC when the work started |
identity_id | int | The unique identifier of the teammate or user logging the time entry |
Fetch time entries
Request:
GET https://api.freshbooks.com/timetracking/business/<business_id>/time_entries
Response:
{
"time_entries": [
{
"note": "Things",
"duration": 30,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
],
"meta": {
"pages": 1,
"total_logged": 30,
"total_unbilled": 30,
"per_page": 15,
"total": 1,
"page": 1
}
}
Fetch Time Entries for a given day
Request:
GET https://api.freshbooks.com/timetracking/business/<business_id>/time_entries?page=0&started_from=2016-08-17T04%3A00%3A00Z&started_to=2016-08-18T03%3A59%3A59Z
Response:
{
"time_entries": [
{
"note": "Things",
"duration": 30,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
],
"meta": {
"pages": 1,
"total_logged": 30,
"total_unbilled": 30,
"per_page": 4,
"total": 1,
"page": 1
}
}
Fetch Time Entries that have been updated since a precise time
Request:
GET https://api.freshbooks.com/timetracking/business/<business_id>/time_entries?updated_since=2015-08-01T03%3A00%3A00Z&include_deleted=1
{
"time_entries": [
{
"note": null,
"duration": null,
"project_id": 153125,
"client_id": 2149780,
"is_logged": false,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5097,
"timer": {
"id": 2938,
"is_running": true
}
},
{
"note": null,
"duration": null,
"project_id": null,
"client_id": 2149780,
"is_logged": false,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5098,
"timer": {
"id": 2939,
"is_running": true
}
},
{
"note": null,
"duration": null,
"project_id": null,
"client_id": 2149780,
"is_logged": false,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5096,
"timer": {
"id": 2937,
"is_running": true
}
},
{
"note": "Things",
"duration": 30,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
],
"meta": {
"pages": 1,
"total_logged": 30,
"total_unbilled": 30,
"per_page": 4,
"total": 4,
"page": 1
}
}
Create a Time Entry
Request:
POST https://api.freshbooks.com/timetracking/business/<business_id>/time_entries
{
"time_entry": {
"is_logged": true,
"duration": 7200,
"note": "Stuff",
"started_at": "2016-08-16T20:00:00.000Z",
"client_id": "2149780",
"identity_id":"8804571",
"project_id": "153125"
}
}
Response:
{
"time_entry": {
"note": "Stuff",
"duration": 7200,
"project_id": 153125,
"client_id": 2149780,
"is_logged": true,
"started_at": "2016-08-16T20:00:00Z",
"active": true,
"id": 5100,
"timer": null
}
}
Update a Time Entry
Request:
PUT https://api.freshbooks.com/timetracking/business/<business_id>/time_entries/<time_entry_id>
{
"time_entry": {
"is_logged": true,
"duration": 600,
"note": "Updated Note",
"started_at": "2016-08-16T18:03:28.000Z",
"timer": {
"id": "2936"
},
"client_id": "2227125",
"project_id": "153125"
}
}
Response:
{
"time_entry": {
"note": "Updated Note",
"duration": 600,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
}
Delete a Time Entry
Request:
DELETE https://api.freshbooks.com/timetracking/business/<business_id>/time_entries/<time_entry_id>
Response:
(status 204) NO CONTENT
Fetch time entries
Request: GET
https://api.freshbooks.com/timetracking/business/<business_id>/time_entries
url = "https://api.freshbooks.com/timetracking/business/<business_id>/time_entries"
headers = {'Authorization': 'Bearer <Bearer Token>', 'Api-Version': 'alpha', 'Content-Type': 'application/json'}
res = requests.get(url, data=None, headers=headers)
Response:
{
"time_entries": [
{
"note": "Things",
"duration": 30,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
],
"meta": {
"pages": 1,
"total_logged": 30,
"total_unbilled": 30,
"per_page": 15,
"total": 1,
"page": 1
}
}
Fetch Time Entries for a given day
Request: GET
https://api.freshbooks.com/timetracking/business/<business_id>/time_entries?page=0&started_from=2016-08-17T04%3A00%3A00Z&started_to=2016-08-18T03%3A59%3A59Z
url = "https://api.freshbooks.com/timetracking/business/<business_id>/time_entries?page=0&started_from=2016-08-17T04%3A00%3A00Z&started_to=2016-08-18T03%3A59%3A59Z"
headers = {'Authorization': 'Bearer <Bearer Token>', 'Api-Version': 'alpha', 'Content-Type': 'application/json'}
res = requests.get(url, data=None, headers=headers)
Response:
{
"time_entries": [
{
"note": "Things",
"duration": 30,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
],
"meta": {
"pages": 1,
"total_logged": 30,
"total_unbilled": 30,
"per_page": 4,
"total": 1,
"page": 1
}
}
Fetch Time Entries that have been updated since a precise time
Request: GET
https://api.freshbooks.com/timetracking/business/<business_id>/time_entries?updated_since=2015-08-01T03%3A00%3A00Z&include_deleted=1
url = "https://api.freshbooks.com/timetracking/business/<business_id>/time_entries?updated_since=2015-08-01T03%3A00%3A00Z&include_deleted=1"
headers = {'Authorization': 'Bearer <Bearer Token>', 'Api-Version': 'alpha', 'Content-Type': 'application/json'}
res = requests.get(url, data=None, headers=headers)
Response:
{
"time_entries": [
{
"note": null,
"duration": null,
"project_id": 153125,
"client_id": 2149780,
"is_logged": false,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5097,
"timer": {
"id": 2938,
"is_running": true
}
},
{
"note": null,
"duration": null,
"project_id": null,
"client_id": 2149780,
"is_logged": false,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5098,
"timer": {
"id": 2939,
"is_running": true
}
},
{
"note": null,
"duration": null,
"project_id": null,
"client_id": 2149780,
"is_logged": false,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5096,
"timer": {
"id": 2937,
"is_running": true
}
},
{
"note": "Things",
"duration": 30,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
],
"meta": {
"pages": 1,
"total_logged": 30,
"total_unbilled": 30,
"per_page": 4,
"total": 4,
"page": 1
}
}
Create a Time Entry
request: POST
https://api.freshbooks.com/timetracking/business/<business_id>/time_entries
url = "https://api.freshbooks.com/timetracking/business/<business_id>/time_entries"
headers = {'Authorization': 'Bearer <Bearer Token>', 'Api-Version': 'alpha', 'Content-Type': 'application/json'}
payload = {
"time_entry": {
"is_logged": true,
"duration": 7200,
"note": "stuff",
"started_at": "2016-08-16T20:00:00.000Z",
"client_id": "2149780",
"project_id": "153125"
}
}
Response:
{
"time_entry": {
"note": "Stuff",
"duration": 7200,
"project_id": 153125,
"client_id": 2149780,
"is_logged": true,
"started_at": "2016-08-16T20:00:00Z",
"active": true,
"id": 5100,
"timer": null
}
}
Update a Time Entry
Request: PUT
https://api.freshbooks.com/timetracking/business/<business_id>/time_entries/<time_entry_id>
url = "https://api.freshbooks.com/timetracking/business/<business_id>/time_entries/<time_entry_id>"
headers = {'Authorization': 'Bearer <Bearer Token>', 'Api-Version': 'alpha', 'Content-Type': 'application/json'}
payload = {
"time_entry": {
"is_logged": true,
"duration": 600,
"note": "Updated Note",
"started_at": 2016-08-16T18:03:28.000Z
"timer": {
"id": "2936"
},
"client_id": "2227125",
"project_id": "153125"
}
}
Response:
{
"time_entry": {
"note": "Updated Note",
"duration": 600,
"project_id": 153125,
"client_id": 2227125,
"is_logged": true,
"started_at": "2016-08-16T18:03:28Z",
"active": true,
"id": 5095,
"timer": {
"id": 2936,
"is_running": false
}
}
}
Delete a Time Entry
Request: DELETE
https://api.freshbooks.com/timetracking/business/<business_id>/time_entries/<time_entry_id>
url = "https://api.freshbooks.com/timetracking/business/<business_id>/time_entries/<time_entry_id>"
headers = {'Authorization': 'Bearer <Bearer Token>', 'Api-Version': 'alpha', 'Content-Type': 'application/json'}
res = requests.delete(url, data=None, headers=headers)
Response:
(Status 204) NO CONTENT