Skip to content

API reference

All endpoints are served under https://esb.guru. Responses are JSON. Paths with :id (or :carrierId, :key) are parameterized. Every mutating call (POST / PUT / PATCH / DELETE) under /api/* is recorded in the audit log; pass an optional x-actor header to attribute it.

Most routes run in the data Durable Object (the shared Hono app). A handful — search, ai-brief, and admin/* — are handled by the front-door Worker because they touch Vectorize, R2, or run before the Access gate.

Metrics & snapshot

MethodPathPurpose
GET/api/metricsDashboard rollups — open/our/carrier/overdue counts, open RCV, avg rounds.
GET/api/snapshotFull live read-model in one call (details for every estimate).
GET/healthzLiveness check (public — no Access gate).

Estimates

MethodPathPurpose
GET/api/estimatesList estimates (the worklist), each with carrier, aging, open-follow-up count.
POST/api/estimatesCreate an estimate (estimateNo, carrierId, insuredName required).
GET/api/estimates/:idFetch one estimate — header, carrier, revisions, line items, follow-ups, events, aging.
POST/api/estimates/:id/submitSubmit / resubmit to the carrier (ball → carrier).
POST/api/estimates/:id/revisionLog a carrier revision (note required) — parses + fires rules (ball → us).
POST/api/estimates/:id/approveMark approved / settled (ball → done).
POST/api/estimates/:id/line-itemsAdd a line item (code, description, rcv, itemStatus, roundIntroduced).
POST/api/estimates/:id/followupsAdd a follow-up (title, kind, owner, dueAt, note).

Follow-ups

MethodPathPurpose
GET/api/followupsList all follow-ups (the estimator queue) with estimate + carrier context.
POST/api/followups/:id/completeComplete a follow-up.

Emails & correspondence

MethodPathPurpose
GET/api/emailsList ingested emails (optional ?status=).
GET/api/emails/:idFetch one email.
GET/api/estimates/:id/emailsCorrespondence attached to an estimate.
POST/api/emails/:id/attachAttach an email to an estimate (estimateId or estimateNo).
POST/api/emails/:id/ignoreMark an email ignored (triage).

Carriers & estimators

MethodPathPurpose
GET/api/carriersList carriers with rollup stats (open / total).
POST · PATCH · DELETE/api/carriers · /api/carriers/:idCreate / update / delete a carrier.
GET/api/carriers/:carrierId/rulesRules for a carrier.
POST · PATCH · DELETE/api/carrier-rules · /api/carrier-rules/:idCreate / update / delete a rule.
POST/api/carriers/:carrierId/rules/previewDry-run a rule set against a sample context.
GET · POST/api/estimators · /api/estimators/:idList / get / create estimators.
PATCH · DELETE/api/estimators/:idUpdate / delete an estimator.
MethodPathPurpose
GET/api/ai/configCurrent model + prompts, defaults, and env overrides.
POST/api/ai/parse-revisionParse an auditor note (note) → reason codes + disputed items.
POST/api/ai/next-best-action/:idCompute a brief for an estimate.
GET/api/ai-brief/:idRead the persisted next-best-action brief (from R2).
POST/api/ai-brief/:idRecompute + persist the brief (to R2).
GET · POST/api/searchSemantic search (?q= or body { q }) — Workers AI + Vectorize, KV-cached.

See AI for how these are used.

Configuration

All configuration lives in-app with a matching API. See Configuration.

MethodPathPurpose
GET/api/settings · PUT /api/settings/:keyApp settings (incl. aiConfig, outboundWebhookUrl, statusMap).
GET · POST · PATCH · DELETE/api/app-registrations · /:idEntra / Graph app registrations.
POST/api/app-registrations/:id/validateValidate a registration’s credentials.
GET · POST · PATCH · DELETE/api/email-accounts · /:idMailboxes.
GET · POST · PATCH · DELETE/api/domains · /:idSender domains.
GET · POST · PATCH · DELETE/api/subject-rules · /:idSubject-line routing rules.
GET · POST · PATCH · DELETE/api/filters · /:idIngestion / saved filters (?scope=).
GET · POST/api/sla-policiesSLA timers (global + per-carrier).
GET · POST/api/phasesPhase multipliers.

Audit

MethodPathPurpose
GET/api/auditAppend-only trail of every mutation + admin clear/load (?limit=, newest first).

See Audit log for the schema and how entries are produced.

Webhooks

MethodPathPurpose
GET/api/webhooks/statusDiscovery — live schema + status map (no auth).
POST/api/webhooks/statusPush a status in (requires x-webhook-token).
POST/api/webhooks/testEcho test for connection setup.
GET/api/webhooks/xactanalysisDiscovery — XactAnalysis event schema (no auth).
POST/api/webhooks/xactanalysisXactAnalysis lifecycle sync — assignment · revision · submitted · approved · settled · status.

See Webhooks & integrations for auth, payloads, and the status map.

Admin (data loading)

Guarded by Authorization: Bearer <REVSRC_SECRET_KEY> and handled at the Worker edge, before the Access gate. CLI / automation only — there is no admin UI.

MethodPathPurpose
POST/api/admin/clearEmpty every table in the Durable Object (FK-safe order).
POST/api/admin/loadClear, then bulk-load a dataset in FK order. Returns per-table counts.
POST/api/admin/seedReseed the built-in demo generator (dev convenience).
POST/api/admin/reindexRe-embed every estimate into Vectorize. Returns { indexed }.

See Data loading for the workflow.