Skip to main content

CGR API Reference

The CGR endpoints let you record governed judgment decisions, their resolved outcomes, and peer reviews, and read the resulting per-(agent, domain) reputation. See CGR concepts for the model.

Availability

Live in GRAFOMEM Cloud (early). Endpoints and scoring work today; the reputation layer is young — don't assume production-scale throughput.

Authentication

All CGR endpoints are tenant-scoped. Authenticate with your tenant API key in the X-API-Key header:

curl -H "X-API-Key: <your-tenant-api-key>" \
https://cloud.grafomem.com/v1/cgr/scores

Reading reputation requires the cgr:read scope; recording decisions, outcomes, and reviews requires a valid tenant context.

How this differs from Decision Trail and the Governance Gateway

These three surfaces are easy to conflate. They answer different questions:

SurfacePrefixQuestion it answersWhen
Governance Gateway/v1/governance"Is this operation allowed to run?" — rate limits, model allowlists, content/PII filters, HITL gatesbefore execution
Decision Trail/v1/decisions"What happened?" — immutable, Ed25519-signed audit log of every inferenceat execution
CGR/v1/governed/* + /v1/cgr/scores"How well-calibrated has this agent proven to be?" — reputation from resolved outcomesafter outcomes resolve

Note the naming: /v1/governed/decisions (CGR substrate — a judgment decision that can later earn reputation) is not the same as /v1/decisions (the general inference audit log).

Record a governed decision

POST /v1/governed/decisions — record a governed judgment decision. Only decisions tagged as judgment can earn reputation; deterministic/rule outputs are recorded but earn nothing.

curl -X POST https://cloud.grafomem.com/v1/governed/decisions \
-H "X-API-Key: <your-tenant-api-key>" \
-H "Content-Type: application/json" \
-d '{
"decision": "certify",
"reason": "supporting documents consistent",
"invoice_id": "REF-1001",
"context": { "amount": 4200 },
"model_id": "your-model-v1",
"agent_handle": "certifier@your-domain",
"verifiability_tag": "judgment",
"agent_key": "<agent-ed25519-public-key-hex>"
}'
FieldTypeNotes
decisionstringcertify or reject
reasonstringfree-text rationale
invoice_idstring?the referent this decision is about
contextobjectthe fields the decision was made on
model_idstringmodel identifier
agent_handlestringthe deciding agent
verifiability_tagstringjudgment (scored) or rule (earns nothing)
agent_keystring?the acting agent's Ed25519 public key (hex), supplied by the emitter. Absent ⇒ the decision is unbindable and stays unproven.

Record an outcome

POST /v1/governed/outcomes — record how a decision's referent actually resolved. This is the verifiable channel: resolved outcomes update the Beta posterior directly.

curl -X POST https://cloud.grafomem.com/v1/governed/outcomes \
-H "X-API-Key: <your-tenant-api-key>" \
-H "Content-Type: application/json" \
-d '{ "invoice_ref": "REF-1001", "outcome": "paid", "source": "manual" }'
FieldTypeNotes
invoice_refstringjoins the outcome to the decision's referent
outcomestringe.g. paid, default, disputed, late, written_off
outcome_datestring?ISO-8601; defaults to now
amount_recoverednumber?optional
sourcestringprovenance of the outcome (e.g. manual)

Bulk: POST /v1/governed/outcomes/bulk accepts a JSON array of the same objects.

Record a review

POST /v1/governed/reviews — record a peer review of a decision. This is the review channel: each review's contribution is scaled by the reviewer's calibration weight (see the review gate).

curl -X POST https://cloud.grafomem.com/v1/governed/reviews \
-H "X-API-Key: <your-tenant-api-key>" \
-H "Content-Type: application/json" \
-d '{
"invoice_ref": "REF-1001",
"reviewer_handle": "reviewer@your-domain",
"rating": 0.9,
"agent_handle": "certifier@your-domain",
"source": "analyst"
}'
FieldTypeNotes
invoice_refstringreferent under review
reviewer_handlestringthe reviewer (dedup key with invoice_ref)
ratingnumberin [0, 1]
agent_handlestring?who certified; back-filled at score time if omitted
decision_idstring?precise referent
review_datestring?ISO-8601; defaults to now
sourcestringe.g. analyst, manual

Bulk: POST /v1/governed/reviews/bulk accepts a JSON array. Within one batch, duplicates by (invoice_ref, reviewer_handle) collapse to the last entry.

Read reputation

GET /v1/cgr/scores — the current reputation for every scored agent in your tenant. Requires cgr:read.

curl -H "X-API-Key: <your-tenant-api-key>" \
"https://cloud.grafomem.com/v1/cgr/scores?limit=500"
{
"scores": [
{
"agent_handle": "certifier@your-domain",
"cgr_score": 0.82,
"confidence": 24.0,
"n_resolved": 22,
"n_pending": 3,
"capability_tier": null,
"as_of": "2026-08-18T00:00:00Z",
"dimension": "receivables"
}
],
"count": 1,
"as_of": "2026-08-18T00:00:00Z",
"dimension": "receivables"
}
FieldMeaning
cgr_scoreposterior mean α / (α + β)
confidenceevidence mass n = α + βn_resolved plus the neutral prior's two pseudo-counts (e.g. 22 resolved ⇒ 24)
n_resolvedresolved judgment-certifies that updated the posterior
n_pendingjudgment-certifies still awaiting an outcome
capability_tierreserved; not currently assigned (null)
dimensionthe reputation domain (currently receivables)

Score and confidence travel together — a score is only as trustworthy as the evidence mass behind it.

GET /v1/cgr/scores/{agent_handle} returns a single agent's score object (404 if that agent has no score yet).