Files
paperclip-docs/docs/reference/api/instance-admin.md
T
d627632874 Release docs for paperclip v2026.1106.0 (#172)
Docs for parent release `v2026.1106.0` (`d69631b0`), up from
`v2026.1023.0` (`1b4c8038`): 515 parent commits.

## How this branch was built

The tag is 914 commits behind what `nightly` has drafted, so this branch
isn't cut from `nightly` HEAD. It starts at nightly commit `1952052`
(parent `043f2514`), 19 commits before the tag, then adds:

- the `main` hotfix (#160)
- the sync tooling from `nightly`
- docs for those 19 commits

Later nightly drafts stay on `nightly`, so no pages had to be removed.
No `nightly-draft/*` PRs are open.

## What changed

- **Runner by default:** new Claude, Codex, OpenCode and Pi agents start
on Paperclip Runner on supported hosts, with **Legacy runner** and
**Upgrade runner**.
- **Workspaces:** cleanup of finished workspaces, optional Git
expiration, and restore points for unsaved work. Restore points are off
by default.
- **New pages:** Prompt injection prevention, Google Workspace, GitHub
Copilot, Speko, Braintrust, Daytona, Ditto and Unikraft.
- **Breaking and upgrade notes:** the run history limit, Sentry run
failures off by default and the DSN variables, the Docker start command
for custom images, `--yes` on `instructions-file:delete`, and slower
migrations on large instances.
- **Also covered:** project repositories as skill sources, roster bulk
edit, Artifacts V1 (experimental, off by default), composer dismissal,
`expectedStatusVersion`, `unexecuted_review_stage`, and plugin workspace
providers.
- **Changelog:** a v2026.1106.0 entry in `reference/changelog.md`.

## Older text corrected

These were wrong at the tag, and most are also wrong on the live site:

- which permissions let an agent read a peer's configuration or change
instructions (`api/agents.md`)
- `decideNowCount`, which doesn't exist; the field is `deskBadgeCount`
- `file-resources` routes, which are board-only
- the **Create project** dialog fields, a CEO rule the code doesn't
enforce, and where a terminated agent's reports appear
- `instructions-file:put` and `:delete` examples that always failed
(`cli/agent.md`)
- a curl example that returned `422` (`api/cases.md`)
- Google Workspace **Reconnect** instructions, which claimed it reopens
the service picker
- the `permissionKey` table, which listed 8 of 21 keys
- drafting text at the end of `api/agents.md`

## ⚠ Please check these

- **Product behaviour that may be a parent bug.** The docs now describe
the tag's code, which you may prefer to fix upstream:
- The project **Environment** dropdown saves a choice, but runs ignore
it (`experimental/environments.md`).
- `environments:manage` is granted by roles but no environment route
checks it.
- `suggest-changes` is documented as agent-only, because only agents
have a consent path. Company skill policy decides skill edits.
- **Reader-visible mismatches in the parent UI.** The docs follow the
code. Upstream copy still mentions a "Built-in agents tab", says Copilot
"awaits qualification", and tells people to "Reconnect Google Workspace
to change access".

## ⚠ Post-tag leaks removed

Nothing to remove from an already-drafted page: post-tag surfaces such
as 1Password, Vercel, Supabase deploy, custom gateway onboarding and
Artifacts V1 as default never came onto this branch. Authors left out
post-tag hunks of the next nightly draft, and the reasons are in the run
notes.

## ⚠ Drift

None. Zero findings at the tag, from a full parent snapshot.

## ⚠ Verification Failures

The tag-accuracy gate reports one leak and nine review entries. None is
a real failure:

- **Leak:** `reference/cli/service.md`, `paperclipai payload and`. This
is a false positive; it's prose from a real message at
`cli/src/commands/service.ts:184`.
- **Review, 8 new connector pages:** the gate can't confirm new pages.
Reviewers confirmed each surface exists at the tag.
- **Review, `local_tools`:** an example value from the tag's Runner
README.

Not provable from code, and kept deliberately:

- `sandbox-providers.md` uses `sandbox.yaml`. The tag's README says
`install.yaml`, which returned 404 when checked. The upstream fix is
post-tag.
- The Google Workspace row about older OAuth brokers rests on release
notes and a design doc. The broker isn't in this repo.
- External claims about provider behaviour (for example Braintrust,
Daytona, Unikraft and Google scopes).

## ↻ Renames detected

None. The rename helper wasn't run: the 19-commit delta adds no new
adapter, skill, or plugin directories that it would check.

## Verification

All checks read a checkout pinned to the tag.

- **First round:** authors, a release-notes audit, an audit of
corrections stranded on `nightly`, an audit of 321 lines the last
realign dropped from `main` (about 130 checked directly in code), and
six fresh verifiers.
- **Second round:** seven new verifiers re-checked every changed area,
tracing behaviour rather than matching labels, and fixed about 50 more
defects. That volume means more may remain.
- **Limits of that second round:**
- Each verifier reported what it only string-matched. That includes
parts of Artifacts V1, the **Upgrade runner** notice, Copilot run
behaviour, and some Plugin SDK contract text.
  - The second-round fixes themselves weren't reviewed by a third round.
- **Gates:** `docs:build`, `docs:test` and `sync:check` pass.
- **Nothing was run against a live instance.** All of this comes from
reading code.

## Screenshots

**196 of 278 screenshots are stale and none were recaptured.** The list
is in `SCREENSHOTS_PENDING.md`. Some visibly differ from the text, such
as the removed **Run with provider trace** button and the old roster
tabs.

## After merge

1. Keep the PR title as is: `tag-docs-release.yml` reads the version
from it.
2. Confirm the `docs/v2026.1106.0` tag exists.
3. Run `node scripts/sync/realign-nightly.mjs release/v2026.1106.0
--push`, then audit for dropped lines and duplicated paragraphs, and set
`nightly` state back to `branch_mode: nightly`.
4. Check that `docs.paperclip.ing` serves the release: a new page, a new
claim, and the changelog's top entry.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: DevRel Gemini <[email protected]>
Co-authored-by: Paperclip <[email protected]>
Co-authored-by: Dotta <[email protected]>
Co-authored-by: ClaudeCoder <[email protected]>
2026-11-07 13:02:42 +01:00

12 KiB
Raw Blame History


paperclip_version: v2026.1106.0 seo_title: Instance Admin API seo_description: Instance-scoped endpoints that fit nowhere else: general and experimental settings, on-demand database backups, and the LLM reflection endpoint.

Instance Admin API

A grab-bag of instance-scoped REST endpoints that don't fit neatly into the other API pages: general and experimental instance settings, on-demand database backups, the LLM reflection endpoints, environments (sandbox/runtime drivers), and execution-workspace lifecycle.

These surfaces are stable enough to call from your own tooling, but they are intentionally narrow — most operators reach them through the UI, the CLI, or via the paperclipai doctor command rather than by hand.

All routes are mounted under /api. Most require instance-admin or board authentication; per-route notes call out exceptions.


Instance settings

Endpoint Purpose
GET /api/instance/settings Read the full instance-settings record (general and experimental blocks together, plus the instance default environment). Readable by any authenticated org member.
PATCH /api/instance/settings Update the settings record. Body is validated against patchInstanceSettingsSchema. Setting defaultEnvironmentId picks the instance default execution environment.
GET /api/instance/settings/general Read general instance settings (display name, defaults, etc.).
PATCH /api/instance/settings/general Update general settings. Body is validated against patchInstanceGeneralSettingsSchema.
GET /api/instance/settings/experimental Read the experimental-features block.
PATCH /api/instance/settings/experimental Toggle experimental features. Body is validated against patchInstanceExperimentalSettingsSchema.

The two GET routes only need authenticated org access; every PATCH requires instance-admin (a local_implicit board session in local trusted mode also passes). On a cloud-managed instance the platform pins executionMode in general settings, so an attempt to change it returns 403 with code execution_mode_platform_managed; settings the hosting operator has hidden are likewise floored with code settings_operator_managed, though a same-value write always passes.

General settings no longer have a keyboardShortcuts field. Keyboard shortcuts are always on for every signed-in user, so there's no instance switch and no personal preference to read or change. The general-settings patch body is strict: sending keyboardShortcuts now fails with 400. The per-user preferences endpoints that briefly held a personal shortcuts switch have been removed too.

The experimental-settings response and patch body include enableBuiltInAgents as a boolean. Set it to true before using the Built-in Agents API; while it is off, those routes return 404 Not Found.


Task drain

Task drain is an instance-wide pause on picking up new work: while it is on, agents stop being handed fresh tasks so you can wind the instance down cleanly (before a restart or maintenance window, say) without cancelling what is already running.

Endpoint Purpose
GET /api/instance/task-drain Read the current drain status (whether draining, and when it started/expires). Readable by any authenticated org member.
POST /api/instance/task-drain Start (or refresh) a drain. Body is validated against startTaskDrainRequestSchema; pass an optional ttlMs to have the drain expire automatically after that many milliseconds, or omit it for a drain that stays on until you stop it. Returns the resulting drain state.
DELETE /api/instance/task-drain Stop draining. Returns { "wasActive": <boolean> } — whether a drain was in effect when you called.

Reading the status needs only authenticated org access; starting and stopping a drain require instance-admin. Overlapping start/stop calls are serialised, so the audit log and the live drain state always agree.

Idle holds

A host that wants to stop an idle instance (to save compute) can take a short, owned idle hold instead of a normal drain:

  • Start one with POST /api/instance/task-drain and a body of { "purpose": "idle", "ttlMs": <5000–300000> }. Idle holds must expire on their own within five minutes. The response includes an ownerId. If any other drain is already active, the request fails with 409 Conflict.
  • Ask whether it's safe to sleep with GET /api/instance/task-drain?idleSleepSafety=1&ownerId=<ownerId>. Alongside the usual drain status you get an idleSleepSafety object whose backgroundWork is none, present, or unknown. Only none means accepted requests, scheduled work, cleanup, plugin workers, and saved work have all settled while the same hold stayed in place. This read needs instance-admin.
  • Release it with DELETE /api/instance/task-drain?ownerId=<ownerId>. A release with the wrong owner fails with 409 Conflict.

If you set PAPERCLIP_DB_BACKUP_IDLE_CHECKPOINT_ENABLED=1 (see Environment Variables), the safety check also takes and verifies a fresh database backup before it reports none. On cloud-managed instances, only the Paperclip Cloud control plane can run that backup-checkpoint check.


Liveness probe

GET  /api/liveness
HEAD /api/liveness

A lightweight, anonymous check that the server process is up. It doesn't resolve a session or touch the database, so frequent monitoring won't keep an idle database awake, and it still answers during an idle hold. It returns 200 with { "status": "ok", "commit": "<sha or null>" } once startup recovery has finished, and 503 with "status": "starting" until then. Responses are never cached.

Use /api/liveness for routine "is it running?" probes. Keep /api/health for real readiness checks: it's the one that tests the database and reports bootstrap state.


Cloud lifecycle

These two routes exist for instances managed by Paperclip Cloud, so the Cloud control plane can keep its view of your organization's archive state in step with the instance. On a self-hosted instance both return 404 with { "error": "not_cloud_managed" }. Both require instance-admin.

Endpoint Purpose
GET /api/instance/lifecycle Report the Cloud-pinned primary company's state: primaryCompanyId, primaryCompanyStatus ("missing" if that company no longer exists), and otherUnarchivedCompanyCount.
POST /api/instance/lifecycle/unarchive-primary Bring an archived primary company back to active — what happens when you resume an organization from Paperclip Cloud. Returns { "status": ..., "changed": true }, or changed: false if the company wasn't archived. Returns 404 with primary_company_not_found if the company is gone.

Database backups

POST /api/instance/database-backups

Trigger a manual database backup. Returns a structured result that includes the backup directory, retention policy, and timing. Scheduled backups follow the same code path but are not exposed as a separate route.

Instance-admin only.


Claim first instance admin

POST /api/bootstrap/claim

On a brand-new private instance that requires login, this lets the first person to sign in promote themselves to instance_admin — no manual database seeding. The first caller to claim wins; everyone after them is locked out.

Availability. This route only exists when the instance runs with deploymentMode set to authenticated and deploymentExposure set to private. On any other configuration it returns 404 with Browser first-admin claim is not available.

Cloud-managed instances. If your instance is managed by a Paperclip control plane rather than run by you, you never meet this claim screen at all — the instance comes up ready to use. The control plane owns identity there, and the users it signs in are deliberately never given the instance_admin role, so GET /api/health skips the first-admin check entirely and always reports bootstrapStatus: "ready". Self-hosted instances are unaffected: if you run the server yourself, the claim flow behaves exactly as described here.

Authentication. The caller must be a signed-in browser session (a board actor whose session source is the browser). Other callers — agents, CLI tokens, unauthenticated requests — get 401 with Sign in from a browser session before claiming first admin.

Behaviour. If no instance_admin exists yet, the signed-in user is promoted to instance_admin. The claim is atomic — the table is locked so exactly one user can win. If the instance has already been claimed, the route returns 409 with Someone else has already claimed this instance.

The request takes no body. On success the response is:

{ "claimed": true, "userId": "<the promoted user's id>" }

LLM agent-configuration reflection

These endpoints exist so agents can introspect what server-side adapters and icons are available to them.

Endpoint Purpose
GET /api/llms/agent-configuration.txt Plain-text dump of available agent adapters and their declared shape.
GET /api/llms/agent-configuration/:adapterType.txt Same, scoped to one adapter type.
GET /api/llms/agent-icons.txt List of supported agent-icon names (AGENT_ICON_NAMES).

Access is limited to board callers and agents whose permissions include canCreateAgents — the routes return 403 otherwise.


Environments

Environments are the plugin-managed execution backends declared by environment-driver plugins (custom sandboxes, runners, etc.).

Endpoint Purpose
GET /api/companies/:companyId/environments List configured environments for the company.
GET /api/companies/:companyId/environments/capabilities List the capabilities reported by available environment drivers.
POST /api/companies/:companyId/environments Create an environment. Body validated against createEnvironmentSchema.
POST /api/companies/:companyId/environments/probe-config Probe a candidate environment config without persisting. Body validated against probeEnvironmentConfigSchema.
GET /api/environments/:id Read one environment.
PATCH /api/environments/:id Update an environment. Body validated against updateEnvironmentSchema.
DELETE /api/environments/:id Delete an environment.
POST /api/environments/:id/probe Probe an existing environment (driver health check).
GET /api/environments/:id/leases List active leases on the environment.
GET /api/environment-leases/:leaseId Read a single lease.

Execution workspaces

Execution workspaces are the materialised working directories Paperclip creates for an issue run.

Endpoint Purpose
GET /api/companies/:companyId/execution-workspaces List execution workspaces for the company.
GET /api/execution-workspaces/:id Read one workspace.
GET /api/execution-workspaces/:id/close-readiness Whether the workspace is safe to close (no pending operations, no dirty state).
GET /api/execution-workspaces/:id/workspace-operations List the operations recorded against the workspace.
PATCH /api/execution-workspaces/:id Update a workspace. Body validated against updateExecutionWorkspaceSchema.
POST /api/execution-workspaces/:id/runtime-services/:action Run a runtime-service control action against the workspace.
POST /api/execution-workspaces/:id/runtime-commands/:action Run a runtime-command control action against the workspace. Both routes share the workspaceRuntimeControlTargetSchema body and the same handler.