Skip to content

API reference

The Papercup org backend is a Hono module mounted at /api/org. ~50 endpoints, all file-backed (no DB).

EndpointPurpose
GET /charterRead the current charter markdown
PUT /charterReplace the charter (≥100 chars; emits audit entry)
EndpointPurpose
GET /departmentsAll 5 with live counts, autoLoop status, scheduler info, active run
GET /:deptSingle dept with recent inbox/outbox previews
GET /:dept/inbox / outboxMaterialized view contents
GET /:dept/notes / PUT /:dept/notesDirector notes (markdown)
GET /:dept/decisionsDecision log markdown
GET /:dept/director-config / PUT /:dept/director-configAuto-loop config (persisted)
EndpointPurpose
GET /messages?from=&to=&projectId=&kind=&status=&q=Filtered list
POST /messagesSend (charter-validated; auto-defaults projectId)
GET /messages/:idDetail with referenced and responses
PATCH /messages/:id/statusSingle status transition
POST /messages/bulk-statusUpdate many at once
GET /messages/:id/comments / POSTOperator notes on a message
EndpointPurpose
GET /projects?vertical=Filtered list
POST /projectsCreate (auto-emits ProjectKickoff broadcast)
GET /projects/:slugDetail with recent activity
PATCH /projects/:slugUpdate fields
DELETE /projects/:slugHard delete (rejects reserved; relinks messages → org-ops)
GET /projects/:slug/timelineMessages where projectId matches
GET /projects/:slug/capabilitiesFiltered to kind=Capability
GET /projects/:slug/spinoutsFiltered to kind=ProjectSpinout
GET /projects/:slug/campaignsFiltered to kind=Campaign
EndpointPurpose
GET /directives?status=Filtered list
POST /directivesCreate + auto-emit Directive message to Business
GET /directives/:idDetail with summaries + linked messages
PATCH /directives/:idUpdate fields
DELETE /directives/:idSoft-cancel (status=‘cancelled’)
GET /directives/:id/summaries / POSTCEO or user summary log
GET /directives/:id/timelineMessages where directiveId matches
POST /directives/:id/projectsSpin up another project (1:N)
POST /directives/:id/routeBack-compat: creates first project
EndpointPurpose
GET /:dept/prompt?role=&mode=&context=1Resolved prompt with optional live state
POST /:dept/run-directorOne-shot orchestrator decision (no execution)
POST /:dept/run-loopFull autonomous loop (orchestrator → worker → execute)
GET /:dept/run-director-streamSSE-streamed run output
POST /:dept/stop-loopCancel active run
GET /:dept/director-runs / /:dept/director-runs/:filenamePast run records
GET /:dept/director-statsPer-dept KPI rollup
GET /active-runsAll in-flight runs across departments
GET /schedulersServer-side timers with secondsRemaining
GET /all-director-statsCross-org KPI aggregation
EndpointPurpose
GET /search?q=Universal — messages + directives + projects
EndpointPurpose
GET /audit?subject=&action=&limit=Audit log for charter/config/admin changes
EndpointPurpose
POST /admin/rebuild-viewsRebuild materialized inbox/outbox files
POST /admin/stop-allEmergency stop — cancel runs + clear schedulers + persist autoLoop=false
POST /admin/archive-acknowledged?olderThanMs=Sweep acknowledged messages older than N ms (default 30d)

Some message kinds trigger automatic state mutations (no separate API call needed):

  • Capability (from technology) — increments capabilitiesAvailable on every active non-reserved project
  • CapabilityDeprecation (from technology) — decrements counter; appends to deprecatedCapabilities[]
  • BudgetAllocation (with projectId + metadata.amount_cents) — accumulates into budget_cents
  • ProgressUpdate (from management, with metadata.statusUpdate) — advances project status

Charter validation always runs server-side, so a worker that emits something illegal fails the loop iteration rather than corrupting state.