Skip to Content
turbo-12f
Reference

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.

Reference

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.

Auth

Cookie + CSRF

HTTP-only t12_session (30d) plus X-CSRF-Token verified in constant time.

Access

Origin, Roles & Teams

sameOrigin checks every POST. Operator, team role, and the Editor, Acceptor, Run flags guard each scope.

Streams

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: every POST, public or not, needs an Origin that names this app (403 otherwise). The GitHub callback is a GET, so it is exempt.
  • signedIn: needs a valid t12_session (401). On a POST it also needs X-CSRF-Token, which is SHA256("csrf:" + session)[:32] (403).
  • operator: needs the Operator flag (403 on POST, 404 on GET).
  • Team guards: team owner means a team Owner or an Operator. teamOnly refuses the client role with 403 ("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: POST handlers read form values with r.PostFormValue(...).
  • Multipart: /api/conversations, /api/c/{id}/answer, and /api/p/{project}/board/issues also accept multipart/form-data with up to 5 images of 5 MiB each (field images or image).
  • Aliases: /api/requests and /api/r/{id}/* are aliases of /api/conversations and /api/c/{id}/*.

Account, sign-in, and people

Method and pathGuardParameters and behavior
GET /api/sessionPublicSigned in: email, operator, csrf, needsOnboarding, handle, avatar, and can (what the person may start). Signed out: signUp, github, mail, bootstrap, tailscaleAutoSignIn.
POST /api/signinsameOriginForm email. Mails or logs a 15-minute sign-in link; always answers {"sent": true}.
POST /api/signin/passwordsameOriginForm email, password. At most 10 failures per email and 30 per IP in 15m (429). Sets t12_session.
POST /api/signin/tailscalesameOriginNeeds loopback Tailscale-User-Login with TrustTailscale on and a linked account (403 otherwise).
GET /api/signin/githubPublicStarts 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/callbackPublicChecks 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/linksameOriginForm t, optional email (bootstrap) and password. Redeems a one-time token and sets the session.
POST /api/signupsameOriginForm 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/signoutsignedInRevokes the session, clears t12_session, and sets t12_ts_out=1 when Tailscale trust is on.
POST /api/account/passwordsignedInForm current (when one is set), password. Sets or changes the caller's password; rate-limited like sign-in.
POST /api/account/tailscalesignedInLinks the active loopback Tailscale-User-Login to the caller; unlink=1 clears it.
POST /api/account/github/disconnectsignedInUnlinks 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 pathGuardParameters and behavior
GET /api/connectionssignedInReturns the caller's connections (kind, connected, label, provides, expiresAt, reconnect, licence), githubSignIn, sealing, and shared.
POST /api/connections/{kind}signedInagy: 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}/removesignedInDisconnects a kind, or with form part only one credential. Takes effect on the next run.
POST /api/connections/{kind}/testsignedInChecks the connection with its provider without running anything; returns results. 409 when not connected.
GET /api/github/repossignedInQuery 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/ownerssignedIn{login, orgs}: where the caller may create a repository.
GET /api/github/issuessignedInQuery 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 pathGuardParameters and behavior
GET /api/homesignedInReturns 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/statesignedInForm action (read, unread, remove, read-all, clear-all), id or ids. Persists per-user notification state.
GET /api/projectssignedInReturns the sorted project names the caller can see: {"seen": [...]}.
POST /api/projectssignedInForm 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 pathGuardParameters and behavior
POST /api/teamssignedInForm name, optional slug, description. The caller becomes Owner.
GET /api/t/{team}signedIn + team member or operatorMembers, projects, availableProjects, teamRoles, contributors, spend, and (for admins) waiting requests. 404 otherwise.
POST /api/t/{team}team ownerForm name, description. Renames the team.
POST /api/t/{team}/deleteteam ownerDeletes the team and its waiting requests.
POST /api/t/{team}/members/inviteteam ownerForm email or @handle, role (owner, member, viewer, client; default member). Operators may add password or tailscale.
POST /api/t/{team}/members/roleteam ownerForm email, role.
POST /api/t/{team}/members/removeteam ownerForm email.
POST /api/t/{team}/invites/revoketeam ownerForm email.
POST /api/t/{team}/projectsteam owner, and project Editor or OperatorForm project, action (add default, or remove). Moves a project into or out of the team.
POST /api/t/{team}/iconteam ownerSame form as /api/account/avatar, for the team's icon.
GET /api/t/{team}/activitysignedIn + team member or operatorQuery year. The team's heat map over projects the caller may see; no feed.

Conversation endpoints

Method and pathGuardParameters and behavior
POST /api/conversationssignedInForm 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 + requestOfQuery view=detailed. Returns the progress rollup, bound, building, preview, plus repository, source, sources, maxIssues.
GET /api/c/{id}/overviewsignedIn + requestOfSteps, lanes, spend, roles, models, open findings, bugbash, release, decisions, quality, outcomes, authorship, warnings, advisorySlop.
GET /api/c/{id}/graphsignedIn + requestOfQuery view=detailed. Flow graph JSON: lastSeq, active, pre, lanes, post.
GET /api/c/{id}/streamsignedIn + requestOfQuery view=detailed. SSE event: graph, 500ms ticks, 15s keepalives, viewer access rechecked each tick.
GET /api/c/{id}/timelinesignedIn + requestOfAgent spans and human waits for the Gantt chart. 503 without a metrics database.
GET /api/c/{id}/settingssignedIn + requestOfOpener, repo, testers, preview, and canBuild, canPreview, canInviteTesters.
GET /api/c/{id}/conversationsignedIn + requestOfMessages, questions, mustHaves, mockUI, plan, start gate, canDecide, plain draft, releaseActions, activity.
GET /api/c/{id}/decisionssignedIn + requestOfQuery view=detailed lists all decisions, not only DecidedForYou.
GET /api/c/{id}/questionssignedIn + requestOfThe conversation's open and answered questions.
GET /api/c/{id}/reportsignedIn + requestOfQuery view=detailed. Plain or detailed conversation report.
GET /api/c/{id}/acceptancesignedIn + requestOfAcceptance scenarios mapped to tests and source files.
GET /api/c/{id}/tracesignedIn + requestOfQuery lane, view=detailed (omits step details when unset).
GET /api/c/{id}/qualitysignedIn + operator + requestOfCatch rate, escaped bugs, and blocking questions (404 for non-Operators).
GET /api/c/{id}/evidence/{name}signedIn + requestOfServes a .png, .webp, .jpg or .jpeg evidence file.
GET /api/c/{id}/images/{name}signedIn + requestOfServes a validated intake attachment (png, webp, jpeg, gif) with nosniff.
GET /api/c/{id}/mock-ui/framesignedIn + requestOfQuery screen, device, design. The Mock UI as a sandboxed HTML document with its own CSP.

Project and board endpoints

Method and pathGuardParameters and behavior
GET /api/p/{project}signedIn + project visibleRollup: requests (a row may carry waitPaused), inbox, approvals, preview, release, spend, models, teamRoles, contributors, catchRate, level, role, canStart, canManageAccess.
POST /api/p/{project}/releasesignedIn + project visibleForm verb (signoff, hold, merge), optional request, why. Acts on the named or primary staged conversation; needs Acceptor there.
GET /api/p/{project}/deploymentssignedIn + project visiblePromotion history, the live one, preview, and releases. Open to clients.
GET /api/p/{project}/cisignedIn + teamOnlyGate candidates and recent GitHub Actions workflows runs.
GET /api/p/{project}/logssignedIn + teamOnlyQuery conversation, kind, limit (default 50, max 200), offset. Event log rows across the project's conversations.
GET /api/p/{project}/metricssignedIn + teamOnlyQuery range (7d, 30d, 90d). Project analytics. 503 without a metrics database.
GET /api/p/{project}/usagesignedIn + teamOnlyQuery days (1 to 365, default 30), view=detailed. The scorecard figures for this project's conversations.
GET /api/p/{project}/storagesignedIn + teamOnlyDisk use of evidence, records, checkouts, worktrees, previews, artifacts, and caches; canClean.
POST /api/p/{project}/storage/cleanupsignedIn + teamOnly + Operator or EditorForm target=caches only. 409 while the factory works on the project.
GET /api/p/{project}/envsignedIn + teamOnlyVariable names, environments, and who saved them. Values are never sent back.
POST /api/p/{project}/envsignedIn + teamOnly + Operator or EditorForm name, value, environments (comma list). Saves a sealed variable.
POST /api/p/{project}/env/deletesignedIn + teamOnly + Operator or EditorForm 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 pathGuardParameters and behavior
POST /api/webhooks/githubHMAC X-Hub-Signature-256Uses 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.

PathAuthTarget component or redirect
/signin, /linkPublicSignInPage (?github=<code> shows the GitHub outcome) and LinkPage (?t= and ?b=1 bootstrap).
/onboardingSigned inOnboardingPage: the person's own connections, then three optional Observer questions.
/ProtectedHomePage: the AI chat entry with PromptBar (project, agent, and the ModeMenu mode switch) and the connect-or-create project dialog.
/projectsProtectedProjectsPageView ("All projects"): what needs you, what the factory is working on, and where each project of the current team stands.
/welcome/teamProtectedTeamSetupPageView. Redirects to / once the person is on a team.
/t/:team, /t/:team/peopleProtectedTeamDetailPageView: overview with the team heat map, and the people tab with access requests.
/teams, /accessProtectedRedirect to the current team's page or its /people tab, else /welcome/team.
/u/:handleProtectedPersonPageView: bio, pinned projects, teams, activity heat map. me is the caller.
/connections, /observerProtectedConnectionsPageView and ObserverPageView (?tab=profile).
/profile, /settingsProtectedProfilePageView and UserSettingsPageView (?tab=observer redirects to /observer?tab=profile).
/usage, /scorecardProtectedScorecardPageView (?days=7|30|90, ?view=detailed).
*ProtectedNotFound.

Next steps

On this page