Invitations
POST Accepts invitation
https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/accept
User connected with invitation is marked as joined, email is sent to the inviter.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/accept \
-H "Content-Type: application/json"
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/accept")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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/invitations/{invitation_code}/accept')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/accept", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
})
.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/invitations/{invitation_code}/accept', headers={'content-type': 'application/json'})
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();
let json = client.request(Method::POST, "https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/accept".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
inviutation_code | string | true | Invitation code |
Response
200
OK
403
Forbidden
404
Invalid invitation code
POST Rejects invitation
https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/reject
User connected with invitation is marked as deleted.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/reject \
-H "Content-Type: application/json"
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/reject")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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/invitations/{invitation_code}/reject')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/reject", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
})
.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/invitations/{invitation_code}/reject', headers={'content-type': 'application/json'})
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();
let json = client.request(Method::POST, "https://api.track.toggl.com/api/v9/organizations/invitations/{invitation_code}/reject".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
name | type | required | description |
---|---|---|---|
inviutation_code | string | true | Invitation code |
Response
200
OK
403
Forbidden
404
Invalid invitation code
POST Creates a new invitation for the user
https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations
Creates a new invitation for the user.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations \
-H "Content-Type: application/json" \
-d '\{"emails":[\{\}],"groups":[\{\}],"project_invite":\{"manager":"boolean","project_id":"integer","workspace_id":"integer"\},"workspaces":[\{"admin":"boolean","integration_data":\{"external_id":"string","external_type":"string","provider":"string"\},"role":"string","role_id":"integer","workspace_id":"integer"\}]\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"emails":[\{\}],"groups":[\{\}],"project_invite":\{"manager":"boolean","project_id":"integer","workspace_id":"integer"\},"workspaces":[\{"admin":"boolean","integration_data":\{"external_id":"string","external_type":"string","provider":"string"\},"role":"string","role_id":"integer","workspace_id":"integer"\}]\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations", 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}/invitations')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"emails":[\{\}],"groups":[\{\}],"project_invite":\{"manager":"boolean","project_id":"integer","workspace_id":"integer"\},"workspaces":[\{"admin":"boolean","integration_data":\{"external_id":"string","external_type":"string","provider":"string"\},"role":"string","role_id":"integer","workspace_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}/invitations", {
method: "POST",
body: \{"emails":[\{\}],"groups":[\{\}],"project_invite":\{"manager":"boolean","project_id":"integer","workspace_id":"integer"\},"workspaces":[\{"admin":"boolean","integration_data":\{"external_id":"string","external_type":"string","provider":"string"\},"role":"string","role_id":"integer","workspace_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://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations', json=\{"emails":[\{\}],"groups":[\{\}],"project_invite":\{"manager":"boolean","project_id":"integer","workspace_id":"integer"\},"workspaces":[\{"admin":"boolean","integration_data":\{"external_id":"string","external_type":"string","provider":"string"\},"role":"string","role_id":"integer","workspace_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://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations".to_string())
.json(&serde_json::json!(\{"emails":[\{\}],"groups":[\{\}],"project_invite":\{"manager":"boolean","project_id":"integer","workspace_id":"integer"\},"workspaces":[\{"admin":"boolean","integration_data":\{"external_id":"string","external_type":"string","provider":"string"\},"role":"string","role_id":"integer","workspace_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. |
Body
Name | Type | Description |
---|---|---|
emails | Array of string | - |
groups | Array of integer | - |
project_invite | object | - |
workspaces | Array of object | - |
project_invite
Name | Type | Description |
---|---|---|
manager | boolean | - |
project_id | integer | - |
workspace_id | integer | - |
workspaces
Name | Type | Description |
---|---|---|
admin | boolean | - |
integration_data | object | - |
role | string | - |
role_id | integer | - |
workspace_id | integer | - |
integration_data
Name | Type | Description |
---|---|---|
external_id | string | - |
external_type | string | - |
provider | string | - |
Response
200
Created user invitations
Name | Type | Description |
---|---|---|
data | Array of object | - |
messages | Array of string | - |
data
Name | Type | Description |
---|---|---|
string | - | |
invitation_id | integer | - |
invite_url | string | - |
organization_id | integer | - |
recipient_id | integer | - |
sender_id | integer | - |
400
Possible error messages:
- Invalid JSON input
- Invalid organization id
- at least one email is required
- at least one workspace is required
- Missing e-mail
- Invalid e-mail: '...'
- invalid workspace ID
- Active user limit is 5. Upgrade to add more active users
- Invitation limit reached (please try again later; or upgrade)
- User with e-mail '...' is already an inactive member of the organization
403
Forbidden
PUT Resends user their invitation
https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations/{invitation_code}/resend
Resend invitation email to user.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations/{invitation_code}/resend \
-H "Content-Type: application/json"
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations/{invitation_code}/resend")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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}/invitations/{invitation_code}/resend')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations/{invitation_code}/resend", {
method: "PUT",
headers: {
"Content-Type": "application/json"
},
})
.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}/invitations/{invitation_code}/resend', headers={'content-type': 'application/json'})
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();
let json = client.request(Method::PUT, "https://api.track.toggl.com/api/v9/organizations/{organization_id}/invitations/{invitation_code}/resend".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 |
invitation_code | string | true | Invitation code |
Response
200
OK
400
Organization ID and invitation organization ID mismatch
404
Invitation code not found