Time-blocks
GET List task time blocks
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks
Returns a list of time blocks based on the provided workspace ID, task ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks")
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks')
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks", {
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks', 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
Query
| name | type | required | description |
|---|---|---|---|
| page | integer | false | page number |
| per_page | integer | false | results per page |
| order_by | []string | false | order by |
| archived | boolean | false | filter in/out archived time blocks |
Response
200
| Name | Type | Description |
|---|---|---|
| data | Array of object | - |
| page | integer | - |
| per_page | integer | - |
data
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| calendar_event_id | integer | - |
| completed_at | string | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| duration | integer | - |
| has_time_entry | boolean | - |
| id | integer | - |
| start | string | - |
| task_id | integer | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
400
Invalid request
403
Insufficient permissions
500
Internal Server Error
POST Create a new time block
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks
Creates a new time block with the provided name and workspace ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks \
-H "Content-Type: application/json" \
-d '\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks", 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks", {
method: "POST",
body: \{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks', json=\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks".to_string())
.json(&serde_json::json!(\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
Body
| Name | Type | Description |
|---|---|---|
| completed | boolean | - |
| duration | integer | - |
| outbound_sync | boolean | - |
| start | string | - |
Response
201
Time block created successfully
400
Invalid request
403
Insufficient permissions
500
Internal Server Error
GET Get a time block by ID
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}
Returns a time block by the provided ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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 | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
| time_block_id | integer | true | timeBlock ID |
Response
200
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| calendar_event_id | integer | - |
| completed_at | string | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| duration | integer | - |
| id | integer | - |
| start | string | - |
| task_id | integer | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
400
Invalid request
403
Insufficient permissions
404
TimeBlock does not exist
500
Internal Server Error
PUT Update time block
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}
Update an existing time block
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id} \
-H "Content-Type: application/json" \
-d '\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}", {
method: "PUT",
body: \{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}', json=\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}".to_string())
.json(&serde_json::json!(\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string"\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
| time_block_id | integer | true | TimeBlock ID |
Body
| Name | Type | Description |
|---|---|---|
| completed | boolean | - |
| duration | integer | - |
| outbound_sync | boolean | - |
| start | string | - |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
404
Time block does not exist
500
Internal Server Error
DELETE Delete a time block by ID
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}
Deletes a time block by the provided ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}')
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}", {
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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::DELETE, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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 | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
| time_block_id | integer | true | time block ID |
Query
| name | type | required | description |
|---|---|---|---|
| outbound_sync | boolean | false | Conduct outbound sync or not |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
404
Time block does not exist
500
Internal Server Error
PATCH Update time block
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}
Update an existing time block
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id} \
-H "Content-Type: application/json" \
-d '\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}", {
method: "PATCH",
body: \{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_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.patch('https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}', json=\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_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::PATCH, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}".to_string())
.json(&serde_json::json!(\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
| time_block_id | integer | true | TimeBlock ID |
Body
| Name | Type | Description |
|---|---|---|
| completed | boolean | - |
| duration | integer | - |
| outbound_sync | boolean | - |
| start | string | - |
| task_id | integer | - |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
404
Time block does not exist
500
Internal Server Error
POST Marks a time block as archived
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/archive
Marks the time block with the provided WS, task, and time block IDs as archived
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/archive \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/archive")
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/archive')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/archive", {
method: "POST",
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/archive', 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/archive".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
| time_block_id | integer | true | time block ID |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
500
Internal Server Error
PATCH Restore a time block by ID
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/restore
Restores a time block by the provided ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/restore \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/restore")
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/restore')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/restore", {
method: "PATCH",
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/restore', 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/restore".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
| time_block_id | integer | true | time block ID |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
404
Time block does not exist
500
Internal Server Error
POST Marks a time block as unarchived
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/unarchive
Marks the time block with the provided WS, task, and time block IDs as unarchived
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/unarchive \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/unarchive")
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/unarchive')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/unarchive", {
method: "POST",
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/unarchive', 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/tasks/{task_id}/time-blocks/{time_block_id}/unarchive".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
| task_id | integer | true | task ID |
| time_block_id | integer | true | time block ID |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
500
Internal Server Error
GET List task time blocks within range
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks
Returns a list of time-blocks based on the provided workspace ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks")
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks')
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks", {
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks', 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
Query
| name | type | required | description |
|---|---|---|---|
| date_from | string | true | from timestamp |
| date_to | string | true | to timestamp |
| task_id | integer | false | task id |
| status_id | integer | false | status id |
| page | integer | false | page number |
| per_page | integer | false | results per page |
| archived | boolean | false | filter in/out archived time blocks |
| order_by | []string | false | order by |
Response
200
| Name | Type | Description |
|---|---|---|
| data | Array of object | - |
| page | integer | - |
| per_page | integer | - |
data
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| calendar_event_id | integer | - |
| completed_at | string | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| duration | integer | - |
| has_time_entry | boolean | - |
| id | integer | - |
| start | string | - |
| task | object | - |
| task_id | integer | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
task
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| assignee_user_ids | Array of integer | - |
| auto_log_time | boolean | - |
| billable | boolean | - |
| client | object | - |
| color | string | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| end_date | string | - |
| estimated_mins | integer | - |
| ghost_assignee_ids | Array of integer | - |
| id | integer | - |
| is_template | boolean | - |
| metadata | object | - |
| name | string | - |
| notes | string | - |
| parent_task_id | integer | - |
| parent_task_name | string | - |
| pinned | boolean | - |
| position | integer | - |
| priority | string | - |
| priority_at | string | - |
| private | boolean | - |
| project | object | - |
| project_id | integer | - |
| recurrence_date | string | - |
| recurring_task_id | integer | - |
| rrule | string | - |
| source | string | - |
| source_template_task_id | integer | - |
| start_date | string | - |
| status | object | - |
| status_id | integer | - |
| status_updated_at | string | - |
| tag_ids | Array of integer | - |
| tags | Array of object | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
client
| Name | Type | Description |
|---|---|---|
| id | integer | - |
| name | string | - |
metadata
| Name | Type | Description |
|---|---|---|
| all_day | boolean | - |
| calendar_event_id | integer | - |
| calendar_id | integer | - |
| external_id | string | - |
| ical_uid | string | - |
| meeting_link | string | - |
| project_assignment | object | - |
| updated_at | string | - |
project_assignment
| Name | Type | Description |
|---|---|---|
| accuracy | number | - |
| confirmed_at | string | - |
| match_tier | string | - |
| matched_name | string | - |
| normalized_name | string | - |
| origin | string | - |
| suggested_at | string | - |
project
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| color | string | - |
| custom_field_values | Array of object | CustomFieldValues are the parent project's CF values, hydrated by callers that surface them (currently the task list, via task.service.hydrateTaskProjectCustomFieldValues which routes through customfield.Service.GetFieldsByIDs and respects the PermissionViewWorkspaceProjectCustomFields gate). Producers that don't hydrate (e.g. timeentry) leave the slice empty; omitempty hides it on those responses. |
| id | integer | - |
| is_template | boolean | - |
| name | string | - |
| permissions | Array of string | - |
| private | boolean | - |
| rate | object | - |
custom_field_values
| Name | Type | Description |
|---|---|---|
| custom_field_id | integer | - |
| custom_field_name | string | - |
| field_type | string | - |
| selected_options | Array of object | - |
| value | object | - |
rate
| Name | Type | Description |
|---|---|---|
| billable | boolean | - |
| currency | string | - |
| end_at | string | - |
| has_more_rates | boolean | - |
| hourly_rate | number | - |
| project_color | string | - |
| project_created_at | string | - |
| project_id | integer | - |
| project_name | string | - |
| project_rate_id | integer | - |
| start_at | string | - |
| workspace_rate_id | integer | - |
status
| Name | Type | Description |
|---|---|---|
| emoji | string | - |
| id | integer | - |
| name | string | - |
| type | string | - |
tags
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
400
Invalid request
403
Insufficient permissions
500
Internal Server Error
POST Create new time blocks
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk
Creates new time blocks
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk \
-H "Content-Type: application/json" \
-d '\{"time_blocks":[\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}]\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"time_blocks":[\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}]\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk", 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"time_blocks":[\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}]\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk", {
method: "POST",
body: \{"time_blocks":[\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_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.post('https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk', json=\{"time_blocks":[\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_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::POST, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk".to_string())
.json(&serde_json::json!(\{"time_blocks":[\{"completed":"boolean","duration":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}]\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
Body
| Name | Type | Description |
|---|---|---|
| time_blocks | Array of object | - |
time_blocks
| Name | Type | Description |
|---|---|---|
| completed | boolean | - |
| duration | integer | - |
| outbound_sync | boolean | - |
| start | string | - |
| task_id | integer | - |
Response
201
Time blocks created successfully
400
Invalid request
403
Insufficient permissions
500
Internal Server Error
DELETE Bulk deletes time blocks by IDs
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk
Deletes time blocks by the provided IDs.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk")
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk')
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk", {
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk', 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
Query
| name | type | required | description |
|---|---|---|---|
| ids | []integer | true | time block IDs |
| outbound_sync | boolean | false | Conduct outbound sync or not |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
404
Time block does not exist
500
Internal Server Error
PATCH Update time blocks in bulk
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk
Update existing time blocks in bulk
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk \
-H "Content-Type: application/json" \
-d '[\{"completed":"boolean","duration":"integer","id":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"completed":"boolean","duration":"integer","id":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk", 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"completed":"boolean","duration":"integer","id":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk", {
method: "PATCH",
body: [\{"completed":"boolean","duration":"integer","id":"integer","outbound_sync":"boolean","start":"string","task_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.patch('https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk', json=[\{"completed":"boolean","duration":"integer","id":"integer","outbound_sync":"boolean","start":"string","task_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::PATCH, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/bulk".to_string())
.json(&serde_json::json!([\{"completed":"boolean","duration":"integer","id":"integer","outbound_sync":"boolean","start":"string","task_id":"integer"\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| completed | boolean | - |
| duration | integer | - |
| id | integer | - |
| outbound_sync | boolean | - |
| start | string | - |
| task_id | integer | - |
Response
204
No Content
400
Invalid request
403
Insufficient permissions
404
Time block does not exist
500
Internal Server Error
GET List task time blocks within range (streamed)
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/stream
Returns a list of time-blocks based on the provided workspace ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/stream \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/stream")
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/stream')
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/stream", {
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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/stream', 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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/time-blocks/stream".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | organization ID |
| workspace_id | integer | true | workspace ID |
Query
| name | type | required | description |
|---|---|---|---|
| date_from | string | true | from timestamp |
| date_to | string | true | to timestamp |
| task_id | integer | false | task id |
| status_id | integer | false | status id |
| archived | boolean | false | filter in/out archived time blocks |
| order_by | []string | false | order by |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| calendar_event_id | integer | - |
| completed_at | string | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| duration | integer | - |
| has_time_entry | boolean | - |
| id | integer | - |
| start | string | - |
| task | object | - |
| task_id | integer | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
task
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| assignee_user_ids | Array of integer | - |
| auto_log_time | boolean | - |
| billable | boolean | - |
| client | object | - |
| color | string | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| end_date | string | - |
| estimated_mins | integer | - |
| ghost_assignee_ids | Array of integer | - |
| id | integer | - |
| is_template | boolean | - |
| metadata | object | - |
| name | string | - |
| notes | string | - |
| parent_task_id | integer | - |
| parent_task_name | string | - |
| pinned | boolean | - |
| position | integer | - |
| priority | string | - |
| priority_at | string | - |
| private | boolean | - |
| project | object | - |
| project_id | integer | - |
| recurrence_date | string | - |
| recurring_task_id | integer | - |
| rrule | string | - |
| source | string | - |
| source_template_task_id | integer | - |
| start_date | string | - |
| status | object | - |
| status_id | integer | - |
| status_updated_at | string | - |
| tag_ids | Array of integer | - |
| tags | Array of object | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
client
| Name | Type | Description |
|---|---|---|
| id | integer | - |
| name | string | - |
metadata
| Name | Type | Description |
|---|---|---|
| all_day | boolean | - |
| calendar_event_id | integer | - |
| calendar_id | integer | - |
| external_id | string | - |
| ical_uid | string | - |
| meeting_link | string | - |
| project_assignment | object | - |
| updated_at | string | - |
project_assignment
| Name | Type | Description |
|---|---|---|
| accuracy | number | - |
| confirmed_at | string | - |
| match_tier | string | - |
| matched_name | string | - |
| normalized_name | string | - |
| origin | string | - |
| suggested_at | string | - |
project
| Name | Type | Description |
|---|---|---|
| archived_at | string | - |
| color | string | - |
| custom_field_values | Array of object | CustomFieldValues are the parent project's CF values, hydrated by callers that surface them (currently the task list, via task.service.hydrateTaskProjectCustomFieldValues which routes through customfield.Service.GetFieldsByIDs and respects the PermissionViewWorkspaceProjectCustomFields gate). Producers that don't hydrate (e.g. timeentry) leave the slice empty; omitempty hides it on those responses. |
| id | integer | - |
| is_template | boolean | - |
| name | string | - |
| permissions | Array of string | - |
| private | boolean | - |
| rate | object | - |
custom_field_values
| Name | Type | Description |
|---|---|---|
| custom_field_id | integer | - |
| custom_field_name | string | - |
| field_type | string | - |
| selected_options | Array of object | - |
| value | object | - |
selected_options
| Name | Type | Description |
|---|---|---|
| is_deleted | boolean | - |
| option_id | integer | - |
| option_name | string | - |
rate
| Name | Type | Description |
|---|---|---|
| billable | boolean | - |
| currency | string | - |
| end_at | string | - |
| has_more_rates | boolean | - |
| hourly_rate | number | - |
| project_color | string | - |
| project_created_at | string | - |
| project_id | integer | - |
| project_name | string | - |
| project_rate_id | integer | - |
| start_at | string | - |
| workspace_rate_id | integer | - |
status
| Name | Type | Description |
|---|---|---|
| emoji | string | - |
| id | integer | - |
| name | string | - |
| type | string | - |
tags
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
400
Invalid request
403
Insufficient permissions
500
Internal Server Error