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":[\{\}],"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":[\{\}],"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":[\{\}],"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":[\{\}],"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":[\{\}],"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":[\{\}],"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
| Name | Type | Description | 
|---|---|---|
| items | Array of object | - | 
items
| Name | Type | Description | 
|---|---|---|
| current_period_seconds | Array of integer | - | 
| end | string | - | 
| previousStart | string | - | 
| 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":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}' \
  -u <email>:<password>
bytes, err := json.Marshal('\{"currency":"string","end_date":"string","group_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}')
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":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}.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":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\},
  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":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}, 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":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}))
  .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 | 
| extension | string | true | csv,xlsx | 
Body
| Name | Type | Description | 
|---|---|---|
| currency | string | - | 
| end_date | string | - | 
| group_ids | Array of integer | - | 
| resolution | string | - | 
| rounding | integer | - | 
| rounding_minutes | integer | - | 
| start_date | string | - | 
| user_ids | Array of integer | - | 
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":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"\}' \
  -u <email>:<password>
bytes, err := json.Marshal('\{"billable":"boolean","client_ids":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"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":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"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":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"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":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"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":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"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 | 
|---|---|---|---|
| workspace_id | integer | true | Numeric ID of the workspace | 
| 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":[\{\}],"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":[\{\}],"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":[\{\}],"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":[\{\}],"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":[\{\}],"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":[\{\}],"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
| Name | Type | Description | 
|---|---|---|
| items | Array of object | - | 
items
| Name | Type | Description | 
|---|---|---|
| current_period_seconds | Array of integer | - | 
| end | string | - | 
| previousStart | string | - | 
| 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