API v1

Ontology

Semantic model, stable category codes, counterparties, and agent categorization rules.

Markdown version · llms.txt

BennyBooks uses a lightweight ontology so agents categorize by stable codes (5100) instead of ambiguous display names (Software vs Software & tools). Postgres remains the source of truth; JSON-LD / Turtle describe meaning.

Preferred agent flow

GET /categories → match description to counterparties/synonyms → POST /proposals/categorization with categoryCode + confidence + reason (+ evidence). Humans approve in Ledger → Approvals; the trail lives in Log (/log).

Public endpoints

Ontology (JSON-LD)
https://bennybooks.com/api/v1/ontology.jsonld
JSON-LD context
https://bennybooks.com/api/v1/ontology/context.jsonld

No authentication required. OpenAPI also lists get_ontology and get_ontology_context.

Core classes

ClassPurpose
TransactionMoney movement (negative amount = outflow)
CategoryChart-of-accounts slot — identify by code
CounterpartyVendor/customer with aliases (seed list today; DB planned)
ReceiptEvidence document
NoteFree-text annotation
ProposalAgent suggestion awaiting approval
Audit log entryAgent write or human review event (Log UI)
ConnectorBank/payment data source

Default chart codes

CodeNameTypeSynonyms
5100Software & toolsexpenseSoftware, SaaS, Subscriptions
5200Office & rentexpenseRent, Coworking, WeWork
5300Cloud infrastructureexpenseCloud, AWS, GCP, Azure
5000Operating expensesexpenseTravel, Contractors, Professional services
4000Revenuerevenue
4010SaaS subscriptionsrevenue

Seed counterparties

VendorDefault codeAliases
AWS5300Amazon Web Services, AMZN AWS
Figma5100FIGMA INC
Google Workspace5100Google Cloud
Stripe4000STRIPE PAYOUT
WeWork5200

Propose with categoryCode

POST /api/v1/proposals/categorization
{
  "transactionId": "550e8400-e29b-41d4-a716-446655440000",
  "categoryCode": "5300",
  "confidence": 0.91,
  "reason": "Description matches counterparty AWS",
  "evidence": [
    { "type": "counterparty_match", "value": "aws" }
  ]
}

category (name) still works for compatibility. Prefer categoryCode. The API resolves codes to the canonical chart name stored on the transaction today.

Full reference: docs/ONTOLOGY.md. Source files: ontology/bennybooks.jsonld and ontology/bennybooks.ttl.