curl --request POST \
--url https://app.trustivan.com/api/v1/workloads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"ttl_seconds": 21630
}
'import requests
url = "https://app.trustivan.com/api/v1/workloads"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"ttl_seconds": 21630
}
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({name: '<string>', scopes: ['<string>'], ttl_seconds: 21630})
};
fetch('https://app.trustivan.com/api/v1/workloads', 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/workloads"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"ttl_seconds\": 21630\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))
}Delegate a workload
Creates a non-human principal acting on behalf of THE CALLER. A human may delegate only their own authority: allowing an administrator to create a workload delegated by somebody else would mean the person whose role bounds the agent never agreed to it, and when that agent acted the audit trail would name them.
The credential is in the response and nowhere else, ever. It is stored
only as a SHA-256 digest, so a lost one is never recovered: it is
replaced, either by rotating this workload’s secret in place
(POST /workloads/{id}/rotate, which keeps the workload’s id, scopes
and delegator) or by revoking and re-delegating, which does not.
Every requested scope must be one the caller CURRENTLY holds and one that is grantable to a machine. Both are checked again on every authorization, so a delegation cannot outlive the authority behind it.
Lifetimes are short: one hour by default, twelve at most, shorter than any other credential here. An API key lives for months because it sits in a pipeline somebody maintains; a workload credential is held by something that may itself be compromised, and renewal is cheap.
curl --request POST \
--url https://app.trustivan.com/api/v1/workloads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"ttl_seconds": 21630
}
'import requests
url = "https://app.trustivan.com/api/v1/workloads"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"ttl_seconds": 21630
}
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({name: '<string>', scopes: ['<string>'], ttl_seconds: 21630})
};
fetch('https://app.trustivan.com/api/v1/workloads', 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/workloads"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"ttl_seconds\": 21630\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))
}Authorizations
Body
Response
The workload, and its credential (shown once).