BengarTrust infrastructure

Developers

Examples AVAILABLE

Working code for the flows people actually build.

A · Authorize an AI agent

const decision = await bengar.authorize({
  agent: process.env.AGENT_DID!,
  permit: process.env.AGENT_PERMIT!,
  action: "purchase",
  resource: `resource://company/procurement/${sku}`,
  amount: { minor: priceMinor, currency: "TRY" },
});

B · Simulate a policy before activating it

curl -sX POST "$GATEWAY/v1/projects/$PROJECT/policy/simulate" \
  -H "authorization: Bearer $BENGAR_API_KEY" \
  -H "content-type: application/json" \
  -d '{"request":{"agent":"did:key:…","action":"purchase",
       "resource":"resource://company/procurement/laptop",
       "amount":{"minor":500000,"currency":"TRY"}}}'

`agent` is required. A simulation is a question about somebody, and the endpoint refuses a request that does not say who.

C · Handle an approval-required decision

if (decision.decision === "REQUIRE_APPROVAL") {
  // Not an allow. Record that the work is waiting and stop.
  await queue.park(orderId, decision.request_id);
  return;
}

D · Verify a proof

curl -s "$GATEWAY/v1/projects/$PROJECT/audit/$AUDIT_ID/proof" \
  -H "authorization: Bearer $BENGAR_API_KEY"

E · Resolve an UNKNOWN execution

curl -sX POST "$GATEWAY/v1/projects/$PROJECT/executions/resolve" \
  -H "authorization: Bearer $BENGAR_API_KEY" \
  -H "content-type: application/json" \
  -d '{"execution_id":"…","outcome":"SUCCEEDED",
       "note":"merchant order 88213 exists, created 14:02"}'

F · Query the indexer

The Indexer is an internal read model. Scan's server reads it and browsers read Scan; there is no public indexer endpoint to point an example at.

API reference · Errors