curl --request POST \
--url https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_type": "payment.create",
"resource": "<string>",
"cost_cents": 75000,
"metadata": {},
"session_budget_cents": 100000,
"policy": {
"mode": "blocklist",
"per_transaction_cap_cents": 123,
"velocity_window_seconds": 123,
"velocity_cap_cents": 123,
"approval_threshold_cents": 123,
"monthly_cap_cents": 123,
"counterparty_allowlist": [
"<string>"
],
"imports": [
"<string>"
],
"rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_name": "<string>",
"action_types": [
"<string>"
],
"allow": [
"<string>"
],
"max_cents": 123,
"window_seconds": 2,
"max_actions": 2,
"above_cents": 123,
"effect": "deny",
"when": {
"all_of": "<array>",
"any_of": "<array>",
"not": "<unknown>",
"field": "metadata.preapproved",
"value": "<unknown>"
}
}
]
}
}
'import requests
url = "https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_type": "payment.create",
"resource": "<string>",
"cost_cents": 75000,
"metadata": {},
"session_budget_cents": 100000,
"policy": {
"mode": "blocklist",
"per_transaction_cap_cents": 123,
"velocity_window_seconds": 123,
"velocity_cap_cents": 123,
"approval_threshold_cents": 123,
"monthly_cap_cents": 123,
"counterparty_allowlist": ["<string>"],
"imports": ["<string>"],
"rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_name": "<string>",
"action_types": ["<string>"],
"allow": ["<string>"],
"max_cents": 123,
"window_seconds": 2,
"max_actions": 2,
"above_cents": 123,
"effect": "deny",
"when": {
"all_of": "<array>",
"any_of": "<array>",
"not": "<unknown>",
"field": "metadata.preapproved",
"value": "<unknown>"
}
}
]
}
}
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: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
action_type: 'payment.create',
resource: '<string>',
cost_cents: 75000,
metadata: {},
session_budget_cents: 100000,
policy: {
mode: 'blocklist',
per_transaction_cap_cents: 123,
velocity_window_seconds: 123,
velocity_cap_cents: 123,
approval_threshold_cents: 123,
monthly_cap_cents: 123,
counterparty_allowlist: ['<string>'],
imports: ['<string>'],
rules: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
rule_name: '<string>',
action_types: ['<string>'],
allow: ['<string>'],
max_cents: 123,
window_seconds: 2,
max_actions: 2,
above_cents: 123,
effect: 'deny',
when: {
all_of: '<array>',
any_of: '<array>',
not: '<unknown>',
field: 'metadata.preapproved',
value: '<unknown>'
}
}
]
}
})
};
fetch('https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews', 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://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews",
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' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'action_type' => 'payment.create',
'resource' => '<string>',
'cost_cents' => 75000,
'metadata' => [
],
'session_budget_cents' => 100000,
'policy' => [
'mode' => 'blocklist',
'per_transaction_cap_cents' => 123,
'velocity_window_seconds' => 123,
'velocity_cap_cents' => 123,
'approval_threshold_cents' => 123,
'monthly_cap_cents' => 123,
'counterparty_allowlist' => [
'<string>'
],
'imports' => [
'<string>'
],
'rules' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'rule_name' => '<string>',
'action_types' => [
'<string>'
],
'allow' => [
'<string>'
],
'max_cents' => 123,
'window_seconds' => 2,
'max_actions' => 2,
'above_cents' => 123,
'effect' => 'deny',
'when' => [
'all_of' => '<array>',
'any_of' => '<array>',
'not' => '<unknown>',
'field' => 'metadata.preapproved',
'value' => '<unknown>'
]
]
]
]
]),
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://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_type\": \"payment.create\",\n \"resource\": \"<string>\",\n \"cost_cents\": 75000,\n \"metadata\": {},\n \"session_budget_cents\": 100000,\n \"policy\": {\n \"mode\": \"blocklist\",\n \"per_transaction_cap_cents\": 123,\n \"velocity_window_seconds\": 123,\n \"velocity_cap_cents\": 123,\n \"approval_threshold_cents\": 123,\n \"monthly_cap_cents\": 123,\n \"counterparty_allowlist\": [\n \"<string>\"\n ],\n \"imports\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rule_name\": \"<string>\",\n \"action_types\": [\n \"<string>\"\n ],\n \"allow\": [\n \"<string>\"\n ],\n \"max_cents\": 123,\n \"window_seconds\": 2,\n \"max_actions\": 2,\n \"above_cents\": 123,\n \"effect\": \"deny\",\n \"when\": {\n \"all_of\": \"<array>\",\n \"any_of\": \"<array>\",\n \"not\": \"<unknown>\",\n \"field\": \"metadata.preapproved\",\n \"value\": \"<unknown>\"\n }\n }\n ]\n }\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://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_type\": \"payment.create\",\n \"resource\": \"<string>\",\n \"cost_cents\": 75000,\n \"metadata\": {},\n \"session_budget_cents\": 100000,\n \"policy\": {\n \"mode\": \"blocklist\",\n \"per_transaction_cap_cents\": 123,\n \"velocity_window_seconds\": 123,\n \"velocity_cap_cents\": 123,\n \"approval_threshold_cents\": 123,\n \"monthly_cap_cents\": 123,\n \"counterparty_allowlist\": [\n \"<string>\"\n ],\n \"imports\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rule_name\": \"<string>\",\n \"action_types\": [\n \"<string>\"\n ],\n \"allow\": [\n \"<string>\"\n ],\n \"max_cents\": 123,\n \"window_seconds\": 2,\n \"max_actions\": 2,\n \"above_cents\": 123,\n \"effect\": \"deny\",\n \"when\": {\n \"all_of\": \"<array>\",\n \"any_of\": \"<array>\",\n \"not\": \"<unknown>\",\n \"field\": \"metadata.preapproved\",\n \"value\": \"<unknown>\"\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews")
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\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_type\": \"payment.create\",\n \"resource\": \"<string>\",\n \"cost_cents\": 75000,\n \"metadata\": {},\n \"session_budget_cents\": 100000,\n \"policy\": {\n \"mode\": \"blocklist\",\n \"per_transaction_cap_cents\": 123,\n \"velocity_window_seconds\": 123,\n \"velocity_cap_cents\": 123,\n \"approval_threshold_cents\": 123,\n \"monthly_cap_cents\": 123,\n \"counterparty_allowlist\": [\n \"<string>\"\n ],\n \"imports\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rule_name\": \"<string>\",\n \"action_types\": [\n \"<string>\"\n ],\n \"allow\": [\n \"<string>\"\n ],\n \"max_cents\": 123,\n \"window_seconds\": 2,\n \"max_actions\": 2,\n \"above_cents\": 123,\n \"effect\": \"deny\",\n \"when\": {\n \"all_of\": \"<array>\",\n \"any_of\": \"<array>\",\n \"not\": \"<unknown>\",\n \"field\": \"metadata.preapproved\",\n \"value\": \"<unknown>\"\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"outcome": "allowed",
"rule": "per_transaction_cap",
"detail": {},
"headroom": {},
"policy_snapshot": [
{}
],
"policy_version": "pv_8f2c1d0a4b6e93571ac2e8d045f7b312",
"frame_hash": "fh_1b9a0c7e5d2f483610badc0ffee1234567890abcdef1234567890abcdef123456",
"remedy": {
"kind": "lower_amount",
"summary": "A per-action cap applies. Retry at $100.00 or less.",
"max_cents": 123,
"retry_after_seconds": 123,
"resource": "<string>",
"action_type": "<string>"
}
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}Preview a draft policy
Evaluate a policy you have not saved against a synthetic action, and get back the decision it would produce.
Nothing is persisted: no policy, no session, no intent, and no audit event. This is the call behind a “what would this do?” affordance in your own console.
Requires only the read capability, deliberately. Previewing is not a mutation.
imports resolve against the workspace’s real saved modules, so you can preview a
draft that builds on modules already in place.
curl --request POST \
--url https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_type": "payment.create",
"resource": "<string>",
"cost_cents": 75000,
"metadata": {},
"session_budget_cents": 100000,
"policy": {
"mode": "blocklist",
"per_transaction_cap_cents": 123,
"velocity_window_seconds": 123,
"velocity_cap_cents": 123,
"approval_threshold_cents": 123,
"monthly_cap_cents": 123,
"counterparty_allowlist": [
"<string>"
],
"imports": [
"<string>"
],
"rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_name": "<string>",
"action_types": [
"<string>"
],
"allow": [
"<string>"
],
"max_cents": 123,
"window_seconds": 2,
"max_actions": 2,
"above_cents": 123,
"effect": "deny",
"when": {
"all_of": "<array>",
"any_of": "<array>",
"not": "<unknown>",
"field": "metadata.preapproved",
"value": "<unknown>"
}
}
]
}
}
'import requests
url = "https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_type": "payment.create",
"resource": "<string>",
"cost_cents": 75000,
"metadata": {},
"session_budget_cents": 100000,
"policy": {
"mode": "blocklist",
"per_transaction_cap_cents": 123,
"velocity_window_seconds": 123,
"velocity_cap_cents": 123,
"approval_threshold_cents": 123,
"monthly_cap_cents": 123,
"counterparty_allowlist": ["<string>"],
"imports": ["<string>"],
"rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_name": "<string>",
"action_types": ["<string>"],
"allow": ["<string>"],
"max_cents": 123,
"window_seconds": 2,
"max_actions": 2,
"above_cents": 123,
"effect": "deny",
"when": {
"all_of": "<array>",
"any_of": "<array>",
"not": "<unknown>",
"field": "metadata.preapproved",
"value": "<unknown>"
}
}
]
}
}
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: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
action_type: 'payment.create',
resource: '<string>',
cost_cents: 75000,
metadata: {},
session_budget_cents: 100000,
policy: {
mode: 'blocklist',
per_transaction_cap_cents: 123,
velocity_window_seconds: 123,
velocity_cap_cents: 123,
approval_threshold_cents: 123,
monthly_cap_cents: 123,
counterparty_allowlist: ['<string>'],
imports: ['<string>'],
rules: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
rule_name: '<string>',
action_types: ['<string>'],
allow: ['<string>'],
max_cents: 123,
window_seconds: 2,
max_actions: 2,
above_cents: 123,
effect: 'deny',
when: {
all_of: '<array>',
any_of: '<array>',
not: '<unknown>',
field: 'metadata.preapproved',
value: '<unknown>'
}
}
]
}
})
};
fetch('https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews', 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://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews",
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' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'action_type' => 'payment.create',
'resource' => '<string>',
'cost_cents' => 75000,
'metadata' => [
],
'session_budget_cents' => 100000,
'policy' => [
'mode' => 'blocklist',
'per_transaction_cap_cents' => 123,
'velocity_window_seconds' => 123,
'velocity_cap_cents' => 123,
'approval_threshold_cents' => 123,
'monthly_cap_cents' => 123,
'counterparty_allowlist' => [
'<string>'
],
'imports' => [
'<string>'
],
'rules' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'rule_name' => '<string>',
'action_types' => [
'<string>'
],
'allow' => [
'<string>'
],
'max_cents' => 123,
'window_seconds' => 2,
'max_actions' => 2,
'above_cents' => 123,
'effect' => 'deny',
'when' => [
'all_of' => '<array>',
'any_of' => '<array>',
'not' => '<unknown>',
'field' => 'metadata.preapproved',
'value' => '<unknown>'
]
]
]
]
]),
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://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_type\": \"payment.create\",\n \"resource\": \"<string>\",\n \"cost_cents\": 75000,\n \"metadata\": {},\n \"session_budget_cents\": 100000,\n \"policy\": {\n \"mode\": \"blocklist\",\n \"per_transaction_cap_cents\": 123,\n \"velocity_window_seconds\": 123,\n \"velocity_cap_cents\": 123,\n \"approval_threshold_cents\": 123,\n \"monthly_cap_cents\": 123,\n \"counterparty_allowlist\": [\n \"<string>\"\n ],\n \"imports\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rule_name\": \"<string>\",\n \"action_types\": [\n \"<string>\"\n ],\n \"allow\": [\n \"<string>\"\n ],\n \"max_cents\": 123,\n \"window_seconds\": 2,\n \"max_actions\": 2,\n \"above_cents\": 123,\n \"effect\": \"deny\",\n \"when\": {\n \"all_of\": \"<array>\",\n \"any_of\": \"<array>\",\n \"not\": \"<unknown>\",\n \"field\": \"metadata.preapproved\",\n \"value\": \"<unknown>\"\n }\n }\n ]\n }\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://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_type\": \"payment.create\",\n \"resource\": \"<string>\",\n \"cost_cents\": 75000,\n \"metadata\": {},\n \"session_budget_cents\": 100000,\n \"policy\": {\n \"mode\": \"blocklist\",\n \"per_transaction_cap_cents\": 123,\n \"velocity_window_seconds\": 123,\n \"velocity_cap_cents\": 123,\n \"approval_threshold_cents\": 123,\n \"monthly_cap_cents\": 123,\n \"counterparty_allowlist\": [\n \"<string>\"\n ],\n \"imports\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rule_name\": \"<string>\",\n \"action_types\": [\n \"<string>\"\n ],\n \"allow\": [\n \"<string>\"\n ],\n \"max_cents\": 123,\n \"window_seconds\": 2,\n \"max_actions\": 2,\n \"above_cents\": 123,\n \"effect\": \"deny\",\n \"when\": {\n \"all_of\": \"<array>\",\n \"any_of\": \"<array>\",\n \"not\": \"<unknown>\",\n \"field\": \"metadata.preapproved\",\n \"value\": \"<unknown>\"\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/control/v1/workspaces/{workspace_slug}/policy_previews")
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\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_type\": \"payment.create\",\n \"resource\": \"<string>\",\n \"cost_cents\": 75000,\n \"metadata\": {},\n \"session_budget_cents\": 100000,\n \"policy\": {\n \"mode\": \"blocklist\",\n \"per_transaction_cap_cents\": 123,\n \"velocity_window_seconds\": 123,\n \"velocity_cap_cents\": 123,\n \"approval_threshold_cents\": 123,\n \"monthly_cap_cents\": 123,\n \"counterparty_allowlist\": [\n \"<string>\"\n ],\n \"imports\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rule_name\": \"<string>\",\n \"action_types\": [\n \"<string>\"\n ],\n \"allow\": [\n \"<string>\"\n ],\n \"max_cents\": 123,\n \"window_seconds\": 2,\n \"max_actions\": 2,\n \"above_cents\": 123,\n \"effect\": \"deny\",\n \"when\": {\n \"all_of\": \"<array>\",\n \"any_of\": \"<array>\",\n \"not\": \"<unknown>\",\n \"field\": \"metadata.preapproved\",\n \"value\": \"<unknown>\"\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"outcome": "allowed",
"rule": "per_transaction_cap",
"detail": {},
"headroom": {},
"policy_snapshot": [
{}
],
"policy_version": "pv_8f2c1d0a4b6e93571ac2e8d045f7b312",
"frame_hash": "fh_1b9a0c7e5d2f483610badc0ffee1234567890abcdef1234567890abcdef123456",
"remedy": {
"kind": "lower_amount",
"summary": "A per-action cap applies. Retry at $100.00 or less.",
"max_cents": 123,
"retry_after_seconds": 123,
"resource": "<string>",
"action_type": "<string>"
}
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}Authorizations
An identity bearer token for a person or your backend. Capabilities are per member, per workspace. This credential can manage the workspace and can never authorize an action as an agent.
Path Parameters
Body
"payment.create"
75000
The synthetic session budget to evaluate against.
The policy shape, without an agent binding. Used for previews.
Show child attributes
Show child attributes
Response
The decision the draft would produce.
Show child attributes
Show child attributes