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 | 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 | integer | 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 | 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 |
trial_end_date | string | 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