Time entries
GET TimeEntries
https://api.track.toggl.com/api/v9/me/time_entries
Lists latest time entries.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://api.track.toggl.com/api/v9/me/time_entries \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/me/time_entries")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/me/time_entries')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/me/time_entries", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.get('https://api.track.toggl.com/api/v9/me/time_entries', headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::GET, "https://api.track.toggl.com/api/v9/me/time_entries".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Query
name | type | required | description |
---|---|---|---|
meta | boolean | false | Should the response contain data for meta entities |
include_sharing | boolean | false | Include sharing details in the response |
Query
name | type | required | description |
---|---|---|---|
since | integer | false | Get entries modified since this date using UNIX timestamp, including deleted ones. |
before | string | false | Get entries with start time, before given date (YYYY-MM-DD) or with time in RFC3339 format. |
start_date | string | false | Get entries with start time, from start_date YYYY-MM-DD or with time in RFC3339 format. To be used with end_date. |
end_date | string | false | Get entries with start time, until end_date YYYY-MM-DD or with time in RFC3339 format. To be used with start_date. |
Response
200
Name | Type | Description |
---|---|---|
items | Array of object | - |
items
Name | Type | Description |
---|---|---|
at | string | When was last updated, the field follows the ISO 8601 format (HH:mm:ss.ssssssZ) |
billable | boolean | Whether the time entry is marked as billable |
client_name | string | Related entities meta fields - if requested |
description | string | null |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Used to create a TE with a duration but without a stop time, this field is deprecated for GET endpoints where the value will always be true. |
id | integer | Time Entry ID |
permissions | Array of string | Permission list |
pid | integer | Project ID, legacy field |
project_active | boolean | - |
project_billable | boolean | - |
project_color | string | - |
project_id | integer | null |
project_name | string | - |
shared_with | Array of object | Indicates who the time entry has been shared with |
start | string | Start time in UTC |
stop | string | Stop time in UTC, can be null if it's still running or created with "duration" and "duronly" fields |
tag_ids | Array of integer | Tag IDs, null if tags were not provided or were later deleted |
tags | Array of string | Tag names, null if tags were not provided or were later deleted |
task_id | integer | null |
task_name | string | - |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_avatar_url | string | - |
user_id | integer | Time Entry creator ID |
user_name | string | - |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID |
shared_with
Name | Type | Description |
---|---|---|
accepted | boolean | - |
user_id | integer | - |
user_name | string | - |
403
User does not have access to this resource.
500
Internal Server Error
GET Get current time entry
https://api.track.toggl.com/api/v9/me/time_entries/current
Load running time entry for user ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://api.track.toggl.com/api/v9/me/time_entries/current \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/me/time_entries/current")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/me/time_entries/current')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/me/time_entries/current", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.get('https://api.track.toggl.com/api/v9/me/time_entries/current', headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::GET, "https://api.track.toggl.com/api/v9/me/time_entries/current".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Response
200
Name | Type | Description |
---|---|---|
at | string | When was last updated, the field follows the ISO 8601 format (HH:mm:ss.ssssssZ) |
billable | boolean | Whether the time entry is marked as billable |
client_name | string | Related entities meta fields - if requested |
description | string | null |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Used to create a TE with a duration but without a stop time, this field is deprecated for GET endpoints where the value will always be true. |
id | integer | Time Entry ID |
permissions | Array of string | Permission list |
pid | integer | Project ID, legacy field |
project_active | boolean | - |
project_billable | boolean | - |
project_color | string | - |
project_id | integer | null |
project_name | string | - |
shared_with | Array of object | Indicates who the time entry has been shared with |
start | string | Start time in UTC |
stop | string | Stop time in UTC, can be null if it's still running or created with "duration" and "duronly" fields |
tag_ids | Array of integer | Tag IDs, null if tags were not provided or were later deleted |
tags | Array of string | Tag names, null if tags were not provided or were later deleted |
task_id | integer | null |
task_name | string | - |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_avatar_url | string | - |
user_id | integer | Time Entry creator ID |
user_name | string | - |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID |
shared_with
Name | Type | Description |
---|---|---|
accepted | boolean | - |
user_id | integer | - |
user_name | string | - |
403
User does not have access to this resource.
404
Resource can not be found
500
Internal Server Error
GET Get a time entry by ID.
https://api.track.toggl.com/api/v9/me/time_entries/{time_entry_id}
Load time entry by ID that is accessible by the current user.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://api.track.toggl.com/api/v9/me/time_entries/{time_entry_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/me/time_entries/{time_entry_id}")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/me/time_entries/{time_entry_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/me/time_entries/{time_entry_id}", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.get('https://api.track.toggl.com/api/v9/me/time_entries/{time_entry_id}', headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::GET, "https://api.track.toggl.com/api/v9/me/time_entries/{time_entry_id}".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
time_entry_id | integer | true | TimeEntry ID. |
Query
name | type | required | description |
---|---|---|---|
meta | boolean | false | Should the response contain data for meta entities |
include_sharing | boolean | false | Include sharing details in the response |
Response
200
Name | Type | Description |
---|---|---|
at | string | When was last updated, the field follows the ISO 8601 format (HH:mm:ss.ssssssZ) |
billable | boolean | Whether the time entry is marked as billable |
client_name | string | Related entities meta fields - if requested |
description | string | null |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Used to create a TE with a duration but without a stop time, this field is deprecated for GET endpoints where the value will always be true. |
id | integer | Time Entry ID |
permissions | Array of string | Permission list |
pid | integer | Project ID, legacy field |
project_active | boolean | - |
project_billable | boolean | - |
project_color | string | - |
project_id | integer | null |
project_name | string | - |
shared_with | Array of object | Indicates who the time entry has been shared with |
start | string | Start time in UTC |
stop | string | Stop time in UTC, can be null if it's still running or created with "duration" and "duronly" fields |
tag_ids | Array of integer | Tag IDs, null if tags were not provided or were later deleted |
tags | Array of string | Tag names, null if tags were not provided or were later deleted |
task_id | integer | null |
task_name | string | - |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_avatar_url | string | - |
user_id | integer | Time Entry creator ID |
user_name | string | - |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID |
shared_with
Name | Type | Description |
---|---|---|
accepted | boolean | - |
user_id | integer | - |
user_name | string | - |
404
Resource can not be found
500
Internal Server Error
POST TimeEntries
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries
Creates a new workspace TimeEntry.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries \
-H "Content-Type: application/json" \
-d '\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries", {
method: "POST",
body: \{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\},
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.post('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries', json=\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}, headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::POST, "https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries".to_string())
.json(&serde_json::json!(\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Numeric ID of the workspace |
Query
name | type | required | description |
---|---|---|---|
meta | boolean | false | Should the response contain data for meta entities |
Body
Name | Type | Description |
---|---|---|
billable | boolean | Whether the time entry is marked as billable, optional, default false |
created_with | string | Must be provided when creating a time entry and should identify the service/application used to create it |
description | string | Time entry description, optional |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Deprecated: Used to create a time entry with a duration but without a stop time. This parameter can be ignored. |
event_metadata | object | - |
pid | integer | Project ID, legacy field |
project_id | integer | Project ID, optional |
shared_with_user_ids | Array of integer | List of user IDs to share this time entry with |
start | string | Start time in UTC, required for creation. Format: 2006-01-02T15:04:05Z |
start_date | string | If provided during creation, the date part will take precedence over the date part of "start". Format: 2006-11-07 |
stop | string | Stop time in UTC, can be omitted if it's still running or created with "duration". If "stop" and "duration" are provided, values must be consistent (start + duration == stop) |
tag_action | string | Can be "add" or "delete". Used when updating an existing time entry |
tag_ids | Array of integer | IDs of tags to add/remove |
tags | Array of string | Names of tags to add/remove. If name does not exist as tag, one will be created automatically |
task_id | integer | Task ID, optional |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_id | integer | Time Entry creator ID, if omitted will use the requester user ID |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID, required |
event_metadata
Name | Type | Description |
---|---|---|
origin_feature | string | - |
visible_goals_count | integer | - |
Response
200
A workspace TimeEntry.
Name | Type | Description |
---|---|---|
at | string | When was last updated, the field follows the ISO 8601 format (HH:mm:ss.ssssssZ) |
billable | boolean | Whether the time entry is marked as billable |
client_name | string | Related entities meta fields - if requested |
description | string | null |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Used to create a TE with a duration but without a stop time, this field is deprecated for GET endpoints where the value will always be true. |
id | integer | Time Entry ID |
permissions | Array of string | Permission list |
pid | integer | Project ID, legacy field |
project_active | boolean | - |
project_billable | boolean | - |
project_color | string | - |
project_id | integer | null |
project_name | string | - |
shared_with | Array of object | Indicates who the time entry has been shared with |
start | string | Start time in UTC |
stop | string | Stop time in UTC, can be null if it's still running or created with "duration" and "duronly" fields |
tag_ids | Array of integer | Tag IDs, null if tags were not provided or were later deleted |
tags | Array of string | Tag names, null if tags were not provided or were later deleted |
task_id | integer | null |
task_name | string | - |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_avatar_url | string | - |
user_id | integer | Time Entry creator ID |
user_name | string | - |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID |
shared_with
Name | Type | Description |
---|---|---|
accepted | boolean | - |
user_id | integer | - |
user_name | string | - |
403
User does not have access to this resource.
500
Internal Server Error
PATCH Bulk editing time entries
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_ids}
In short: http://tools.ietf.org/html/rfc6902 and http://tools.ietf.org/html/rfc6901 with some additions. Patch will be executed partially when there are errors with some records. No transaction, no rollback.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_ids} \
-H "Content-Type: application/json" \
-d '[\{"op":"string","path":"string","value":\{\}\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"op":"string","path":"string","value":\{\}\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_ids}", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_ids}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"op":"string","path":"string","value":\{\}\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_ids}", {
method: "PATCH",
body: [\{"op":"string","path":"string","value":\{\}\}],
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.patch('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_ids}', json=[\{"op":"string","path":"string","value":\{\}\}], headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::PATCH, "https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_ids}".to_string())
.json(&serde_json::json!([\{"op":"string","path":"string","value":\{\}\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Numeric ID of the workspace |
time_entry_ids | string | true | Numeric IDs of time_entries, separated by comma. E.g.: 204301830,202700150,202687559 . The limit is 100 IDs per request. |
Query
name | type | required | description |
---|---|---|---|
meta | boolean | false | Should the response contain data for meta entities |
Body
Name | Type | Description |
---|---|---|
items | Array of object | - |
items
Name | Type | Description |
---|---|---|
op | string | Operation (add/remove/replace) |
path | string | The path to the entity to patch (e.g. /description) |
value | object | The new value for the entity in path. |
value
Response
200
Name | Type | Description |
---|---|---|
failure | Array of object | - |
success | Array of integer | The IDs for which the patch was succesful. |
failure
Name | Type | Description |
---|---|---|
id | integer | The ID for which the patch operation failed. |
message | string | The operation failure reason. |
500
Internal Server Error
PUT TimeEntries
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}
Updates a workspace time entry.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id} \
-H "Content-Type: application/json" \
-d '\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}", {
method: "PUT",
body: \{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\},
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.put('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}', json=\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}, headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::PUT, "https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}".to_string())
.json(&serde_json::json!(\{"billable":"boolean","created_with":"string","description":"string","duration":"integer","duronly":"boolean","event_metadata":\{"origin_feature":"string","visible_goals_count":"integer"\},"pid":"integer","project_id":"integer","shared_with_user_ids":[\{\}],"start":"string","start_date":"string","stop":"string","tag_action":"string","tag_ids":[\{\}],"tags":[\{\}],"task_id":"integer","tid":"integer","uid":"integer","user_id":"integer","wid":"integer","workspace_id":"integer"\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Numeric ID of the workspace |
time_entry_id | integer | true | TimeEntry ID. |
Query
name | type | required | description |
---|---|---|---|
meta | boolean | false | Should the response contain data for meta entities |
include_sharing | boolean | false | Should the response contain time entry sharing details |
Body
Name | Type | Description |
---|---|---|
billable | boolean | Whether the time entry is marked as billable, optional, default false |
created_with | string | Must be provided when creating a time entry and should identify the service/application used to create it |
description | string | Time entry description, optional |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Deprecated: Used to create a time entry with a duration but without a stop time. This parameter can be ignored. |
event_metadata | object | - |
pid | integer | Project ID, legacy field |
project_id | integer | Project ID, optional |
shared_with_user_ids | Array of integer | List of user IDs to share this time entry with |
start | string | Start time in UTC, required for creation. Format: 2006-01-02T15:04:05Z |
start_date | string | If provided during creation, the date part will take precedence over the date part of "start". Format: 2006-11-07 |
stop | string | Stop time in UTC, can be omitted if it's still running or created with "duration". If "stop" and "duration" are provided, values must be consistent (start + duration == stop) |
tag_action | string | Can be "add" or "delete". Used when updating an existing time entry |
tag_ids | Array of integer | IDs of tags to add/remove |
tags | Array of string | Names of tags to add/remove. If name does not exist as tag, one will be created automatically |
task_id | integer | Task ID, optional |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_id | integer | Time Entry creator ID, if omitted will use the requester user ID |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID, required |
event_metadata
Name | Type | Description |
---|---|---|
origin_feature | string | - |
visible_goals_count | integer | - |
Response
200
A workspace TimeEntry.
Name | Type | Description |
---|---|---|
at | string | When was last updated, the field follows the ISO 8601 format (HH:mm:ss.ssssssZ) |
billable | boolean | Whether the time entry is marked as billable |
client_name | string | Related entities meta fields - if requested |
description | string | null |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Used to create a TE with a duration but without a stop time, this field is deprecated for GET endpoints where the value will always be true. |
id | integer | Time Entry ID |
permissions | Array of string | Permission list |
pid | integer | Project ID, legacy field |
project_active | boolean | - |
project_billable | boolean | - |
project_color | string | - |
project_id | integer | null |
project_name | string | - |
shared_with | Array of object | Indicates who the time entry has been shared with |
start | string | Start time in UTC |
stop | string | Stop time in UTC, can be null if it's still running or created with "duration" and "duronly" fields |
tag_ids | Array of integer | Tag IDs, null if tags were not provided or were later deleted |
tags | Array of string | Tag names, null if tags were not provided or were later deleted |
task_id | integer | null |
task_name | string | - |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_avatar_url | string | - |
user_id | integer | Time Entry creator ID |
user_name | string | - |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID |
shared_with
Name | Type | Description |
---|---|---|
accepted | boolean | - |
user_id | integer | - |
user_name | string | - |
403
User does not have access to this resource.
500
Internal Server Error
DELETE TimeEntries
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}
Deletes a workspace time entry.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Delete.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.delete('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}', headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::DELETE, "https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Numeric ID of the workspace |
time_entry_id | integer | true | TimeEntry ID. |
Response
200
Returns only status code.
403
User does not have access to this resource.
500
Internal Server Error
PATCH Stop TimeEntry
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop
Stops a workspace time entry.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.patch('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop', headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::PATCH, "https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/time_entries/{time_entry_id}/stop".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Numeric ID of the workspace |
time_entry_id | integer | true | TimeEntry ID. |
Response
200
The stopped workspace TimeEntry.
Name | Type | Description |
---|---|---|
at | string | When was last updated, the field follows the ISO 8601 format (HH:mm:ss.ssssssZ) |
billable | boolean | Whether the time entry is marked as billable |
client_name | string | Related entities meta fields - if requested |
description | string | null |
duration | integer | Time entry duration. For running entries should be negative, preferable -1 |
duronly | boolean | Used to create a TE with a duration but without a stop time, this field is deprecated for GET endpoints where the value will always be true. |
id | integer | Time Entry ID |
permissions | Array of string | Permission list |
pid | integer | Project ID, legacy field |
project_active | boolean | - |
project_billable | boolean | - |
project_color | string | - |
project_id | integer | null |
project_name | string | - |
shared_with | Array of object | Indicates who the time entry has been shared with |
start | string | Start time in UTC |
stop | string | Stop time in UTC, can be null if it's still running or created with "duration" and "duronly" fields |
tag_ids | Array of integer | Tag IDs, null if tags were not provided or were later deleted |
tags | Array of string | Tag names, null if tags were not provided or were later deleted |
task_id | integer | null |
task_name | string | - |
tid | integer | Task ID, legacy field |
uid | integer | Time Entry creator ID, legacy field |
user_avatar_url | string | - |
user_id | integer | Time Entry creator ID |
user_name | string | - |
wid | integer | Workspace ID, legacy field |
workspace_id | integer | Workspace ID |
shared_with
Name | Type | Description |
---|---|---|
accepted | boolean | - |
user_id | integer | - |
user_name | string | - |
400
Invalid or missing time_entry_id
403
User does not have access to this resource.
404
Time entry not found
409
Time entry already stopped
500
Internal Server Error