Organizations
POST Creates a new organization
https://api.track.toggl.com/api/v9/organizations
Creates a new organization with a single workspace and assigns current user as the organization owner
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl -X POST https://api.track.toggl.com/api/v9/organizations \
  -H "Content-Type: application/json" \
  -d '\{"name":"string","workspace_name":"string"\}' \
  -u <email>:<password>
bytes, err := json.Marshal('\{"name":"string","workspace_name":"string"\}')
if err != nil {
    print(err)
}
req, err := http.NewRequest(http.MethodPost, 
  "https://api.track.toggl.com/api/v9/organizations", 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/organizations')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"name":"string","workspace_name":"string"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations", {
  method: "POST",
  body: \{"name":"string","workspace_name":"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/api/v9/organizations', json=\{"name":"string","workspace_name":"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/api/v9/organizations".to_string())
.json(&serde_json::json!(\{"name":"string","workspace_name":"string"\}))
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Body
| Name | Type | Description | 
|---|---|---|
| name | string | Name of the organization | 
| workspace_name | string | Name of the workspace | 
Response
200
Organization and workspace IDs
| Name | Type | Description | 
|---|---|---|
| id | integer | - | 
| name | string | - | 
| permissions | Array of string | - | 
| workspace_id | integer | - | 
| workspace_name | string | - | 
400
Possible error messages:
- Invalid JSON input
 - Field 'name' cannot be empty.
 - organization name too long, maximum length is 140
 - workspace name must contain non-space characters
 - workspace name must be provided
 - workspace name must not be longer than 140
 
403
User is not authorized to create an organization
GET Organization data
https://api.track.toggl.com/api/v9/organizations/{organization_id}
Returns organization name and current pricing plan
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl  https://api.track.toggl.com/api/v9/organizations/{organization_id} \
  -H "Content-Type: application/json" \
  -u <email>:<password>
req, err := http.NewRequest(http.MethodGet, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_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/organizations/{organization_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/organizations/{organization_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/organizations/{organization_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/organizations/{organization_id}".to_string())
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization | 
Response
200
| Name | Type | Description | 
|---|---|---|
| admin | boolean | Whether the requester is an admin of the organization | 
| at | string | Organization's last modification date | 
| created_at | string | Organization's creation date | 
| id | integer | Organization ID | 
| is_multi_workspace_enabled | boolean | Is true when the organization option is_multi_workspace_enabled is set | 
| is_unified | boolean | - | 
| max_data_retention_days | object | How far back free workspaces in this org can access data. | 
| max_workspaces | integer | Maximum number of workspaces allowed for the organization | 
| name | string | Organization Name | 
| owner | boolean | Whether the requester is a the owner of the organization | 
| permissions | Array of string | - | 
| pricing_plan_enterprise | boolean | The subscription plan is an enterprise plan | 
| pricing_plan_id | integer | Organization plan ID | 
| pricing_plan_name | string | The subscription plan name the org is currently on. Free or any plan name coming from payment provider | 
| suspended_at | string | Whether the organization is currently suspended | 
| trial_info | object | - | 
| user_count | integer | Number of organization users | 
trial_info
| Name | Type | Description | 
|---|---|---|
| can_have_trial | boolean | CanHaveInitialTrial is true if neither the organization nor the owner has never had a trial before | 
| last_pricing_plan_id | integer | null | 
| next_payment_date | string | null | 
| trial | boolean | Whether the organization's subscription is currently on trial | 
| trial_available | boolean | When a trial is available for this organization Deprecated: TrialAvailable - use CanHaveInitialTrial instead. Retained for front-end compatibility. | 
| trial_end_date | string | null | 
| trial_plan_id | integer | null | 
404
Possible error messages:
- Invalid organization ID
 - User not part of organization
 
PUT Updates an existing organization
https://api.track.toggl.com/api/v9/organizations/{organization_id}
Updates an existing organization
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl -X PUT https://api.track.toggl.com/api/v9/organizations/{organization_id} \
  -H "Content-Type: application/json" \
  -d '\{"name":"string"\}' \
  -u <email>:<password>
bytes, err := json.Marshal('\{"name":"string"\}')
if err != nil {
    print(err)
}
req, err := http.NewRequest(http.MethodPut, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_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/organizations/{organization_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"name":"string"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}", {
  method: "PUT",
  body: \{"name":"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.put('https://api.track.toggl.com/api/v9/organizations/{organization_id}', json=\{"name":"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::PUT, "https://api.track.toggl.com/api/v9/organizations/{organization_id}".to_string())
.json(&serde_json::json!(\{"name":"string"\}))
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization. | 
Body
| Name | Type | Description | 
|---|---|---|
| name | string | Name of the organization | 
Response
200
OK
400
Possible error messages:
- Invalid JSON input
 - Invalid organization ID
 - At least one field is required
 - field 'name' cannot be empty
 - organization name too long, maximum length is 140
 
403
User is not authorized to update the organization
GET List of users in organization
https://api.track.toggl.com/api/v9/organizations/{organization_id}/users
Returns list of users in organization based on set of url parameters: Result is paginated. Pagination params are returned in headers
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl  https://api.track.toggl.com/api/v9/organizations/{organization_id}/users \
  -H "Content-Type: application/json" \
  -u <email>:<password>
req, err := http.NewRequest(http.MethodGet, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_id}/users")
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/organizations/{organization_id}/users')
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/organizations/{organization_id}/users", {
  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/organizations/{organization_id}/users', 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/organizations/{organization_id}/users".to_string())
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization | 
Query
| name | type | required | description | 
|---|---|---|---|
| filter | string | false | Returns records where name or email contains this string | 
| active_status | string | false | List of active inactive invited comma separated(if not present, all statuses) | 
| only_admins | string | false | If true returns admins only | 
| groups | string | false | Comma-separated list of groups ids, returns users belonging to these groups only | 
| workspaces | string | false | Comma-separated list of workspaces ids, returns users belonging to this workspaces only | 
| page | integer | false | Page number, default 1 | 
| per_page | integer | false | Number of items per page, default 50 | 
| sort_dir | string | false | Values 'asc' or 'desc', result is sorted on 'names' column, default 'asc' | 
Response
200
| Name | Type | Description | 
|---|---|---|
| items | Array of object | - | 
items
| Name | Type | Description | 
|---|---|---|
| 2fa_enabled | boolean | - | 
| admin | boolean | Deprecated, to be removed. Use RoleID, or IsAdmin method if you must access this field. | 
| avatar_url | string | - | 
| can_edit_email | boolean | - | 
| created_at | string | - | 
| string | - | |
| groups | Array of object | - | 
| id | integer | - | 
| inactive | boolean | - | 
| invitation_id | integer | - | 
| joined | boolean | - | 
| name | string | - | 
| organization_id | integer | - | 
| owner | boolean | Deprecated, to be removed. Use RoleID, or IsOwner method if you must access this field. | 
| role_id | integer | - | 
| updated_at | string | - | 
| user_id | integer | - | 
| workspace_count | integer | - | 
| workspaces | Array of object | - | 
groups
| Name | Type | Description | 
|---|---|---|
| group_id | integer | - | 
| name | string | - | 
workspaces
| Name | Type | Description | 
|---|---|---|
| active | boolean | - | 
| admin | boolean | Deprecated, to be removed. Use RoleID, or IsAdmin method if you must access this field. | 
| cost | number | - | 
| default_currency | string | - | 
| groups | Array of object | - | 
| inactive | boolean | - | 
| rate | number | - | 
| role | string | Deprecated, to be removed | 
| role_id | integer | - | 
| view_edit_billable_rates | boolean | - | 
| view_edit_labor_costs | boolean | - | 
| working_hours | number | - | 
| workspace_id | integer | - | 
| workspace_name | string | - | 
| workspace_user_id | integer | - | 
groups
| Name | Type | Description | 
|---|---|---|
| group_id | integer | - | 
| name | string | - | 
400
Possible error messages:
- Missing or invalid organization_id.
 - active_status parameter can contain only 'active', 'inactive' or 'invited'.
 - only_admins parameter can contain only 'true' or 'false'.
 - Invalid value sent for 'page'.
 - page parameter must contain values > 0.
 - Invalid value sent for 'per_page'.
 - per_page parameter must contain values > 0.
 - sort_dir parameter can contain only 'asc' or 'desc'.
 - Invalid value sent for 'groups'.
 - Invalid value sent for 'workspaces'.
 
403
User is not authorized to list the organization users
PATCH Apply changes in bulk to users in an organization
https://api.track.toggl.com/api/v9/organizations/{organization_id}/users
Apply changes in bulk to users in an organization (currently deletion only).
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl -X PATCH https://api.track.toggl.com/api/v9/organizations/{organization_id}/users \
  -H "Content-Type: application/json" \
  -d '\{"delete":[\{\}]\}' \
  -u <email>:<password>
bytes, err := json.Marshal('\{"delete":[\{\}]\}')
if err != nil {
    print(err)
}
req, err := http.NewRequest(http.MethodGet, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_id}/users", 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/organizations/{organization_id}/users')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"delete":[\{\}]\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/users", {
  method: "PATCH",
  body: \{"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.patch('https://api.track.toggl.com/api/v9/organizations/{organization_id}/users', json=\{"delete":[\{\}]\}, 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/organizations/{organization_id}/users".to_string())
.json(&serde_json::json!(\{"delete":[\{\}]\}))
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization | 
Body
| Name | Type | Description | 
|---|---|---|
| delete | Array of integer | Organization user IDs to be deleted | 
Response
200
OK
400
Possible error messages:
- Missing or invalid organization_id
 - At least one organization user ID must be supplied.
 - Organization user IDs must be unique.
 - The following organization user IDs do not belong to this organization: '...'.
 - Cannot remove the paying user with organization user ID='...'.
 - Cannot remove the organization owner user with organization user ID='...'.
 
403
User is not authorized to delete the organization user
DELETE Leaves organization
https://api.track.toggl.com/api/v9/organizations/{organization_id}/users/leave
Leaves organization, effectively delete user account in org and delete organization if it is last user
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl -X DELETE https://api.track.toggl.com/api/v9/organizations/{organization_id}/users/leave \
  -H "Content-Type: application/json" \
  -u <email>:<password>
req, err := http.NewRequest(http.MethodPut, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_id}/users/leave")
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/organizations/{organization_id}/users/leave')
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/organizations/{organization_id}/users/leave", {
  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/organizations/{organization_id}/users/leave', 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/organizations/{organization_id}/users/leave".to_string())
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization | 
Response
200
Successful operation.
400
Possible error messages:
- The user does not belong to the organization.
 - Cannot remove the paying user.
 - Cannot remove the organization owner.
 
403
User does not have access to this resource.
PUT Changes a single organization-user
https://api.track.toggl.com/api/v9/organizations/{organization_id}/users/{organization_user_id}
Changes a single organization-user. Can affect the following values:
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl -X PUT https://api.track.toggl.com/api/v9/organizations/{organization_id}/users/{organization_user_id} \
  -H "Content-Type: application/json" \
  -d '\{"email":"string","groups":[\{\}],"inactive":"boolean","name":"string","organization_admin":"boolean","role_id":"integer","workspaces":[\{"active":"boolean","admin":"boolean","cost":"number","default_currency":"string","groups":[\{"group_id":"integer","name":"string"\}],"inactive":"boolean","rate":"number","role":"string","role_id":"integer","view_edit_billable_rates":"boolean","view_edit_labor_costs":"boolean","working_hours":"number","workspace_id":"integer","workspace_name":"string","workspace_user_id":"integer"\}]\}' \
  -u <email>:<password>
bytes, err := json.Marshal('\{"email":"string","groups":[\{\}],"inactive":"boolean","name":"string","organization_admin":"boolean","role_id":"integer","workspaces":[\{"active":"boolean","admin":"boolean","cost":"number","default_currency":"string","groups":[\{"group_id":"integer","name":"string"\}],"inactive":"boolean","rate":"number","role":"string","role_id":"integer","view_edit_billable_rates":"boolean","view_edit_labor_costs":"boolean","working_hours":"number","workspace_id":"integer","workspace_name":"string","workspace_user_id":"integer"\}]\}')
if err != nil {
    print(err)
}
req, err := http.NewRequest(http.MethodPut, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_id}/users/{organization_user_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/organizations/{organization_id}/users/{organization_user_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"email":"string","groups":[\{\}],"inactive":"boolean","name":"string","organization_admin":"boolean","role_id":"integer","workspaces":[\{"active":"boolean","admin":"boolean","cost":"number","default_currency":"string","groups":[\{"group_id":"integer","name":"string"\}],"inactive":"boolean","rate":"number","role":"string","role_id":"integer","view_edit_billable_rates":"boolean","view_edit_labor_costs":"boolean","working_hours":"number","workspace_id":"integer","workspace_name":"string","workspace_user_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/organizations/{organization_id}/users/{organization_user_id}", {
  method: "PUT",
  body: \{"email":"string","groups":[\{\}],"inactive":"boolean","name":"string","organization_admin":"boolean","role_id":"integer","workspaces":[\{"active":"boolean","admin":"boolean","cost":"number","default_currency":"string","groups":[\{"group_id":"integer","name":"string"\}],"inactive":"boolean","rate":"number","role":"string","role_id":"integer","view_edit_billable_rates":"boolean","view_edit_labor_costs":"boolean","working_hours":"number","workspace_id":"integer","workspace_name":"string","workspace_user_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/organizations/{organization_id}/users/{organization_user_id}', json=\{"email":"string","groups":[\{\}],"inactive":"boolean","name":"string","organization_admin":"boolean","role_id":"integer","workspaces":[\{"active":"boolean","admin":"boolean","cost":"number","default_currency":"string","groups":[\{"group_id":"integer","name":"string"\}],"inactive":"boolean","rate":"number","role":"string","role_id":"integer","view_edit_billable_rates":"boolean","view_edit_labor_costs":"boolean","working_hours":"number","workspace_id":"integer","workspace_name":"string","workspace_user_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/organizations/{organization_id}/users/{organization_user_id}".to_string())
.json(&serde_json::json!(\{"email":"string","groups":[\{\}],"inactive":"boolean","name":"string","organization_admin":"boolean","role_id":"integer","workspaces":[\{"active":"boolean","admin":"boolean","cost":"number","default_currency":"string","groups":[\{"group_id":"integer","name":"string"\}],"inactive":"boolean","rate":"number","role":"string","role_id":"integer","view_edit_billable_rates":"boolean","view_edit_labor_costs":"boolean","working_hours":"number","workspace_id":"integer","workspace_name":"string","workspace_user_id":"integer"\}]\}))
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization | 
| organization_user_id | integer | true | Numeric ID of the organization user | 
Body
| Name | Type | Description | 
|---|---|---|
| string | - | |
| groups | Array of integer | - | 
| inactive | boolean | - | 
| name | string | - | 
| organization_admin | boolean | - | 
| role_id | integer | - | 
| workspaces | Array of object | - | 
workspaces
| Name | Type | Description | 
|---|---|---|
| active | boolean | - | 
| admin | boolean | Deprecated, to be removed. Use RoleID, or IsAdmin method if you must access this field. | 
| cost | number | - | 
| default_currency | string | - | 
| groups | Array of object | - | 
| inactive | boolean | - | 
| rate | number | - | 
| role | string | Deprecated, to be removed | 
| role_id | integer | - | 
| view_edit_billable_rates | boolean | - | 
| view_edit_labor_costs | boolean | - | 
| working_hours | number | - | 
| workspace_id | integer | - | 
| workspace_name | string | - | 
| workspace_user_id | integer | - | 
groups
| Name | Type | Description | 
|---|---|---|
| group_id | integer | - | 
| name | string | - | 
Response
200
OK
400
Possible error messages:
- Missing or invalid organization_id.
 - Invalid role_id.
 - Cannot use both admin flags and role_id.
 - User does not exist in the organization.
 - At least one field is required.
 - Field 'name' cannot be empty.
 - Missing e-mail.
 - Invalid e-mail: '...'
 - Email already exists.
 - Group '...' is not in Organization '...'.
 - Workspace '...' is not in Organization '...'.
 - Cannot remove admin privileges from owner.
 - Cannot deactivate owner.
 - Cannot remove admin privileges from paying user.
 - Cannot deactivate paying user.
 - User has multiple organizations.
 - Invalid organization role.
 - Invalid role ID: 1234.
 - Invalid workspace role with ID: 1234.
 
403
User is not authorized to update the organization user
404
Possible error messages:
- Invalid organization user ID.
 - Failed to load user data.
 
GET Statistics for all workspaces in the organization
https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/statistics
Returns map indexed by workspace ID where each map element contains workspace admins list, members count and groups count.
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl  https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/statistics \
  -H "Content-Type: application/json" \
  -u <email>:<password>
req, err := http.NewRequest(http.MethodGet, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/statistics")
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/organizations/{organization_id}/workspaces/statistics')
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/organizations/{organization_id}/workspaces/statistics", {
  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/organizations/{organization_id}/workspaces/statistics', 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/organizations/{organization_id}/workspaces/statistics".to_string())
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization | 
Response
200
Successful operation.
403
Forbidden
404
Resource can not be found
PUT Change assignments of users within a workspace.
https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/assignments
Assign or remove users to/from a workspace or to/from groups belonging to said workspace.
- cURL
 - Go
 - Ruby
 - JavaScript
 - Python
 - Rust
 
curl -X PUT https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/assignments \
  -H "Content-Type: application/json" \
  -d '\{"group_id":"integer","joined":"boolean","operation":"string","user_id":"integer"\}' \
  -u <email>:<password>
bytes, err := json.Marshal('\{"group_id":"integer","joined":"boolean","operation":"string","user_id":"integer"\}')
if err != nil {
    print(err)
}
req, err := http.NewRequest(http.MethodPut, 
  "https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/assignments", 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/organizations/{organization_id}/workspaces/{workspace_id}/assignments')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"group_id":"integer","joined":"boolean","operation":"string","user_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/organizations/{organization_id}/workspaces/{workspace_id}/assignments", {
  method: "PUT",
  body: \{"group_id":"integer","joined":"boolean","operation":"string","user_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/organizations/{organization_id}/workspaces/{workspace_id}/assignments', json=\{"group_id":"integer","joined":"boolean","operation":"string","user_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/organizations/{organization_id}/workspaces/{workspace_id}/assignments".to_string())
.json(&serde_json::json!(\{"group_id":"integer","joined":"boolean","operation":"string","user_id":"integer"\}))
  .header(CONTENT_TYPE, "application/json")
  .send()
  .await?
  .json()
  .await?;
  
  println!("{:#?}", json);
  Ok(())
}
Parameters
Path
| name | type | required | description | 
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization | 
| workspace_id | integer | true | Numeric ID of the workspace within the organization | 
Body
| Name | Type | Description | 
|---|---|---|
| group_id | integer | - | 
| joined | boolean | - | 
| operation | string | - | 
| user_id | integer | - | 
Response
200
OK
400
Possible error messages:
- Invalid JSON input
 - Invalid organization ID.
 - Nothing to change.
 - Field operation can contain only 'add' or 'remove'.
 - Cannot send user_id and group_id in the same element.
 - One of user_id or group_id is required.
 - Invalid user_id.
 - Cannot remove workspace owner.
 - Cannot remove paying user.
 - Cannot remove organization admin.
 - Invalid group_id.
 - Invalid workspace ID.
 
403
Forbidden