Service

API reference

Shapes below are the fields this service returns. FastAPI generates the machine-readable description at /docs/openapi and /openapi.json.

GET /health

Service probe. No API key. Same body as /v1/health.

Response

{
  "status": "ok",
  "database": "ok"
}

503 {"status": "unavailable", "database": "unavailable"} when the database check fails. The body has no error text.

GET /v1/health

Service probe on the versioned API. No API key. Same body as /health.

Response

{
  "status": "ok",
  "database": "ok"
}

503 {"status": "unavailable", "database": "unavailable"} when the database check fails. The body has no error text.

GET /v1/revocations

Pull list of stored principal revocations. The response sets Cache-Control: public, max-age=300.

Response

{
  "revocations": []
}

503 {"error": "DATABASE_URL is not set"} when storage is not configured.

POST /v1/revocations/push

Notifier-signed webhook. The body is the object from sign_revocation_push: at, kata_revocation_push "1", revocation, and signature. signature is a flattened JWS whose protected header typ is kata-revocation-push+jws.

Request

{
  "at": "2026-10-04T18:00:00Z",
  "kata_revocation_push": "1",
  "revocation": {
    "agreement_id": "agr_demo",
    "at": "2026-10-04T18:00:00Z",
    "kata_revocation": "1",
    "mandate_hash": "sha256:…",
    "reason": "principal revoked",
    "signature": {"payload": "…", "protected": "…", "signature": "…"}
  },
  "signature": {"payload": "…", "protected": "…", "signature": "…"}
}

Response

{
  "stored": true,
  "revocation_id": "sha256:…",
  "sequence": 1
}

A repeat of the same revocation returns {"stored": false, "revocation_id": "sha256:…"} and does not append again. 401 {"error": "revocation push did not verify"}. 503 when KATA_PUSH_NOTIFIER_JWK or KATA_LOG_SIGNING_SEED is unset. 400 when the body is not a JSON object.

POST /v1/log/entries

Append an agreement, revocation, registration, or incident and sign a new tree head. Authorization: Bearer . Bureau registrations, revocations, and incidents are appended by the service itself.

Request

{
  "kind": "agreement",
  "body": {}
}

Response

{
  "entry": {
    "kind": "agreement",
    "sequence": 1,
    "body": {},
    "entry_hash": "sha256:…"
  },
  "tree_head": {
    "algorithm": "EdDSA",
    "at": "2026-10-04T14:02:11Z",
    "kata_tree_head": "1",
    "root": "sha256:…",
    "tree_size": 1,
    "signature": {"payload": "…", "protected": "…", "signature": "…"}
  }
}

kind is agreement, revocation, registration, or incident. A later entry also carries prev_entry_hash. The tree-head JWS typ is kata-tree-head+jws. 401 {"error": "append token does not match"}. 400 {"error": "log append needs kind and a body object"} and 400 when kind is rejected. 503 when KATA_APPEND_TOKEN or KATA_LOG_SIGNING_SEED is unset.

GET /v1/log/entries/{sequence}

One hash-chained entry. sequence starts at 1.

Response

{
  "entry": {
    "kind": "revocation",
    "sequence": 1,
    "body": {},
    "entry_hash": "sha256:…"
  }
}

404 {"error": "log entry was not found"} when the sequence is outside the log.

GET /v1/log/entries/{sequence}/proof

Merkle inclusion proof for that entry. index is sequence minus 1. side is left or right.

Response

{
  "sequence": 1,
  "index": 0,
  "leaf": "sha256:…",
  "proof": [{"hash": "sha256:…", "side": "right"}],
  "root": "sha256:…",
  "tree_size": 1
}

404 when the sequence is outside the tree.

GET /v1/log/head

Signed tree head. The same fields are on tree_head from a log append.

Response

{
  "algorithm": "EdDSA",
  "at": "2026-10-04T14:02:11Z",
  "kata_tree_head": "1",
  "root": "sha256:…",
  "tree_size": 1,
  "signature": {"payload": "…", "protected": "…", "signature": "…"}
}

404 {"error": "the transparency log has no signed tree head"} when nothing has been appended.

GET /.well-known/kata-keys.json

Log public key, plus any records in KATA_PUBLISHED_KEYS. An empty key list is a 200 when no seed is set.

Response

{
  "keys": [
    {"public_key": {"crv": "Ed25519", "kid": "sha256:…", "kty": "OKP", "x": "…"}}
  ]
}

500 when a configured key or seed fails to load.

GET /v1/fx?currency=CAD&reference=USD&day=YYYY-MM-DD

Reference-currency units for one unit of currency on that UTC day. reference_currency is an alias of reference. The default reference is USD. day defaults to the current UTC date. The rate is a decimal string from the configured source (default https://api.frankfurter.dev/v1). The same currency returns rate "1".

Response

{
  "currency": "CAD",
  "reference_currency": "USD",
  "day": "2026-10-04",
  "rate": "…"
}

400 when a currency is not three letters or day is not YYYY-MM-DD. 404 {"error": "no USD rate for CAD on YYYY-MM-DD"} when the source has no rate. 502 {"error": "FX source did not answer"}. 503 when DATABASE_URL is not set.

POST /demo/check

Signs one sample agreement with the public demo keys and evaluates one payment. principal is K. Uluer and the agent is shopper-01. demo is true. verdict is ALLOW, DENY, or STEP_UP. kata_decision is ALLOW, BLOCK, or STEP_UP. DENY maps to BLOCK.

Request

{
  "intent": {
    "maximum_amount": 1500,
    "currency": "CAD",
    "purpose": "purchase",
    "category": "electronics",
    "natural_language": "Find and buy a laptop for me, maximum CAD 1,500.",
    "include_expiry": true,
    "time_limit": "2026-12-31"
  },
  "payment": {
    "amount": 1300,
    "currency": "CAD",
    "merchant": "techstore.example",
    "item": "Laptop"
  }
}

Response

{
  "verdict": "ALLOW",
  "kata_decision": "ALLOW",
  "reasons": [],
  "messages": [],
  "required_action": "NONE",
  "confirmation_text": "…",
  "mandate_hash": "sha256:…",
  "principal": "K. Uluer",
  "principal_fingerprint": "sha256:…",
  "agent_id": "shopper-01",
  "agreement_id": "agr_demo",
  "status": "active",
  "demo": true
}

A payment of 4200 CAD against that ceiling returns verdict DENY, kata_decision BLOCK, and reasons including AMOUNT_ABOVE_INTENT_CEILING. include_expiry false returns verdict STEP_UP and reasons including OVER_BROAD_INTENT. 400 when an amount or currency is unusable.

GET /v1/score-model

Publishes the agent score weights. No credential is required. risk is 1000 minus the score. Individuals are not scored. GAB_SCORE_WEIGHTS can replace a weight for calibration.

Response

{
  "model_version": "gab-score-1",
  "subjects": "agents",
  "individuals_scored": false,
  "risk": "1000 - score",
  "reports": {"fraud_incident": -120}
}

500 when GAB_SCORE_WEIGHTS is not usable JSON or a weight is outside its range.

POST /v1/admin/consortium/members

Admin adds an organization to the fingerprint consortium. A second call returns the same membership.

Request

{
  "org_id": "org_…"
}

Response

{
  "member_id": "cmb_…",
  "org_id": "org_…",
  "status": "active"
}

403 without the admin token. 404 when the organization does not exist.

POST /v1/consortium/sightings

A member records a key fingerprint it has seen. The body is the fingerprint only. The same member and fingerprint is stored once.

Request

{
  "fingerprint": "sha256:…"
}

Response

{
  "sighting_id": "sgt_…",
  "fingerprint": "sha256:…",
  "seen_at": "2026-10-15T12:00:00Z"
}

403 when the caller is not a member. 400 when the fingerprint is not sha256 and 64 hex characters.

POST /v1/consortium/match

A member asks whether other members have sighted a fingerprint. The caller is not counted. At or above GAB_CONSORTIUM_MATCH_THRESHOLD (default 2) the response includes other_member_count. Below that threshold the count is omitted. The response does not name the other members.

Request

{
  "fingerprint": "sha256:…"
}

Response

{
  "matched": true,
  "other_member_count": 2
}

403 when the caller is not a member. 400 when the fingerprint is not sha256 and 64 hex characters.

POST /v1/orgs

Admin bootstrap. Creates a participant organization. org_type is agent_operator, wallet, bank_issuer, processor_psp, or merchant.

Request

{
  "name": "Harbor Agents",
  "org_type": "agent_operator"
}

Response

{
  "org_id": "org_…",
  "name": "Harbor Agents",
  "org_type": "agent_operator",
  "status": "active"
}

401 without the admin token. 403 for any other credential. 400 for an unknown org_type.

POST /v1/orgs/{org_id}/keys

Issues an API key. The raw token is returned once. Stored value is the SHA-256 hash. List responses omit the token.

Request

{
  "name": "primary"
}

Response

{
  "key_id": "key_…",
  "prefix": "…",
  "scopes": ["registry:read"],
  "token": "gab_…"
}

404 when another organization asks. 401 when the key is revoked.

POST /v1/agents

An agent operator registers an agent. public_key is an Ed25519 or P-256 JWK with no private d. principal_id is a pseudonymous id. Optional principal_email binds that address to the principal. An address already bound to a different principal is rejected. Optional device_signal and key_signal link the agent to a recently denied agent and inherit a penalty. proofing_evidence is sha256 and 64 hex characters. With proofing on, operator_verified adds 120 points only when that hash is present. Without it the score uses key_bound.

Request

{
  "agent_id": "shopper-01",
  "principal_id": "prn_demo",
  "verification_level": "operator_verified",
  "proofing_evidence": "sha256:…",
  "public_key": {"kty": "OKP", "crv": "Ed25519", "x": "…"}
}

Response

{
  "agent_id": "shopper-01",
  "status": "active",
  "verification_level": "operator_verified",
  "assurance_level": "operator_verified",
  "fingerprint": "sha256:…",
  "score": 700,
  "risk": 300,
  "model_version": "gab-score-1"
}

Other tenants do not receive principal_id. 409 when the agent id or key is already registered, or when principal_email is already bound to another principal. 400 when proofing_evidence is not sha256 and 64 hex characters.

POST /v1/agents/{agent_id}/proofing

Files operator_review from the agent's operator, or institution_attestation from a wallet or bank. evidence_hash is sha256 and 64 hex characters. The claim in verification_level stays as set. assurance_level is what the score uses. key_binding is written at registration and is not accepted here. The operator, the admin, and the principal can list the rows. Other tenants see assurance_level only.

Request

{
  "method": "institution_attestation",
  "evidence_hash": "sha256:…"
}

Response

{
  "agent_id": "shopper-01",
  "verification_level": "institution_attested",
  "assurance_level": "institution_attested",
  "score": 780
}

403 when the caller cannot file that method. 400 for an unknown method or a bad hash.

POST /v1/verify

Checks a payment action against the agent's active stored agreement. ALLOW records the spend and the caller's organization as a transaction counterparty, unless counterparty_org_id names another organization. A daily count or amount window above the configured cap returns DENY with kata_decision BLOCK and VELOCITY_COUNT or VELOCITY_AMOUNT and does not record the spend. Other DENY results also use kata_decision BLOCK.

Request

{
  "agent_id": "shopper-01",
  "action": {"action_id": "act_1", "action_type": "purchase", "amount": 1300, "currency": "CAD", "proposed_at": "2026-10-04T13:55:00Z"}
}

Response

{
  "verdict": "ALLOW",
  "kata_decision": "ALLOW",
  "reasons": [],
  "agent_id": "shopper-01",
  "agreement_id": "agr_demo"
}

AGENT_NOT_ACTIVE, NO_ACTIVE_AGREEMENT, and AGREEMENT_NOT_SELECTED are bureau reasons. Library reasons such as AMOUNT_ABOVE_INTENT_CEILING are passed through.

POST /v1/inquiries

Purpose-coded inquiry. Returns identity, verification, active authorizations, revocations, incident counts, and the trust score. Contributors also receive recent evidence hashes.

Request

{
  "agent_id": "shopper-01",
  "purpose_code": "payment_authorization"
}

Response

{
  "inquiry_id": "inq_…",
  "agent": {"agent_id": "shopper-01", "status": "active", "verification_level": "institution_attested", "assurance_level": "institution_attested"},
  "trust_score": {"score": 724, "risk": 276, "model_version": "gab-score-1", "cold_start": false, "reasons": [{"code": "CHARGEBACK", "points": -56}]}
}

400 when purpose_code is missing. The body does not include an email address or principal_id.

POST /v1/reports

Files a transaction outcome, fraud incident, chargeback, or policy violation. evidence_hash is sha256 and 64 hex characters. The same reporter, agent, kind, and hash is a duplicate. The report is accepted only when this organization has an allowed verify with the agent that meets the link minimum. A stored report has counts true.

Request

{
  "agent_id": "shopper-01",
  "kind": "chargeback",
  "evidence_hash": "sha256:…",
  "summary": "Disputed purchase.",
  "action_id": "act_1"
}

Response

{
  "report_id": "rpt_…",
  "kind": "chargeback",
  "counts": true
}

400 when no qualifying verify is on file. 409 duplicate report. 429 when the organization exceeds the daily cap.

POST /v1/subscriptions

Subscribes the caller to signed webhooks for revocation, a new incident, and a score drop of 50 points or more. The signature typ is kata-bureau-alert+jws and uses the log signing key.

Request

{
  "agent_id": "shopper-01",
  "webhook_url": "https://merchant.example/hooks/gab"
}

Response

{
  "subscription_id": "sub_…",
  "agent_id": "shopper-01"
}

400 unless the URL is https and the host is not a loopback name.

POST /v1/webhooks/test

Sends one signed test alert to a subscription this organization already owns. The response is the alert id and whether delivery succeeded. It does not include the payload or the webhook address.

Request

{
  "subscription_id": "sub_…"
}

Response

{
  "alert_id": "alt_…",
  "delivered": true,
  "kind": "test"
}

404 when the subscription is missing or belongs to another organization. Failed attempts are retried after 0.5s, 1s, and 2s.

GET /v1/webhooks/deliveries

Delivery attempts for this organization. detail is delivered, timeout, http_error, or refused. The log does not include error text.

Response

[
  {
    "delivery_id": "dlv_…",
    "alert_id": "alt_…",
    "attempt": 1,
    "outcome": "delivered",
    "http_status": 204,
    "detail": "delivered"
  }
]

POST /v1/portal/magic-link

Sends a portal sign-in link. The response is always sent true. An email already bound to a principal keeps that principal. A new email creates a new principal id and does not move an existing binding. SMTP is used when the host, user, password, and from address are set. Otherwise the link is not printed unless the development mailbox is on.

Request

{
  "email": "principal@example.com"
}

Response

{
  "sent": true
}

POST /v1/sessions exchanges the token. A new email creates a new principal id. Registering principal_email on the agent binds the portal to that principal.

POST /v1/portal/passkeys/authenticate

Exchanges a passkey assertion for a portal session. The email link remains available at POST /v1/portal/magic-link. GAB_PASSKEY_ENROLLMENT defaults off. When it is set, the ceremony is discoverable: the options name no credential, user verification is preferred, and registration asks for a platform authenticator. A failure uses the same message whether or not an account exists. Registration stays on the signed-in session.

Request

{
  "credential": {"id": "…", "type": "public-key", "response": {}}
}

Response

{
  "token": "gab_sess_…",
  "kind": "portal",
  "principal_id": "prn_…"
}

401 when the passkey or the challenge is not valid.

GET /v1/portal/devices

Lists registered passkeys and consented push devices, plus the storage note. The response has no trust score.

Response

{
  "devices": [{"credential_id": "…", "label": "Phone"}],
  "stored": ["…"],
  "individual_score": false
}

401 without a portal session.

POST /v1/portal/disputes

Files a dispute. The body includes a fresh passkey assertion, the same check used to revoke an agent or an intent.

Request

{
  "report_id": "rpt_…",
  "statement": "…",
  "assertion": {}
}

Response

{
  "dispute_id": "dsp_…",
  "status": "open"
}

401 when no device is registered or the assertion is missing.

GET /v1/portal/approvals

Lists step-up approvals for this individual. Off unless GAB_STEP_UP_APPROVAL is set. The push text is a fixed sentence and does not include a merchant, an amount, or an agent name.

Response

[
  {"approval_id": "apr_…", "status": "pending", "action": {}}
]

404 when step-up approval is off.

POST /v1/admin/seed-demo

Inserts the public demo organizations, shopper-01, and agr_demo into the live repository. Authorization is the GAB_ADMIN_TOKEN bearer. The route stays closed unless GAB_ALLOW_DEMO_SEED=1. It does not require GAB_DEMO. A second call returns already_present true and does not insert another copy. The response omits the admin token.

Response

{
  "operator_key": "gab_demo_operator_public",
  "wallet_key": "gab_demo_wallet_public",
  "merchant_key": "gab_demo_merchant_public",
  "agent_id": "shopper-01",
  "agreement_id": "agr_demo",
  "already_present": "false"
}

401 without a bearer. 403 for a non-admin key. 403 {"error": "demo seed is disabled"} when the flag is unset.