Insights
POST Load projects' data trends​
https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/data_trends/projects
Returns the projects' data trends projects from a workspace.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/data_trends/projects \
-H "Content-Type: application/json" \
-d '{"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}' \
-u <email>:<password>
bytes, err := json.Marshal('{"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/data_trends/projects", 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/insights/api/v1/workspace/{workspace_id}/data_trends/projects')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/data_trends/projects", {
method: "POST",
body: {"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"},
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/insights/api/v1/workspace/{workspace_id}/data_trends/projects', json={"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}, 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/insights/api/v1/workspace/{workspace_id}/data_trends/projects".to_string())
.json(&serde_json::json!({"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters​
Path​
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Workspace ID |
Body​
name | type | description |
---|---|---|
billable | boolean | Whether the project is set as billable, optional, premium feature. |
end_date | string | End date, example time.DateOnly. Should be greater than Start date. |
previous_period_start | string | Previous start date, example time.DateOnly. |
project_ids | Array of integer | Project IDs, optional. |
rounding | integer | Rounding, optional, duration rounding settings, premium feature. |
rounding_minutes | integer | RoundingMinutes, optional, duration rounding minutes settings, premium feature. |
start_date | string | Start date, example time.DateOnly. Should be less than End date. |
Response​
200​
Returns filtered projects
Array of:
name | type | description |
---|---|---|
current_period_seconds | Array of integer | - |
previous_period_seconds | Array of integer | - |
project_id | integer | - |
start | string | - |
user_ids | Array of integer | - |
400​
Possible error messages:
* At least one parameter must be set
* Invalid workspace id
* Wrong format date
402​
Workspace needs to have the {feature} feature enabled
403​
Possible error messages:
* Workspace not found/accessible
* Admin permissions required
500​
Internal Server Error
POST Export employee profitability insights​
https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}
Downloads employee profitability insights in the specified format: csv or xlsx.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension} \
-H "Content-Type: application/json" \
-d '{"currency":"string","end_date":"string","group_ids":"string","resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":"string"}' \
-u <email>:<password>
bytes, err := json.Marshal('{"currency":"string","end_date":"string","group_ids":"string","resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":"string"}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}", 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/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"currency":"string","end_date":"string","group_ids":"string","resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":"string"}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}", {
method: "POST",
body: {"currency":"string","end_date":"string","group_ids":"string","resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":"string"},
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/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}', json={"currency":"string","end_date":"string","group_ids":"string","resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":"string"}, 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/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}".to_string())
.json(&serde_json::json!({"currency":"string","end_date":"string","group_ids":"string","resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":"string"}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters​
Body​
name | type | description |
---|---|---|
currency | string | - |
end_date | string | - |
group_ids | string | - |
resolution | string | - |
rounding | integer | - |
rounding_minutes | integer | - |
start_date | string | - |
user_ids | string | - |
Response​
200​
A stream with the csv or xlsx for the report being exported
400​
Invalid parameters
403​
User has no access to workspace or is not admin
500​
Internal Server Error
POST Export profitability project insights​
https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}
Downloads profitability project insights in the specified format: csv or xlsx.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension} \
-H "Content-Type: application/json" \
-d '{"billable":"boolean","client_ids":["integer"],"currency":"string","end_date":"string","project_ids":["integer"],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"}' \
-u <email>:<password>
bytes, err := json.Marshal('{"billable":"boolean","client_ids":["integer"],"currency":"string","end_date":"string","project_ids":["integer"],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}", 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/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"billable":"boolean","client_ids":["integer"],"currency":"string","end_date":"string","project_ids":["integer"],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}", {
method: "POST",
body: {"billable":"boolean","client_ids":["integer"],"currency":"string","end_date":"string","project_ids":["integer"],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"},
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/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}', json={"billable":"boolean","client_ids":["integer"],"currency":"string","end_date":"string","project_ids":["integer"],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"}, 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/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}".to_string())
.json(&serde_json::json!({"billable":"boolean","client_ids":["integer"],"currency":"string","end_date":"string","project_ids":["integer"],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters​
Path​
name | type | required | description |
---|---|---|---|
extension | string | true | csv,xlsx |
Body​
name | type | description |
---|---|---|
billable | boolean | Whether the project is set as billable, optional, premium feature. |
client_ids | Array of integer | Client IDs, optional. A nil entry on this list means that only projects without client will be selected. |
currency | string | Currency, example: "usd". |
end_date | string | End date, optional, example: time.DateOnly. Should be greater than Start date. |
project_ids | Array of integer | Project IDS, optional. |
resolution | string | Resolution, optional. Can be "day", "week" or "month". |
rounding | integer | Rounding, optional, duration rounding settings, premium feature. |
rounding_minutes | integer | RoundingMinutes, optional, duration rounding minutes settings, premium feature. |
start_date | string | Start date, optional, example: time.DateOnly. Should be less than End date. |
Response​
200​
A stream with the csv or xlsx for the report being exported
400​
Possible error messages:
* Invalid parameters
* Invalid workspace ID
403​
User has no access to workspace or is not admin
500​
Internal Server Error
POST Export projects data trends​
https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}
Downloads projects data trends in the specified format: csv or xlsx.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension} \
-H "Content-Type: application/json" \
-d '{"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}' \
-u <email>:<password>
bytes, err := json.Marshal('{"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}", 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/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}", {
method: "POST",
body: {"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"},
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/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}', json={"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}, 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/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}".to_string())
.json(&serde_json::json!({"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":["integer"],"rounding":"integer","rounding_minutes":"integer","start_date":"string"}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters​
Path​
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Workspace ID |
extension | string | true | csv,xlsx |
Body​
name | type | description |
---|---|---|
billable | boolean | Whether the project is set as billable, optional, premium feature. |
end_date | string | End date, example time.DateOnly. Should be greater than Start date. |
previous_period_start | string | Previous start date, example time.DateOnly. |
project_ids | Array of integer | Project IDs, optional. |
rounding | integer | Rounding, optional, duration rounding settings, premium feature. |
rounding_minutes | integer | RoundingMinutes, optional, duration rounding minutes settings, premium feature. |
start_date | string | Start date, example time.DateOnly. Should be less than End date. |
Response​
200​
Returns data projects data trends
Array of:
name | type | description |
---|---|---|
current_period_seconds | Array of integer | - |
previous_period_seconds | Array of integer | - |
project_id | integer | - |
start | string | - |
user_ids | Array of integer | - |
400​
Possible error messages:
* At least one parameter must be set
* Invalid workspace id
* wrong format date
* start should come after end
403​
Possible error messages:
* Workspace not found/accessible"
* user has no required access to asked workspace
500​
Internal Server Error