Skip to main content

API Routes

Routes live in sable-agents-demo/web/api. This page is the original flat index; the API Reference section covers chat, approvals, prompt control, inbound email, portfolio, documents, availability/calendar, admin/environment/costs, and feedback in family-by-family depth, including routes not listed in the table below.

RouteMethodsPurposeAuth
/api/configGETPublic browser configPublic; returns public Supabase URL/anon only
/api/spineGETScoped spine payloadSupabase JWT in live mode
/api/chatPOSTAsk SABLE scoped Q&ASupabase JWT in live mode; legacy token only in demo mode
/api/searchPOSTScoped knowledge search over chunksSupabase JWT
/api/docGETSigned document URLSupabase JWT
/api/doc-upload-sessionPOSTAllocate document row and signed upload tokenSupabase JWT
/api/document-inventoryGETAdmin indexed-doc and contract-extraction inventorySupabase JWT; admin/lead
/api/inboxGETPending approval cardsSupabase JWT in live mode
/api/approvalsGET, POSTApproval list/mutate/executeSupabase JWT; writes admin/lead
/api/sable-promptPOSTLead-only prompt read, stage, promote, history, and rollback bridgeSupabase JWT; admin/lead
/api/outcomeGETOutcome estimateSupabase if configured
/api/estimate-casesPOSTPersist an outcome estimate caseSupabase JWT; admin/lead
/api/updates/draftPOSTCreate a weekly/client update approval draftSupabase JWT; admin/lead
/api/deliverable-draftsPOSTGenerate an evidence-backed deliverable draft + approvalSupabase JWT; admin/lead
/api/client-portalGET/POSTCurated client portal payload, request intake, audited access prepSupabase JWT
/api/whoamiGETCurrent viewerSupabase JWT
/api/boardGETLegacy CMA board HTMLDemo-only; disabled in production mode
/api/ingestPOSTLegacy transcript-drop CMA runDemo-only; disabled in production mode
/api/statusGETLegacy CMA session statusDemo-only; disabled in production mode
/api/fathom-webhookPOSTLegacy CMA-memory webhookDemo-only shared secret
/api/ingest-docPOSTExtract, chunk, embed, and index an uploaded documentSupabase JWT

In SABLE_MODE=production, routes with no Supabase configuration fail closed instead of serving bundled demo JSON or CMA memory-store data.

Approval Route Actions

{ "action": "approve", "id": "approval-uuid" }
{ "action": "approve_and_execute", "id": "approval-uuid" }
{ "action": "reject", "id": "approval-uuid", "reason": "not needed" }
{ "action": "edit", "id": "approval-uuid", "payload": { "text": "Edited" } }
{ "action": "batch_approve", "ids": ["approval-uuid"] }
{ "action": "execute", "id": "approval-uuid" }

Only asana_task_create approvals execute external writes today. weekly_update, scope_change, sow_draft, client_readout, and deliverable_release mutate only SABLE-owned portal tables. prompt_update folds approved learned rules into the live agent prompt. email_draft, scope_flag, and sow_estimate remain approval/audit records until their delivery paths are implemented.

Prompt Control Route Actions

{ "action": "get_prompt" }
{ "action": "stage_prompt", "base": "candidate base prompt" }
{ "action": "set_base_prompt", "base": "approved base prompt" }
{ "action": "prompt_versions" }
{ "action": "rollback_prompt", "version_row_id": "version-row-uuid" }

POST /api/deliverable-drafts accepts optional authoring_profile_id or profile_key. When present, the route applies the profile's section requirements, source collection policy, standing facts, client-facing language rubric, canonical target, and revision-history rules. Canonical export details are returned and stored as metadata; the route still queues approval only and does not overwrite external files.

Outcome Response Shape

{
"query": "hubspot migration",
"no_data": false,
"typical_hours": 150,
"range_hours": [100, 200],
"duration_weeks": [8, 12],
"category": "crm_migration",
"budget_variance_hours": { "average": 5, "range": [-10, 20] },
"financials": {
"average_margin_percent": 46,
"average_revenue": 21500,
"average_cost": 11700
},
"confidence": "Medium",
"comparables": [],
"scope_signals": {
"completed_after_hours": [],
"recent_burn_hours": 12.5
},
"assumptions": []
}