Instance administrator
A token for the person who runs the instance, for the few settings that belong to no org.
Some settings are not an org’s to change: the limits that stop one org taking the instance (quotas), and the instance’s own health. Until now they were reachable only on the host. The instance administrator is a separate principal for them, over REST.
What it is
- A token with the prefix
tti_, a different shape from every org token (tt_), so the two are told apart before any lookup and a leaked one is recognisable. - Minted only on the host, with
turntable token create --instance --name <name> [--expires-days 30](1 to 90 days; the secret is shown once, only its hash is stored, in its own table). No org token of any role can mint, list or revoke one:token list --instanceandtoken revoke <id> --instanceare host commands too. The one operation that touches them is rotation (below). Minting, revoking and rotating are audited in the system org’s chain. - It holds no org grant. It cannot read a run, a log or a secret, and every org operation refuses it. It can call the instance operations, and nothing else.
- Accepted over REST only. The MCP endpoint and the realtime socket do not treat a
tti_token as a credential, and none of the instance operations is an MCP tool.
What it can call
| Operation | Route | Does |
|---|---|---|
instance_whoami | GET /api/v1/instance/whoami | Checks the token: its id, label and expiry. |
instance_list_orgs | GET /api/v1/instance/orgs | Lists the orgs’ slugs and names (not the internal system org). |
instance_github_app_status | GET /api/v1/instance/github-app | Reports the GitHub App: whether one is configured, its id, slug, owner login, owning org and creation time, sealed (a boolean, never the material), installation counts by status, and the ids of installations a webhook named that no org has claimed (up to 100). See Hosted. |
set_quotas | POST /api/v1/instance/quotas | Sets the named limits of one org (target_org), null removes one, and returns the limits with usage. |
bootstrap_approver | POST /api/v1/instance/approvers/bootstrap | Enrols an org’s first approver from an offline ed25519 public key, only while the org has none. Audited in both chains with the key’s fingerprint. See Hosted. |
set_project_settings | POST /api/v1/instance/project-settings | Sets one project’s sandbox_snapshot and max_concurrent (target_org, target_project; null removes one). See Providers. |
create_org | POST /api/v1/instance/orgs | Creates an empty org (slug, name); a slug in use, or the internal system org’s, is a conflict, and a slug of any other shape is refused. |
create_org_token | POST /api/v1/instance/orgs/tokens | Mints an org’s first token, or a new one after a delay (target_org, name, role up to release_operator, kind default person, expires_days 1 to 365, required). Refused as a conflict when the org has any token that is neither revoked nor expired, and, for an org that ever had a token, until the org_remint_delay_hours setting has passed since its last token was revoked or expired. The secret is in the response once. |
create_project | POST /api/v1/instance/projects | Creates an empty project in an existing org (target_org, slug, name); a slug already used there is a conflict. See Hosted. |
move_repo_binding | POST /api/v1/instance/repo-bindings/move | Moves a repo’s binding to a project of another org (owner, repo, to_org, to_project, optional forge_repo_id) in one transaction, keeping its installation. Refused, with one message that names no other org, when the target project is not in the target org, when the binding’s installation is not mapped to the target org, or when forge_repo_id differs from the binding’s. Run history and queued or running attempts stay with the old project and finish there. The response lists the poll entries of the running config that still name the old project. Audited in the system chain and in both orgs’ chains. See Moving a polled repo to another org. |
rotate_instance_token | POST /api/v1/instance/tokens/rotate | Mints a new instance token (the secret is in the response once) and revokes the one that made the call. Also turntable token rotate <id> --instance. See Bootstrapping with no shell. |
instance_doctor | GET /api/v1/instance/doctor | The readiness report: pass, warn or fail per check, with fixed sentences only. Read-only, audited as a read in the system chain. |
instance_ingest_status | GET /api/v1/instance/ingest-status | Poll health of every org’s repos, with no org token: org and project slug, repo, configured poll interval, last poll time, last successful poll time and outcome, an error class (rate_limited, auth, not_found, github_4xx, github_5xx, network, stale_binding or unknown, never the raw error text), consecutive failures, next poll time, auth mode (anonymous, token or installation) and that mode’s last rate-limit budget (limit, remaining, reset). Read-only, audited as a read in the system chain. The view is the poller in the server process that answers: it is empty when polling is off or runs in another process. instance_doctor has a matching poll_health check. |
instance_audit_verify | POST /api/v1/instance/audit-verify | Checks orgs’ audit chains against exported anchor bodies (v2 {version: 2, org_id, sequence, head_hash, time, key_id, signature}, checked under the named key only; a keyless version: 1 body is accepted only at or before the org’s v2 cutover; 1 to 1000 per call) and returns, per org, ok, rolled_back (the chain ends behind a signed anchor) or mismatch (a hash or signature disagrees, the chain is broken, or the org is unknown), each with a fixed sentence and a reasons list for a refused anchor. Read-only, audited as a read in the system chain. See Audit integrity. |
db_backup | POST /api/v1/instance/db-backup | Backs up the SQLite database into <data-dir>/backups/ and returns the path, size and sha256. See Backups. |
max_concurrent can only lower an org’s concurrency below the instance’s per-org cap (--org-cap): a value above it is refused, and removing it falls back to the cap. Instance operations take no org or project field. A change is audited twice: in the system org’s chain (who held the token) and in the target org’s own chain (so its operators see who changed their limits).
instance_doctor returns the checks of turntable doctor (see Doctor) as names and states only: each check’s id, area, status, a fixed summary and a fixed fix. Raw error text and secret values are never in it, so a hosted instance with no shell can confirm a master-key rotation from it.
instance_audit_verify takes no key from the caller: it checks each anchor’s signature under the org’s audit key in the secret store, so a server with no master key answers as unavailable. Anchors kept off the server are the point: export them with the audit export sink and keep them elsewhere. REST only, never an MCP tool, and no org token can call it.
Adding a tenant on a hosted instance
With no shell, a second org needs no redeploy:
create_orgwith the new org’sslugandname. The org starts with no projects and no tokens.create_org_tokenfor that slug, with the role the tenant’s first operator needs (at mostrelease_operator) and an expiry. Hand the secret over once: it is not stored and cannot be read again.kinddefaults toperson, the operator’s own token, which may approve underuntrusted_run_approval = no_agents.create_projectfor each repo the org will ingest.
create_org_token is a one-shot, like the env bootstrap: it works only while the org has no active token (not revoked, not expired, project-scoped ones included), so it can never add access to an org that already has some. For an org that ever had a token, even a revoked or expired one, it is refused until the org_remint_delay_hours setting (default 24, minimum 1; TURNTABLE_ORG_REMINT_DELAY_HOURS, org_remint_delay_hours in turntable.toml, or instance_set_setting; a value in the environment or the file locks it) has passed since the last of its tokens was revoked or expired, and the refusal says when it becomes possible. This stops a stolen instance token from getting an org’s tokens revoked and minting itself a new one at once. A brand-new org with no token ever is served at once. Each re-mint emits an org.token_reminted event to the org, and revoking the last active token of an org emits org.tokens_exhausted; both are on the org’s feed and reach its webhooks, and a re-mint is audited in the system org’s chain and in the org’s own. A token that merely expires does not emit an event, because nothing runs at that moment; the org’s token list shows it as expired. After that the org’s own admins manage its tokens. The system org is never a target of either operation. Both are audited in the system org’s chain and in the new org’s own, and no audit entry holds the secret or its hash. Neither is an MCP tool.
Bootstrapping with no shell
A distroless image has no shell, so token create --instance cannot run on it. Set the sha256 of a token instead. The token never leaves your machine.
# 1. On your own machine: the token goes to stdout, its hash to stderr.
turntable token generate --instance > instance-token.txt
# Without the binary: t="tti_$(openssl rand -base64 32 | tr '+/' '-_' | tr -d '=\n')"; printf %s "$t" | sha256sum
# 2. On the server, set ONLY the hash. Never the token.
TURNTABLE_INSTANCE_BOOTSTRAP_TOKEN_SHA256=<the hash>
# 3. After the first boot, call the rotation once with the token, keep the new secret, and unset the variable.
curl -fsS -X POST -H "Authorization: Bearer $(cat instance-token.txt)" "$URL/api/v1/instance/tokens/rotate"- Only when there is no active token. On boot the hash is registered only if the instance has no active instance token, meaning one that is neither expired nor revoked. Otherwise it is ignored, with one log line:
instance bootstrap hash ignored: an instance token exists. An expired or revoked token does not block, so a lapsed token never locks you out. - A hash registers once, ever. A hash that was registered before is refused whether that token is active, expired or revoked, with a distinct log line:
instance bootstrap hash refused: that hash was already registered once. It is never renewed. To recover after a token lapses, generate a new token offline and set its new hash. - Idempotent. The same hash on every boot is the same row, never a duplicate.
- Short-lived. The token expires in 30 days at most.
TURNTABLE_INSTANCE_BOOTSTRAP_EXPIRY_DAYS(1 to 30) can lower that and never raise it. It is audited asinstance_bootstrap_token_registeredin the system org’s chain, without the hash. - Never logged. Neither the hash nor a token appears in any log line. A malformed hash stops the boot with a message that does not repeat the value. The old name
LONGSHORE_INSTANCE_BOOTSTRAP_TOKEN_SHA256still works, with a deprecation warning. - Rotate, then remove the variable. Rotation is an instance operation over REST and the CLI, never on MCP: instance tokens are not MCP credentials. It mints a new token (secret shown once, hash stored) and revokes the caller’s token, in one transaction. After that the variable does nothing, so remove it.
Instance tokens are always the operator’s: they hold no org role and can’t approve runs, so there is no kind field.
Backups
The image is distroless, so there is no shell to copy the database with. db_backup (or turntable db backup [--keep <n>] [--data-dir ./data] on the host) writes a consistent copy of the SQLite database with VACUUM INTO to a new file, <data-dir>/backups/turntable-<time>-<version>.db, and returns its path, size and sha256. Writes in flight do not matter: the copy holds every committed row and none of the uncommitted ones, and it is integrity-checked before it is kept.
- Where it writes: always a new file under
<data-dir>/backups/. The operation takes no path. A backups directory that is a link, or resolves outside the data dir, is refused. - Retention: the newest
keepfiles stay (--keep, thekeepinput, or thebackup_keepsetting:TURNTABLE_BACKUP_KEEP,[backup] keepinturntable.toml, orinstance_set_setting, default 10; see Settings registry); olderturntable-*.dbfiles there are deleted. Other files are left alone. - Space: refused when the free space is below twice the database size (the file plus its write-ahead log).
- The event loop keeps serving: the copy runs on a worker thread whose code is embedded in the binary, so heartbeats, log streaming and API calls carry on while a large database is copied. It still reads and writes disk, so expect some I/O load.
- Before a migration: set
TURNTABLE_BACKUP_BEFORE_MIGRATE=1and the server takes a backup at boot, only when migrations are pending on an existing database and before they run (the file name ends in-pre-migrate). If the backup fails, the server does not start. It is off by default. - Postgres: refused, with a pointer to
pg_dump. Use your platform’s snapshots orpg_dump. - Access and audit: instance administrator only (a
tti_token over REST, or the host CLI), never an MCP tool. Each backup is audited in the system org’s chain. - Restore: stop the server, replace
turntable.dbwith the backup file (and delete the oldturntable.db-walandturntable.db-shm), start it. There is no live restore.
In the web UI
The web UI has an instance-administrator area at /-/instance. It is a separate sign-in, not part of an org session.
- Its own sign-in. Paste a
tti_token on the “Instance administrator” screen. The token is checked withinstance_whoami, kept in this tab only (its ownsessionStoragekey, never a URL orlocalStorage) and used for instance routes only. It is never sent to an org route, to/mcpor to the realtime socket, and the org token is never sent to an instance route. An org session does not open the area, and the area needs no org session. - Every action is an instance operation. Nothing is decided in the browser. A refusal (a locked setting, a value above the per-org cap, a conflicting slug) is shown word for word as the server wrote it.
- Settings. Generated from
instance_list_settings, as the org and project pages are fromlist_settings: effective value, a source badge (env,toml,ui/db,default), the lock text for a value set by the environment orturntable.toml, and a reset to default. A save isinstance_set_setting. - Orgs and quotas. The org list is
instance_list_orgs. Leave a limit blank to keep it, typenoneto remove it, or give a number; the form isset_quotasand shows the limits it returns. - Projects.
create_project, and a project’s sandbox snapshot and concurrency cap throughset_project_settings. There is no instance-wide project list operation, so the project slug is typed (projects made in the session are suggested). - Backups. Runs
db_backupand shows the path, size and sha256 it returns. The file stays on the host: the page never offers a download. - Token. Rotation runs
rotate_instance_tokenafter a confirmation. The new secret is shown once, with a copy button, and the page warns that the old token is revoked, so this session must sign in with the new one. The secret is held in memory only, never stored, and is gone when the screen is left.
What stops an org reaching it
An instance operation takes the instance administrator and no one else: an org token of any role, a project-scoped token and a person (a member of any role) all get forbidden, whatever org they name. The reverse holds too: the instance token gets forbidden on every org operation. The tenant isolation suite checks both for every principal it builds.