Wire the check in one request.
Aprve sits in front of the action. The calling system authenticates with a scoped token, sends the agent identity and the requested action, and gets a decision plus a record hash in the same round trip.
1. Get a scoped token
Keys are scoped to a client, carry an optional expiry, and are revocable at any time. Aprve stores only a hash of the key: the plaintext is shown once, at creation.
# 1. issue a scoped capability token in the console (API keys → new key)
# the plaintext is shown once; Aprve stores only its hash
export APRVE_KEY="apr_live_9f2c4d1e8b77a41e"2. Call the decision endpoint
One endpoint. No external calls are made on the decision path: policy is evaluated locally against the active version for the client.
curl -s https://aprve-trust.base44.app/api/v1/authorize \
-H "Authorization: Bearer $APRVE_KEY" \
-H "Content-Type: application/json" \
-d '{
"client": "northwind",
"agent_id": "triage-bot-04",
"action": {
"tool": "refund.create",
"amount_usd": 480,
"data_classes": ["customer", "payment"]
},
"context": { "ticket": "T-8841", "requested_by": "support-agent" }
}'The response names the rule that fired and explains it in plain language:
{
"decision_id": "dec_7f3a91c4b2",
"decision": "allow",
"decision_source": "policy",
"matched_rule_id": "spend-under-500",
"matched_rule_name": "Refunds under 500 USD",
"policy_version": 7,
"explanation": "Refund of 480.00 USD is under the 500.00 USD automated ceiling and touches no restricted data class.",
"record": { "seq": 1842, "hash": "9f2c4d1e8b77a41e..." },
"latency_ms": 41,
"expires_at": null
}3. Branch on the decision
Three outcomes, no ambiguity. Treat anything that is not an explicit allow as a stop, and treat a network failure as a deny.
if (res.decision === "allow") {
await performAction();
} else {
throw new Error(`Blocked by policy ${res.policy_version}: ${res.explanation}`);
}4. Verify the record
Every decision returns a record hash. That hash resolves publicly, with no account, on the verification endpoint or on a shareable page.
curl -s https://aprve-trust.base44.app/api/v1/verify/9f2c4d1e8b77a41e...
# → { "verified": true, "seq": 1842, "decision": "allow", ... }Verification recomputes the hash from the stored record and checks its position in the chain, so a modified record fails even if the database was edited directly.
What the record contains
Agent identity, the action as submitted, the policy and rule that decided it, the decision and its source (policy, human, or timeout default), the timestamp, the previous hash, and its own hash. Sequence numbers are monotonic per client, which is what makes a missing record detectable rather than merely suspicious.
Nothing is ever edited. A correction is a new record that references the one it corrects, and both remain in the log.
