MAIP-Richtlinie bewerten
curl --request POST \
--url https://api.truthlocks.com/v1/maip/policies/evaluate \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"agent_id": "<string>",
"scope": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: '<string>', scope: '<string>'})
};
fetch('https://api.truthlocks.com/v1/maip/policies/evaluate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/maip/policies/evaluate"
payload = {
"agent_id": "<string>",
"scope": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/maip/policies/evaluate"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"scope\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}{
"allowed": true,
"denied_by": [
"<string>"
],
"reason": "<string>",
"requires_approval": true
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}MAIP-Richtlinien
MAIP-Richtlinie bewerten
Bewerten Sie alle aktiven Agentenrichtlinien für einen bestimmten Agenten und den angeforderten Bereich
POST
/
v1
/
maip
/
policies
/
evaluate
MAIP-Richtlinie bewerten
curl --request POST \
--url https://api.truthlocks.com/v1/maip/policies/evaluate \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"agent_id": "<string>",
"scope": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: '<string>', scope: '<string>'})
};
fetch('https://api.truthlocks.com/v1/maip/policies/evaluate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/maip/policies/evaluate"
payload = {
"agent_id": "<string>",
"scope": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/maip/policies/evaluate"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"scope\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}{
"allowed": true,
"denied_by": [
"<string>"
],
"reason": "<string>",
"requires_approval": true
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}MAIP-Richtlinie bewerten
POST /v1/maip/policies/evaluate
Bewertet alle aktiven MAIP-Richtlinien für den authentifizierten Mandanten anhand eines bestimmten Agenten und des angeforderten Geltungsbereichs. Gibt zurück, ob die Aktion erlaubt, verweigert oder menschliche Genehmigung erfordert. Dies ist der Laufzeit-Durchsetzungskontrollpunkt, den Agenten vor der Durchführung sensibler Operationen aufrufen.
Die Richtlinienbewertung verwendet ein Deny-Overrides-Modell: Wenn eine aktive Richtlinie mit einem
übereinstimmende
deny Regel-Trigger, wird die Aktion blockiert, unabhängig von jeglichen allow
Regeln. Das Flag requires_approval ist additiv – es kann auch dann gesetzt werden, wenn die
Aktion ist erlaubt.Authentifizierung
ErfordertX-API-Key Header oder Bearer JWT Token. Mandantenbezogen über Cookie oder JWT Claim.
Bewertungslogik
Die Bewertung führt drei sequentielle Prüfungen durch:- Agenten-Statusprüfung – Der Agent muss
status: "active"sein. Gesperrte oder widerrufene Agenten werden immer abgelehnt. - Bereichszugriffsprüfung – Der angeforderte Bereich muss in den gewährten Bereichen des Agenten vorhanden sein. Explizit verweigerte Bereiche (mit dem Präfix
!) blockieren immer den Zugriff. - Richtlinienregeln prüfen – Alle aktiven Mandantenrichtlinien werden in der Reihenfolge ihrer Priorität ausgewertet. Die Bedingungen jeder Regel werden mit UND verknüpft. Wenn eine
deny-Regel übereinstimmt, wird die Aktion blockiert.
Antwort
Menschenlesbarer Grund für die Ablehnung. Einer von: -
"agent is not active" — Agent
ist gesperrt oder widerrufen – "scope not granted to agent" – Bereich nicht in
gewährte Bereiche des Agenten – "denied by policy" – Eine oder mehrere Richtlinien blockiert
die Aktiontrue, wenn eine übereinstimmende Richtlinienregel requires_approval: true hat, selbst wenn die
Aktion anderweitig erlaubt ist. Der Aufrufer sollte eine menschliche Genehmigung vorlegen
Workflow, bevor Sie fortfahren.Beispiel
curl -X POST https://api.truthlocks.com/v1/maip/policies/evaluate \
-H "X-API-Key: tl_live_..." \
-H "Content-Type: application/json" \
-d '{
"agent_id": "maip:t1234567:01HYX3KPZQ7RJGBN0WFMV8SDEH",
"scope": "data:write",
"action": "update_customer_record",
"resource": "customers/cust_12345"
}'
const response = await fetch(
"https://api.truthlocks.com/v1/maip/policies/evaluate",
{
method: "POST",
headers: {
"X-API-Key": "tl_live_...",
"Content-Type": "application/json",
},
body: JSON.stringify({
agent_id: "maip:t1234567:01HYX3KPZQ7RJGBN0WFMV8SDEH",
scope: "data:write",
action: "update_customer_record",
resource: "customers/cust_12345",
}),
},
);
const result = await response.json();
if (!result.allowed) {
console.error(`Denied by: ${result.denied_by.join(", ")}`);
} else if (result.requires_approval) {
// Route to human approval workflow
}
import requests
response = requests.post(
"https://api.truthlocks.com/v1/maip/policies/evaluate",
headers={
"X-API-Key": "tl_live_...",
"Content-Type": "application/json",
},
json={
"agent_id": "maip:t1234567:01HYX3KPZQ7RJGBN0WFMV8SDEH",
"scope": "data:write",
"action": "update_customer_record",
"resource": "customers/cust_12345",
},
)
result = response.json()
Autorisierungen
Body
application/json

