Delegate Grant
curl --request POST \
--url https://{deployment}/v1/grants/{grant_id}/delegate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"principal_id": "<string>",
"principal_type": "human",
"scope": {},
"audience": "<string>",
"policy": "<string>",
"budget_amount_minor": 1,
"budget_currency": "<string>",
"budget_count": 1,
"ttl_hours": 24,
"conditions": {},
"delegation_policy": "none",
"enforcement_mode": "enforce",
"canary_percent": 50,
"signing_assertion": {},
"signing_challenge": "<string>",
"signing_token": "<string>"
}
'import requests
url = "https://{deployment}/v1/grants/{grant_id}/delegate"
payload = {
"agent_id": "<string>",
"principal_id": "<string>",
"principal_type": "human",
"scope": {},
"audience": "<string>",
"policy": "<string>",
"budget_amount_minor": 1,
"budget_currency": "<string>",
"budget_count": 1,
"ttl_hours": 24,
"conditions": {},
"delegation_policy": "none",
"enforcement_mode": "enforce",
"canary_percent": 50,
"signing_assertion": {},
"signing_challenge": "<string>",
"signing_token": "<string>"
}
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({
agent_id: '<string>',
principal_id: '<string>',
principal_type: 'human',
scope: {},
audience: '<string>',
policy: '<string>',
budget_amount_minor: 1,
budget_currency: '<string>',
budget_count: 1,
ttl_hours: 24,
conditions: {},
delegation_policy: 'none',
enforcement_mode: 'enforce',
canary_percent: 50,
signing_assertion: {},
signing_challenge: '<string>',
signing_token: '<string>'
})
};
fetch('https://{deployment}/v1/grants/{grant_id}/delegate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{deployment}/v1/grants/{grant_id}/delegate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_id' => '<string>',
'principal_id' => '<string>',
'principal_type' => 'human',
'scope' => [
],
'audience' => '<string>',
'policy' => '<string>',
'budget_amount_minor' => 1,
'budget_currency' => '<string>',
'budget_count' => 1,
'ttl_hours' => 24,
'conditions' => [
],
'delegation_policy' => 'none',
'enforcement_mode' => 'enforce',
'canary_percent' => 50,
'signing_assertion' => [
],
'signing_challenge' => '<string>',
'signing_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{deployment}/v1/grants/{grant_id}/delegate"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"principal_id\": \"<string>\",\n \"principal_type\": \"human\",\n \"scope\": {},\n \"audience\": \"<string>\",\n \"policy\": \"<string>\",\n \"budget_amount_minor\": 1,\n \"budget_currency\": \"<string>\",\n \"budget_count\": 1,\n \"ttl_hours\": 24,\n \"conditions\": {},\n \"delegation_policy\": \"none\",\n \"enforcement_mode\": \"enforce\",\n \"canary_percent\": 50,\n \"signing_assertion\": {},\n \"signing_challenge\": \"<string>\",\n \"signing_token\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://{deployment}/v1/grants/{grant_id}/delegate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"principal_id\": \"<string>\",\n \"principal_type\": \"human\",\n \"scope\": {},\n \"audience\": \"<string>\",\n \"policy\": \"<string>\",\n \"budget_amount_minor\": 1,\n \"budget_currency\": \"<string>\",\n \"budget_count\": 1,\n \"ttl_hours\": 24,\n \"conditions\": {},\n \"delegation_policy\": \"none\",\n \"enforcement_mode\": \"enforce\",\n \"canary_percent\": 50,\n \"signing_assertion\": {},\n \"signing_challenge\": \"<string>\",\n \"signing_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{deployment}/v1/grants/{grant_id}/delegate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"<string>\",\n \"principal_id\": \"<string>\",\n \"principal_type\": \"human\",\n \"scope\": {},\n \"audience\": \"<string>\",\n \"policy\": \"<string>\",\n \"budget_amount_minor\": 1,\n \"budget_currency\": \"<string>\",\n \"budget_count\": 1,\n \"ttl_hours\": 24,\n \"conditions\": {},\n \"delegation_policy\": \"none\",\n \"enforcement_mode\": \"enforce\",\n \"canary_percent\": 50,\n \"signing_assertion\": {},\n \"signing_challenge\": \"<string>\",\n \"signing_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"enforcement_mode": "observe",
"canary_percent": 123,
"issued_against_provenance": "<string>",
"agent_id": "<string>",
"kind": "<string>",
"environment": "<string>",
"principal_type": "<string>",
"principal_id": "<string>",
"parent_grant_id": "<string>",
"depth": 123,
"scope": {},
"audience": "<string>",
"policy": "<string>",
"policy_rendering": "<string>",
"budget_amount_minor": 123,
"budget_currency": "<string>",
"spent_amount_minor": 123,
"budget_count": 123,
"spent_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"not_before": "2023-11-07T05:31:56Z",
"not_after": "2023-11-07T05:31:56Z",
"conditions": {},
"delegation_policy": "<string>",
"status": "<string>",
"held_amount_minor": 0,
"held_count": 0,
"pending_reason": "<string>",
"revoked_at": "2023-11-07T05:31:56Z",
"revoked_by": "<string>",
"revoked_by_email": "<string>",
"revocation_reason": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authority
Delegate Grant
Create a child grant. Rejected unless it is a subset on every axis.
Who may call it: governance-officer or admin. A workspace API key is refused here: this is an act that belongs to a named person.
POST
/
v1
/
grants
/
{grant_id}
/
delegate
Delegate Grant
curl --request POST \
--url https://{deployment}/v1/grants/{grant_id}/delegate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"principal_id": "<string>",
"principal_type": "human",
"scope": {},
"audience": "<string>",
"policy": "<string>",
"budget_amount_minor": 1,
"budget_currency": "<string>",
"budget_count": 1,
"ttl_hours": 24,
"conditions": {},
"delegation_policy": "none",
"enforcement_mode": "enforce",
"canary_percent": 50,
"signing_assertion": {},
"signing_challenge": "<string>",
"signing_token": "<string>"
}
'import requests
url = "https://{deployment}/v1/grants/{grant_id}/delegate"
payload = {
"agent_id": "<string>",
"principal_id": "<string>",
"principal_type": "human",
"scope": {},
"audience": "<string>",
"policy": "<string>",
"budget_amount_minor": 1,
"budget_currency": "<string>",
"budget_count": 1,
"ttl_hours": 24,
"conditions": {},
"delegation_policy": "none",
"enforcement_mode": "enforce",
"canary_percent": 50,
"signing_assertion": {},
"signing_challenge": "<string>",
"signing_token": "<string>"
}
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({
agent_id: '<string>',
principal_id: '<string>',
principal_type: 'human',
scope: {},
audience: '<string>',
policy: '<string>',
budget_amount_minor: 1,
budget_currency: '<string>',
budget_count: 1,
ttl_hours: 24,
conditions: {},
delegation_policy: 'none',
enforcement_mode: 'enforce',
canary_percent: 50,
signing_assertion: {},
signing_challenge: '<string>',
signing_token: '<string>'
})
};
fetch('https://{deployment}/v1/grants/{grant_id}/delegate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{deployment}/v1/grants/{grant_id}/delegate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_id' => '<string>',
'principal_id' => '<string>',
'principal_type' => 'human',
'scope' => [
],
'audience' => '<string>',
'policy' => '<string>',
'budget_amount_minor' => 1,
'budget_currency' => '<string>',
'budget_count' => 1,
'ttl_hours' => 24,
'conditions' => [
],
'delegation_policy' => 'none',
'enforcement_mode' => 'enforce',
'canary_percent' => 50,
'signing_assertion' => [
],
'signing_challenge' => '<string>',
'signing_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{deployment}/v1/grants/{grant_id}/delegate"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"principal_id\": \"<string>\",\n \"principal_type\": \"human\",\n \"scope\": {},\n \"audience\": \"<string>\",\n \"policy\": \"<string>\",\n \"budget_amount_minor\": 1,\n \"budget_currency\": \"<string>\",\n \"budget_count\": 1,\n \"ttl_hours\": 24,\n \"conditions\": {},\n \"delegation_policy\": \"none\",\n \"enforcement_mode\": \"enforce\",\n \"canary_percent\": 50,\n \"signing_assertion\": {},\n \"signing_challenge\": \"<string>\",\n \"signing_token\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://{deployment}/v1/grants/{grant_id}/delegate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"principal_id\": \"<string>\",\n \"principal_type\": \"human\",\n \"scope\": {},\n \"audience\": \"<string>\",\n \"policy\": \"<string>\",\n \"budget_amount_minor\": 1,\n \"budget_currency\": \"<string>\",\n \"budget_count\": 1,\n \"ttl_hours\": 24,\n \"conditions\": {},\n \"delegation_policy\": \"none\",\n \"enforcement_mode\": \"enforce\",\n \"canary_percent\": 50,\n \"signing_assertion\": {},\n \"signing_challenge\": \"<string>\",\n \"signing_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{deployment}/v1/grants/{grant_id}/delegate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"<string>\",\n \"principal_id\": \"<string>\",\n \"principal_type\": \"human\",\n \"scope\": {},\n \"audience\": \"<string>\",\n \"policy\": \"<string>\",\n \"budget_amount_minor\": 1,\n \"budget_currency\": \"<string>\",\n \"budget_count\": 1,\n \"ttl_hours\": 24,\n \"conditions\": {},\n \"delegation_policy\": \"none\",\n \"enforcement_mode\": \"enforce\",\n \"canary_percent\": 50,\n \"signing_assertion\": {},\n \"signing_challenge\": \"<string>\",\n \"signing_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"enforcement_mode": "observe",
"canary_percent": 123,
"issued_against_provenance": "<string>",
"agent_id": "<string>",
"kind": "<string>",
"environment": "<string>",
"principal_type": "<string>",
"principal_id": "<string>",
"parent_grant_id": "<string>",
"depth": 123,
"scope": {},
"audience": "<string>",
"policy": "<string>",
"policy_rendering": "<string>",
"budget_amount_minor": 123,
"budget_currency": "<string>",
"spent_amount_minor": 123,
"budget_count": 123,
"spent_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"not_before": "2023-11-07T05:31:56Z",
"not_after": "2023-11-07T05:31:56Z",
"conditions": {},
"delegation_policy": "<string>",
"status": "<string>",
"held_amount_minor": 0,
"held_count": 0,
"pending_reason": "<string>",
"revoked_at": "2023-11-07T05:31:56Z",
"revoked_by": "<string>",
"revoked_by_email": "<string>",
"revocation_reason": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
application/json
Response
Successful Response
