API Reference

This page lists the live routes most app code and ops scripts use. It is not exhaustive, but it reflects the current route folders under src/app/api.

Auth And Beta

MethodEndpointAuthNotes
GET/POST/api/auth/[...nextauth]NoNextAuth Google OAuth entry point.
POST/api/beta/inviteNoAccepts an invite code and enables beta access.
POST/api/beta/grantYesAdmin-only beta enablement for one or more emails.

Core Content

MethodEndpointAuthNotes
GET/POST/api/constitutionsYesList or create constitutions.
GET/PATCH/DELETE/api/constitutions/[id]YesFetch, update, or delete one constitution.
POST/api/clausesYesCreate a clause.
PATCH/api/clauses/[id]YesUpdate a clause.
GET/api/clauses/[id]/historyYesFetch clause history and linked chat sessions.
POST/api/chatYesStreaming AI chat for drafting.
GET/POST/api/chat-sessionsYesList or create chat sessions.
GET/PATCH/api/chat-sessions/[id]YesRead or update one session.
POST/api/chat-sessions/[id]/clausesYesLink a clause to a session.

Deployments And Stream

MethodEndpointAuthNotes
POST/api/deploymentsYesCreate a DigitalOcean deployment.
GET/api/deploymentsYesList deployments for one constitution.
GET/DELETE/api/deployments/[id]YesPoll deployment status and progress, or destroy it.
GET/api/deployments/[id]/launchYesRedirect to Guacamole or direct IP launch.
GET/api/deployments/previewYesPreview the DNS blocklist export.
GET/api/stream/connectToken-basedGateway handoff for browser stream launch.
GET/api/cron/reap-expired-deploymentsCron secret or headerReaps expired deployments.

Collaboration

MethodEndpointAuthNotes
GET/api/groupsNoList groups.
POST/api/groupsYesCreate a group.
GET/api/groups/[id]NoFetch one group and its nested data.
POST/api/groups/[id]/joinYesJoin a group by invite code.
POST/api/proposalsYesCreate a proposal.
GET/PATCH/api/proposals/[id]YesRead or update a proposal.
POST/api/proposals/[id]/voteYesCast or update a vote.
POST/api/proposals/[id]/commentYesAdd a proposal comment.

Supporting Routes

MethodEndpointNotes
GET/api/templatesTemplate catalog.
POST/api/templates/forkFork a template into a new constitution.
POST/api/researchResearch synthesis for a clause.
GET/POST/api/versionsVersion history surface.
GET/POST/api/versions/[id]Fetch one version or trigger a rollback action.
POST/api/internal/test-stream-runsCreate a secret-protected internal stream test run.
GET/DELETE/api/internal/test-stream-runs/[id]Poll internal test run status or destroy the run.
POST/api/internal/test-stream-runs/[id]/launch-urlMint a fresh short-lived launch URL.
POST/api/internal/test-harness/sessionMint a short-lived internal session token.