Create MAIP Policy
curl --request POST \
--url https://api.truthlocks.com/v1/maip/policies \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://api.truthlocks.com/v1/maip/policies', 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"
payload = { "name": "<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"
payload := strings.NewReader("{\n \"name\": \"<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))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"category": "scope",
"status": "active",
"priority": 123,
"rules": [
{
"conditions": [
{
"field": "trust_score",
"op": "eq",
"value": "<unknown>"
}
],
"effect": "allow",
"requires_approval": true
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}MAIP Policies
Create MAIP Policy
Create a new agent enforcement policy with conditional rules for runtime access control
POST
/
v1
/
maip
/
policies
Create MAIP Policy
curl --request POST \
--url https://api.truthlocks.com/v1/maip/policies \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://api.truthlocks.com/v1/maip/policies', 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"
payload = { "name": "<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"
payload := strings.NewReader("{\n \"name\": \"<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))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"category": "scope",
"status": "active",
"priority": 123,
"rules": [
{
"conditions": [
{
"field": "trust_score",
"op": "eq",
"value": "<unknown>"
}
],
"effect": "allow",
"requires_approval": true
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Create MAIP Policy
POST /v1/maip/policies
Creates a new MAIP agent enforcement policy for the authenticated tenant. Policies define runtime rules that are evaluated when agents request access to scoped resources via the Evaluate Policy endpoint.
MAIP policies are different from RBAC issuance
policies. MAIP policies govern machine
agent behavior at runtime based on trust scores, delegation depth, scopes,
and agent type. RBAC policies govern credential issuance and human user
access.
Authentication
RequiresX-API-Key header or Bearer JWT token. Tenant-scoped via cookie or JWT claim.
Response
Returns the created policy object with server-generated fields (id, tenant_id, status, timestamps).
Example
curl -X POST https://api.truthlocks.com/v1/maip/policies \
-H "X-API-Key: tl_live_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Block Low-Trust Write Operations",
"description": "Deny data:write scope access for agents with trust score below 0.5",
"category": "trust",
"priority": 10,
"rules": [
{
"conditions": [
{"field": "trust_score", "op": "lt", "value": 0.5},
{"field": "scope", "op": "eq", "value": "data:write"}
],
"effect": "deny",
"requires_approval": false
}
]
}'
const response = await fetch("https://api.truthlocks.com/v1/maip/policies", {
method: "POST",
headers: {
"X-API-Key": "tl_live_...",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Block Low-Trust Write Operations",
description:
"Deny data:write scope access for agents with trust score below 0.5",
category: "trust",
priority: 10,
rules: [
{
conditions: [
{ field: "trust_score", op: "lt", value: 0.5 },
{ field: "scope", op: "eq", value: "data:write" },
],
effect: "deny",
requires_approval: false,
},
],
}),
});
const policy = await response.json();
import requests
response = requests.post(
"https://api.truthlocks.com/v1/maip/policies",
headers={
"X-API-Key": "tl_live_...",
"Content-Type": "application/json",
},
json={
"name": "Block Low-Trust Write Operations",
"description": "Deny data:write scope access for agents with trust score below 0.5",
"category": "trust",
"priority": 10,
"rules": [
{
"conditions": [
{"field": "trust_score", "op": "lt", "value": 0.5},
{"field": "scope", "op": "eq", "value": "data:write"},
],
"effect": "deny",
"requires_approval": False,
}
],
},
)
policy = response.json()
Body
application/json
Response
Policy created

