curl --request POST \
--url https://app.trustivan.com/api/v1/agents/{id}/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purpose": "<string>",
"ttl_seconds": 7230
}
'import requests
url = "https://app.trustivan.com/api/v1/agents/{id}/sessions"
payload = {
"purpose": "<string>",
"ttl_seconds": 7230
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({purpose: '<string>', ttl_seconds: 7230})
};
fetch('https://app.trustivan.com/api/v1/agents/{id}/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/agents/{id}/sessions"
payload := strings.NewReader("{\n \"purpose\": \"<string>\",\n \"ttl_seconds\": 7230\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Open a session
A bounded run of work with a stated purpose. It answers two of the four questions a delegation must express (for what task, and for how long), and it does so as state rather than as a convention: an expired session authorises nothing even while the credential behind it is still live.
Without one, an agent’s authority is ambient and permanent within its credential’s lifetime, and nothing records what the run was for. A purpose is therefore required: a session with no stated purpose is ambient authority with a row.
Bounded by the CREDENTIAL’s expiry as well as by its own maximum (four hours, deliberately shorter than the twelve a credential may live). The shorter of the two always wins: a session must never outlive the identity it runs under.
The delegating human is taken from the workload row, never from the request. A client-supplied delegator would let an agent name a more senior human and have its actions attributed to them.
curl --request POST \
--url https://app.trustivan.com/api/v1/agents/{id}/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purpose": "<string>",
"ttl_seconds": 7230
}
'import requests
url = "https://app.trustivan.com/api/v1/agents/{id}/sessions"
payload = {
"purpose": "<string>",
"ttl_seconds": 7230
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({purpose: '<string>', ttl_seconds: 7230})
};
fetch('https://app.trustivan.com/api/v1/agents/{id}/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/agents/{id}/sessions"
payload := strings.NewReader("{\n \"purpose\": \"<string>\",\n \"ttl_seconds\": 7230\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Body
Response
The open session.