Quickstart

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.

shell
# 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.

POST /api/v1/authorize
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:

200 OK
{
  "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.

javascript
if (res.decision === "allow") {
  await performAction();
} else {
  throw new Error(`Blocked by policy ${res.policy_version}: ${res.explanation}`);
}
Fail closed. If Aprve is unreachable, do not proceed. The default is deny, and it is the only default that cannot be gamed by taking the checker offline.

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.

GET /api/v1/verify/{hash}
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.

A decision you can verify right now
permanent demo decisionALLOW
action
refund.create · $180
rule
Refunds up to 250 USD
record
seq 1
sha-256
078506dc86…8a5948
statement
anchored
receipt
moment-j5xx23u1
dec_demo_permanent

Cite: Aprve decision dec_demo_permanent, seq 1, sha-256 078506dc868d5413af74db8267801c4bf602dea47d0446ef97ca517d5e8a5948