"Insights" Endpoints - POST Export project profitability 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
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
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