Add & Update Time Entries
The Time tracking API allows you to access and manipulate time entries in similar fashion to using the daily timesheet view. This allows developers to create lightweight clients or widgets to track time beyond directly interacting with Harvest through the web browser.
Parameters
Parameter | Description |
---|---|
ID |
Time Entry ID |
Hours |
Number of (decimal time) hours tracked in this time entry |
Notes |
Time entry notes |
Project-ID |
Project ID that the time entry is associated with |
Spent-At |
Date of the time entry |
Task-ID |
Task ID that the time entry is associated with |
Client-ID |
Client ID that the time entry is associated with |
User-ID |
User ID that tracked this time entry |
Is-Billed |
true if the time entry has been marked as invoiced, false if uninvoiced |
Is-Closed |
true if the time entry has been approved via Timesheet Approval (no API support), false if un-approved |
Timer-Started-At |
Time (UTC) and date that timer was started (if tracking by duration) |
Hours-With-Timer |
The current amount of time tracked, if timer is running |
Hours-Without-Timer |
The current amount of time tracked, if timer is not running |
Started-At |
Starting timestamp of entry (if tracking time via start and end times) |
Ended-At |
Ending timestamp of entry (if tracking time via start and end times) |
Updated-At |
Time (UTC) and date that entry was last updated |
Created-At |
Time (UTC) and date that entry was created |
Creating an entry
POST https://YOURACCOUNT.harvestapp.com/daily/add
HTTP Response: 201 Created
Note: To start a timer, leave the hours
parameter blank.
Note: Omit the request wrapper when making this call over JSON.
Examples
Request:
<request>
<notes>Test API support</notes>
<hours>3</hours>
<project_id type="integer">5198193</project_id>
<task_id type="integer">2892243</task_id>
<spent_at type="date">Sun, Jan 24 2015</spent_at>
</request>
Reply:
<?xml version="1.0" encoding="UTF-8"?>
<add>
<day_entry>
<id type="integer">420934300</id>
<spent_at type="date">2016-01-24</spent_at>
<user_id type="integer">508343</user_id>
<client>Apple</client>
<project_id>5198193</project_id>
<project>14775</project>
<task_id>2892243</task_id>
<task>Backend Programming</task>
<hours type="float">3.00</hours>
<hours_without_timer type="float">3.00</hours_without_timer>
<notes>Test API support</notes>
<created_at type="datetime">Wed, 27 Jan 2016 21:52:50 +0000</created_at>
<updated_at type="datetime">Wed, 27 Jan 2016 21:52:50 +0000</updated_at>
</day_entry>
</add>
Request:
{
"notes": "Test API support",
"hours": 3,
"project_id": "5198193",
"task_id": "2892243",
"spent_at": "2016-1-24"
}
Reply:
{
"project_id": "5198193",
"project": "14775",
"user_id": 508343,
"spent_at": "2016-01-24",
"task_id": "2892243",
"task": "Backend Programming",
"client": "Apple",
"id": 420932553,
"notes": "Test API support",
"created_at": "2016-01-27T21:49:19Z",
"updated_at": "2016-01-27T21:49:19Z",
"hours_without_timer": 3,
"hours": 3
}
Note: If your account uses timestamp timers, you may alternatively POST a started_at
and ended_at
time:
<request>
<notes>Test API support</notes>
<started_at>8:00am</started_at>
<ended_at>9:00am</ended_at>
<project_id type="integer">5198193</project_id>
<task_id type="integer">2892243</task_id>
<spent_at type="date">Tue, 17 Oct 2015</spent_at>
</request>
{
"notes": "Test API support",
"started_at": "8:00am",
"ended_at": "9:00am",
"project_id": "5198193",
"task_id": "2892243",
"spent_at": "2015-11-24"
}
Toggling a timer
GET https://YOURACCOUNT.harvestapp.com/daily/timer/{DAY_ENTRY_ID}
HTTP Response: 200 OK
Note: If your account uses timesheet timestamps, timers cannot be restarted. Instead, a new timer will be created with the same project, task, and notes and be returned.
Deleting an entry
DELETE https://YOURACCOUNT.harvestapp.com/daily/delete/{DAY_ENTRY_ID}
HTTP Response: 200 OK
Updating an entry
POST https://YOURACCOUNT.harvestapp.com/daily/update/{DAY_ENTRY_ID}
HTTP Response: 200 OK
Note: If your account uses timesheet timestamps, you may alternatively POST a started_at
and ended_at
times in lieu of hours.
Examples
<request>
<notes>New notes.</notes>
<hours>1.07</hours>
<spent_at type="date">Tue, 17 Oct 2016</spent_at>
<project_id>52234</project_id>
<task_id>67567</task_id>
</request>
{
"notes": "New notes.",
"started_at": "8:00am",
"ended_at": "9:10am",
"project_id": "5198193",
"task_id": "2892243",
"spent_at": "2015-11-24"
}
Working with timesheets for other users
An Administrator can add the of_user= {USER_ID}
parameter to the URL of any time tracking API call in order to work with the timesheet of another user.
https://YOURACCOUNT.harvestapp.com/daily?of_user={USER_ID}
Working with locked timesheets
Administrators may edit and delete locked time entries. The following fields are considered read-only on locked time entries: project_id
, task_id
, spent_at
.