UI HTTP API and SPA routes
Complete t12-ui HTTP, SSE flow graph, team, connection, board, metrics, and Observer endpoint reference, the GitHub webhook of the cloud function, plus the React SPA routes.
t12-ui serves the HTTP JSON API and the embedded React SPA (internal/ui/server.go, internal/ui/web/src/app.tsx). The Vercel function (api/index.go, pkg/cloudapi) serves the same API plus one webhook. Unmatched GET /api/* paths return JSON 404; every other GET path serves a static asset or index.html.
Cookie + CSRF
HTTP-only t12_session (30d) plus X-CSRF-Token verified in constant time.
Origin, Roles & Teams
sameOrigin checks every POST. Operator, team role, and the Editor, Acceptor, Run flags guard each scope.
JSON + Live SSE
Form or multipart/form-data (26 MiB cap) mutations plus 500ms graph SSE.
Request guards and response headers
Every response sets Content-Security-Policy, X-Content-Type-Options: nosniff, X-Frame-Options: DENY, Referrer-Policy: same-origin, and Cache-Control: no-store. Files under assets/ use max-age=31536000, immutable; other static files use max-age=300.
How the guard names in the tables work
sameOrigin: everyPOST, public or not, needs anOriginthat names this app (403otherwise). The GitHub callback is aGET, so it is exempt.signedIn: needs a validt12_session(401). On aPOSTit also needsX-CSRF-Token, which isSHA256("csrf:" + session)[:32](403).operator: needs the Operator flag (403onPOST,404onGET).- Team guards:
team ownermeans a team Owner or an Operator.teamOnlyrefuses theclientrole with403("This page is for the team running the project"). - Project guards: an unknown project, or one the caller cannot see, answers
404.
Conversation guards: requestOf, Editor, Acceptor, Run
requestOf checks the id against ^r-[0-9]{8}-[0-9]{6}-[0-9a-f]{4}$ and then access (404 when hidden). In a project, an Operator, a team Owner or Member, or a project Editor grant is Editor, Acceptor, and Run. A client is only Acceptor, and only on a conversation they opened; a viewer has none. A draft with no project gives all three to its opener (and to an Operator when no person opened it).
Bodies and aliases
- Forms:
POSThandlers read form values withr.PostFormValue(...). - Multipart:
/api/conversations,/api/c/{id}/answer, and/api/p/{project}/board/issuesalso acceptmultipart/form-datawith up to5images of5 MiBeach (fieldimagesorimage). - Aliases:
/api/requestsand/api/r/{id}/*are aliases of/api/conversationsand/api/c/{id}/*.
Account, sign-in, and people
| Method and path | Guard | Parameters and behavior |
|---|---|---|
GET /api/session | Public | Signed in: email, operator, csrf, needsOnboarding, handle, avatar, and can (what the person may start). Signed out: signUp, github, mail, bootstrap, tailscaleAutoSignIn. |
POST /api/signin | sameOrigin | Form email. Mails or logs a 15-minute sign-in link; always answers {"sent": true}. |
POST /api/signin/password | sameOrigin | Form email, password. At most 10 failures per email and 30 per IP in 15m (429). Sets t12_session. |
POST /api/signin/tailscale | sameOrigin | Needs loopback Tailscale-User-Login with TrustTailscale on and a linked account (403 otherwise). |
GET /api/signin/github | Public | Starts GitHub sign-in or sign-up and redirects to GitHub. intent=link needs a session and ties GitHub to it; return=connections lands back on /connections. |
GET /api/signin/github/callback | Public | Checks the state cookie, exchanges the code, and signs in or links. Redirects to /, /settings?tab=security, /connections, or /signin with ?github=<code> on a problem. |
POST /api/link | sameOrigin | Form t, optional email (bootstrap) and password. Redeems a one-time token and sets the session. |
POST /api/signup | sameOrigin | Form email, optional password. Signs in at once on loopback or Tailscale; with SMTP mails a confirm link and answers {"verify": true}, the same for existing addresses. Otherwise 400. |
POST /api/signout | signedIn | Revokes the session, clears t12_session, and sets t12_ts_out=1 when Tailscale trust is on. |
POST /api/account/password | signedIn | Form current (when one is set), password. Sets or changes the caller's password; rate-limited like sign-in. |
POST /api/account/tailscale | signedIn | Links the active loopback Tailscale-User-Login to the caller; unlink=1 clears it. |
POST /api/account/github/disconnect | signedIn | Unlinks the caller's GitHub sign-in. 409 when it is their only way to sign in. |
Connections, GitHub, and the agent
Kinds are github, agy, and omp. Credentials are sealed with T12_PROJECT_ENV_KEY and never read back to a browser.
| Method and path | Guard | Parameters and behavior |
|---|---|---|
GET /api/connections | signedIn | Returns the caller's connections (kind, connected, label, provides, expiresAt, reconnect, licence), githubSignIn, sealing, and shared. |
POST /api/connections/{kind} | signedIn | agy: apiKey or tokenFile/token (plus optional scope, gcpProject, gcpLocation); replaces what it held. omp: anthropicKey, openaiKey, authJson; adds to it. github is 400: it comes from sign-in. |
POST /api/connections/{kind}/remove | signedIn | Disconnects a kind, or with form part only one credential. Takes effect on the next run. |
POST /api/connections/{kind}/test | signedIn | Checks the connection with its provider without running anything; returns results. 409 when not connected. |
GET /api/github/repos | signedIn | Query q, limit. Repos the caller's own GitHub sees, tagged with connectedProject. 409 without a GitHub connection; authenticated: false when GitHub rejects the token. |
GET /api/github/owners | signedIn | {login, orgs}: where the caller may create a repository. |
GET /api/github/issues | signedIn | Query repo (required), state (open, closed, all), q, limit. A connected project needs access to it (403); other repos use the caller's GitHub. |
Cloud mode
In the Vercel function every POST /api/setup/* except /test answers 400: credentials live in Vercel variables and GitHub Actions secrets. The GET /api/c/{id}/stream SSE sends one graph event and closes.
Paused conversations (waitPaused)
A conversation that waits on a person (an unanswered question, a part that needs an OK, a sign-off) with no new event for longer than its project's budgets.wait_hours (default 24 hours, -1 never) is paused. It is derived on every read, nothing is written, and any new event ends it. GET /api/home, GET /api/p/{project}, the conversation pages, and board card run objects then carry waitPaused: true and a now line ("No answer in 1 day, so the factory stopped."); it leaves the inbox and mail unless a job runs or a person paused or stopped it. Pages stop polling it.
Workspace, observer, and metrics
| Method and path | Guard | Parameters and behavior |
|---|---|---|
GET /api/home | signedIn | Returns requests (a row may carry waitPaused), projects, projectRepos, projectTeams, projectMaxIssues, maxIssues, seen, teams, projectStats, inbox, notifications, testing, and archived projects and requests. |
POST /api/notifications/state | signedIn | Form action (read, unread, remove, read-all, clear-all), id or ids. Persists per-user notification state. |
GET /api/projects | signedIn | Returns the sorted project names the caller can see: {"seen": [...]}. |
POST /api/projects | signedIn | Form repo (connect a GitHub repo) or name and type (new starter repo), optional team the caller owns or belongs to (403). 409 without their own GitHub. |
Teams and operator access
| Method and path | Guard | Parameters and behavior |
|---|---|---|
POST /api/teams | signedIn | Form name, optional slug, description. The caller becomes Owner. |
GET /api/t/{team} | signedIn + team member or operator | Members, projects, availableProjects, teamRoles, contributors, spend, and (for admins) waiting requests. 404 otherwise. |
POST /api/t/{team} | team owner | Form name, description. Renames the team. |
POST /api/t/{team}/delete | team owner | Deletes the team and its waiting requests. |
POST /api/t/{team}/members/invite | team owner | Form email or @handle, role (owner, member, viewer, client; default member). Operators may add password or tailscale. |
POST /api/t/{team}/members/role | team owner | Form email, role. |
POST /api/t/{team}/members/remove | team owner | Form email. |
POST /api/t/{team}/invites/revoke | team owner | Form email. |
POST /api/t/{team}/projects | team owner, and project Editor or Operator | Form project, action (add default, or remove). Moves a project into or out of the team. |
POST /api/t/{team}/icon | team owner | Same form as /api/account/avatar, for the team's icon. |
GET /api/t/{team}/activity | signedIn + team member or operator | Query year. The team's heat map over projects the caller may see; no feed. |
Conversation endpoints
| Method and path | Guard | Parameters and behavior |
|---|---|---|
POST /api/conversations | signedIn | Form project or repo, text, repeatable issue, up to 5 images; Operators may set harness, model, thinking. Needs a connected AI (409) and Editor or client role. Returns {id}. |
GET /api/c/{id} | signedIn + requestOf | Query view=detailed. Returns the progress rollup, bound, building, preview, plus repository, source, sources, maxIssues. |
GET /api/c/{id}/overview | signedIn + requestOf | Steps, lanes, spend, roles, models, open findings, bugbash, release, decisions, quality, outcomes, authorship, warnings, advisorySlop. |
GET /api/c/{id}/graph | signedIn + requestOf | Query view=detailed. Flow graph JSON: lastSeq, active, pre, lanes, post. |
GET /api/c/{id}/stream | signedIn + requestOf | Query view=detailed. SSE event: graph, 500ms ticks, 15s keepalives, viewer access rechecked each tick. |
GET /api/c/{id}/timeline | signedIn + requestOf | Agent spans and human waits for the Gantt chart. 503 without a metrics database. |
GET /api/c/{id}/settings | signedIn + requestOf | Opener, repo, testers, preview, and canBuild, canPreview, canInviteTesters. |
GET /api/c/{id}/conversation | signedIn + requestOf | Messages, questions, mustHaves, mockUI, plan, start gate, canDecide, plain draft, releaseActions, activity. |
GET /api/c/{id}/decisions | signedIn + requestOf | Query view=detailed lists all decisions, not only DecidedForYou. |
GET /api/c/{id}/questions | signedIn + requestOf | The conversation's open and answered questions. |
GET /api/c/{id}/report | signedIn + requestOf | Query view=detailed. Plain or detailed conversation report. |
GET /api/c/{id}/acceptance | signedIn + requestOf | Acceptance scenarios mapped to tests and source files. |
GET /api/c/{id}/trace | signedIn + requestOf | Query lane, view=detailed (omits step details when unset). |
GET /api/c/{id}/quality | signedIn + operator + requestOf | Catch rate, escaped bugs, and blocking questions (404 for non-Operators). |
GET /api/c/{id}/evidence/{name} | signedIn + requestOf | Serves a .png, .webp, .jpg or .jpeg evidence file. |
GET /api/c/{id}/images/{name} | signedIn + requestOf | Serves a validated intake attachment (png, webp, jpeg, gif) with nosniff. |
GET /api/c/{id}/mock-ui/frame | signedIn + requestOf | Query screen, device, design. The Mock UI as a sandboxed HTML document with its own CSP. |
Project and board endpoints
| Method and path | Guard | Parameters and behavior |
|---|---|---|
GET /api/p/{project} | signedIn + project visible | Rollup: requests (a row may carry waitPaused), inbox, approvals, preview, release, spend, models, teamRoles, contributors, catchRate, level, role, canStart, canManageAccess. |
POST /api/p/{project}/release | signedIn + project visible | Form verb (signoff, hold, merge), optional request, why. Acts on the named or primary staged conversation; needs Acceptor there. |
GET /api/p/{project}/deployments | signedIn + project visible | Promotion history, the live one, preview, and releases. Open to clients. |
GET /api/p/{project}/ci | signedIn + teamOnly | Gate candidates and recent GitHub Actions workflows runs. |
GET /api/p/{project}/logs | signedIn + teamOnly | Query conversation, kind, limit (default 50, max 200), offset. Event log rows across the project's conversations. |
GET /api/p/{project}/metrics | signedIn + teamOnly | Query range (7d, 30d, 90d). Project analytics. 503 without a metrics database. |
GET /api/p/{project}/usage | signedIn + teamOnly | Query days (1 to 365, default 30), view=detailed. The scorecard figures for this project's conversations. |
GET /api/p/{project}/storage | signedIn + teamOnly | Disk use of evidence, records, checkouts, worktrees, previews, artifacts, and caches; canClean. |
POST /api/p/{project}/storage/cleanup | signedIn + teamOnly + Operator or Editor | Form target=caches only. 409 while the factory works on the project. |
GET /api/p/{project}/env | signedIn + teamOnly | Variable names, environments, and who saved them. Values are never sent back. |
POST /api/p/{project}/env | signedIn + teamOnly + Operator or Editor | Form name, value, environments (comma list). Saves a sealed variable. |
POST /api/p/{project}/env/delete | signedIn + teamOnly + Operator or Editor | Form name. 404 when absent. |
Cloud function webhook
api/index.go forwards every request to pkg/cloudapi. Vercel rewrites /api/:path* to /api/index?__path=:path*; the function restores the path, then serves one extra route besides internal/ui's.
| Method and path | Guard | Parameters and behavior |
|---|---|---|
POST /api/webhooks/github | HMAC X-Hub-Signature-256 | Uses GITHUB_WEBHOOK_SECRET (503 unset, 401 bad signature, 405 other methods, 2 MiB cap). Runs before the operator bootstrap and the cookie checks. |
Handled events are ping, the board events (issues, issue_comment, pull_request, pull_request_review, pull_request_review_comment, check_suite, check_run), and a human issue_comment on a need-decision issue, which resumes the waiting lane. Anything else answers 200 with ignored.
React SPA routes
Routes live in internal/ui/web/src/app.tsx. /signin, /link, and /onboarding sit outside the signed-in shell; every other path is protected. A signed-out visitor goes to /signin, and a person who still needsOnboarding goes to /onboarding.
| Path | Auth | Target component or redirect |
|---|---|---|
/signin, /link | Public | SignInPage (?github=<code> shows the GitHub outcome) and LinkPage (?t= and ?b=1 bootstrap). |
/onboarding | Signed in | OnboardingPage: the person's own connections, then three optional Observer questions. |
/ | Protected | HomePage: the AI chat entry with PromptBar (project, agent, and the ModeMenu mode switch) and the connect-or-create project dialog. |
/projects | Protected | ProjectsPageView ("All projects"): what needs you, what the factory is working on, and where each project of the current team stands. |
/welcome/team | Protected | TeamSetupPageView. Redirects to / once the person is on a team. |
/t/:team, /t/:team/people | Protected | TeamDetailPageView: overview with the team heat map, and the people tab with access requests. |
/teams, /access | Protected | Redirect to the current team's page or its /people tab, else /welcome/team. |
/u/:handle | Protected | PersonPageView: bio, pinned projects, teams, activity heat map. me is the caller. |
/connections, /observer | Protected | ConnectionsPageView and ObserverPageView (?tab=profile). |
/profile, /settings | Protected | ProfilePageView and UserSettingsPageView (?tab=observer redirects to /observer?tab=profile). |
/usage, /scorecard | Protected | ScorecardPageView (?days=7|30|90, ?view=detailed). |
* | Protected | NotFound. |
Next steps
Catalogues and templates
Embedded project catalogues, the must-have and default schema contracts, and the web-react starter stack.
Glossary and truth boundaries
Authoritative v2 domain vocabulary with avoided synonyms and explicit system truth boundaries, including people, teams, connections, and the database as source of truth.