- The server owns the clock and the provenance.
produced_at,producerandrun_idare attached server-side. A payload carrying any of them is refused; a producer cannot claim to be fresher than it is. - Freshness is computed on read, never stored. There is no column holding
freshorstale, so nothing can be written into one. - Identity comes from the token. Whichever of the four write doors a push arrives through, the caller’s identity is resolved from its credential, never from the body.
internal/api/pages_*.go, internal/pages for the schemas and
validation.
Endpoints
A page may carry a custom application;
its source, build, review and publication routes are the
custom application contract at the end of
this page:
Routes are workspace-unscoped; the workspace comes from the session context or
the
workspace_id query parameter, the same shape saved views and routines use.
Unreachable pages are not found
When a management endpoint on a page — update, delete, push, grants, access, versions, rollback, export, project sources, public links or webhook tokens — refuses a request, it answers 404 if the caller cannot reach the page. Successful actions by authorized producers are unaffected. The403 rows in
the status tables below apply only to a caller
who reaches the page — as its owner or a member of its owning crew, a workspace
ADMIN/OWNER, a member of a crew that owns a panel on it, through the sharing of
the folder it is in, or by a grant; the reach vocabulary under
List pages — and lacks the standing the endpoint needs. A 403
therefore always says “this page exists and you may open it, but not do this”;
a 404 never says which of “does not exist” and “not yours to see” it is, so
no management endpoint can be walked to learn which pages exist. The same rule
covers a wrong panel id on the push path: page “x” has no panel “y” is
answered only to a caller who reaches the page.
The concealment is decided after the endpoint’s own gate has refused, so it
never gates a successful action: a declared producer or an agent whose
authority is crew-bound pushes or writes sources without holding any human
read path to the page. An agent working through its page_project tool
(the internal path, not these routes) is refused with 404 whenever its
crew-bound gate fails, since no human viewer stands behind it.
List pages
workspace_id (required when the caller’s context does
not supply one).
Response 200 — an array of page summaries:
can_move and can_remove_from_folder are caller-specific booleans on every
index row. Moving requires page ownership (including membership of its owning
crew) or workspace ADMIN/OWNER. Removing also accepts a live folder can edit
share. A move still requires the destination folder to accept the caller.
These flags describe authority; mutation endpoints recheck it and the version
fences.
panel_count counts every panel including sealed ones, because the grid
draws a placeholder for those and a count that skipped them would disagree with
what the reader sees. last_produced_at is the newest arrival across visible
panels — deliberately not updated_at, which is when the spec last changed:
a page edited an hour ago whose data last arrived a week ago must not read as
“updated today”.
icon and color are the page’s own avatar — a crew icon name and a crew
palette key, the same vocabulary a folder uses — and they
are always present, "" for none. They are presentation, stored on the page
row and not in the spec: a rollback does not restore an
older one and an export bundle does not carry it. The
freshness state is a separate fact and stays beside the avatar everywhere it
is drawn.
reach says how you, the caller, reach the page, in a fixed order:
It is never empty and never omitted, because a page is in the list only when
you reach it somehow. It describes you and nobody else: a page reached only
through
grant is one “shared with you”, and the other subjects on a page are
the ACL, which List grants returns behind its own gate. A
panel_crew entry names a crew whose panel you can already read; it discloses
nothing a sealed placeholder does not carry.
Statuses:
Create a page
page.create
capability. A MEMBER holding that capability passes; the workspace role alone
is not the answer.
Request body — the parsed spec. The CLI parses the YAML and sends JSON;
the server never parses YAML:
owner is user/<id> or crew/<slug> — exactly one of the two. span is a
column count on a 12-column grid; there is no height field, a panel is as
tall as its content.
icon and color are optional: the page’s avatar, a crew icon name and a crew
palette key (blue, emerald, violet, amber, rose, cyan, lime,
fuchsia). A value outside either set is refused with a 400 that names the
set; the page is not created.
A panel may also carry refresh — "on:wake" or "on:panels-changed", and
nothing else. It is the event that runs that panel’s producer, not a
rendering hint, so it requires producer: "routine/<slug>": the server cannot
execute a script/, call a webhook/ producer, or dispatch an agent/. It
compiles to an automations row with action_kind: routine. "on:wake" is
additionally refused on a page that declares no wake gate — it could never
fire — and on a panel that declares its own gate, which is a loop. Every one of
those is a 400 naming the rule; see the
Pages guide.
Response 201 — the created page, in the same shape GET /api/v1/pages/{slug} returns.
Statuses:
Get a page
slug — the page’s slug.
Response 200 — the page, its panels in spec order, and each panel’s current
data:
has_project is true
when the page has application source at all, published or not. has_application
is true only while a publication is actually running. A page awaiting its first
publication has has_project: true and has_application: false; that is the
case the publication review exists for, so a
client deciding whether to offer the review reads has_project. A withdrawn
application leaves has_project true and has_application false as well.
Neither field is omitted when false.
A panel owned by a crew the caller does not belong to arrives as a sealed
placeholder: it keeps its id, schema and span so the page has the same shape
for everyone, and carries no data and no provenance. This is decided server-side
— nothing is hidden in the client.
An editor additionally receives the authored half of each panel — its
declared actions, wake gates, on_failure and refresh — because that is
what an edit form has to round-trip. A reader does not, and an absent authored
half is absent, not an empty array.
Statuses:
Update a page
panels requires visibility of every panel in both the current and
submitted definition; otherwise the server returns a neutral 403. Metadata-only
edits remain available under write authority and return sealed placeholders for
unreadable panels. A concurrent live definition change returns 409 instead of
being overwritten.
Authentication: session cookie or CLI token. The page owner, a workspace
ADMIN/OWNER, or the holder of a write grant.
Request body: the same shape as create. Panels are
reconciled against the submitted list — a panel absent from it is removed, and
its payload history goes with it.
Every field is optional and an omitted one is left alone, so {"icon": "chart"} changes the icon and nothing else. icon and color follow the
pointer rule exactly: omitted keeps, "" clears, a name outside the crew icon
registry or the crew palette is a 400 that stores nothing. A request that
leaves the document as it was — an avatar-only change, or an empty body —
records no version and does not move updated_at, which is the spec’s
modification time; the optimistic lock (409) still applies.
Response 200: the updated page.
Statuses:
Delete a page
Push panel data
page.write verb, through the sidecar from inside a container, or through a
webhook.
Authentication: session cookie or CLI token. Authority is the producer’s,
not a workspace role: the caller must be the panel’s declared producer, or
hold a produce grant covering it.
Request body: the payload itself, with no envelope. It must satisfy the
panel’s declared schema (metric.v1, status.v1, table.v1, series.v1,
narrative.v1) and is capped at 64 KiB.
state — the producer’s own verdict, ok (the default)
or failed. Any other value is a 400, fresh and stale included: those
two are the server’s arithmetic, and accepting them here would let a producer
declare itself fresh.
Response 200:
push:<panel>:<seq> in place of a run id.
Statuses:
List grants
slug. Query parameters: workspace_id when the caller’s context supplies none. No request body.
Authentication: session cookie or CLI token. The page owner or a workspace
ADMIN/OWNER.
Response 200:
can_delegate_agent_edit says whether the caller may grant an agent write:
only the page’s owner (the owning user, or a member of the owning crew) may. A
client hides that choice when it is false.
live is not stored. A grant is only as wide as the human who issued it: if
that human loses access to the crew the grant names, the grant reports live: false with an inert_reason saying so, and stops working at the same moment.
That is the only thing that makes a row inert — every level, read included,
decides something while its issuer still stands behind it.
Statuses:
Issue a grant
write may rebuild a page’s layout freely and
still cannot widen who reaches it, not even to another agent in its own crew.
Request body:
What each level decides
read is what the other levels are built on: a principal who may rewrite a page
has to be able to open it, so every level reaches the page and the levels differ
only in what they add.
A grant widens reach to the page, never to a crew’s data: granting a crew
produce on a panel does not give the grantee anything else that crew owns.
Concretely, a read grant makes a page appear in GET /api/v1/pages and open at GET /api/v1/pages/{slug} for a subject who would otherwise get a
404 — and changes nothing else. Every panel on it stays sealed unless the
grantee’s own crew membership already opened it, so a grantee can be shown a
page of nothing but sealed placeholders. That is the grant working, not
failing: they were given the board, not the numbers on it.
Without any grant a page is reached by its owner, by a workspace ADMIN/OWNER,
and by members of the crews that own its panels.
Only the owner delegates Edit to an agent
write or produce to an agent subject, and produce to a crew subject,
are issued by the page’s owner only: the owning user, or a member of the
owning crew while that crew is not deleted. produce pushes the page’s data, so
it is Edit of the data, and a crew’s agents and routines push with a crew
produce grant. A workspace ADMIN/OWNER role administers
every other grant, can grant an agent read, and can revoke any grant, but it
does not imply the right to delegate Edit to an agent. A request from anyone
else gets 403.
The rule also applies at use time. An agent write or produce grant, or a
crew produce grant, that the page’s owner did not issue is listed with live: false and an inert_reason,
and it authorises nothing: no spec edits, no pushed payloads, no document
proposals and no collaborative writes. Such a row is retired for good when it
is stored, when the page changes owner, when its issuer leaves the owning
crew, or when the owning crew is deleted, and each retirement writes a page.agent_grant.retired_not_owner audit
entry. It stays retired if its issuer comes to own the page later. Only a new
grant by the owner delegates again.
An agent cannot hold comment, and neither comment nor read lets an agent
propose a change to a document.
Statuses:
Revoke a grant
subject_type and subject, naming the subject to
revoke; subject_type=workspace needs no subject. A revoke naming nobody
answers 400 rather than reporting a success it did not perform.
Response 200: {"page": "fleet-201", "changed": 1}.
Statuses:
Return a shared artifact to private
POST /api/v1/pages/{slug}/workbook/editors with publish: true) or an HTML
artifact project (POST /api/v1/pages/{slug}/artifact/share). CLI:
crewship page unshare.
Authentication: session cookie or a CLI token with pages:write, from the
Page’s human owner. Agents, agent runs and internal credentials are refused.
Workspace OWNER and ADMIN are refused too: they keep the audited read of private
output, not the right to change its audience.
Request body: pages_version and either dry_run: true, or
confirm: true with the review_token from the matching dry run.
Confirming is one transaction:
private_audience becomes 1, folder_id
is cleared, pages_version increases, every page grant is deleted, every
public link is revoked, every live mandate (workbook, Mooring, artifact project
and document iteration) is revoked, and the edit lease and lease requests of
anyone but the owner are released (the lease keeps its generation as the
fence). Each deleted grant is also written to page_grant_retired_issuances
with reason returned_to_private, so a restored backup cannot revive it. The
canonical Page triggers advance the workspace and Page authority epochs. The
audit row artifact.returned_to_private and the journal entry of the same type
record the actor, the time and the audience change, with identifiers and counts
only. Each removed grant (page.grant_removed) and link (page.link_revoked)
gets a journal entry with identifiers only and reason: "returned_to_private":
no page name, slug, label or email, because the Page is private from that
transaction on. The receipts are re-read before commit.
Former readers get 404 on their next request. Right after the commit, the
server re-checks every live WebSocket subscription to the Page channel and ends
each one that is no longer allowed (an error frame with access revoked;
the socket and other channels stay; a failed re-check disconnects the client).
An open workbook editor session also gets session_closed. Each subject whose
access ended is then sent page.access_recheck on its user channel, directly
rather than through the bounded fan-out queue. The 30-second channel sweep
remains as the backstop. A later share starts with no grants.
Only workbooks and HTML artifact projects can be returned, because only they
can be shared again: a workbook through
POST /api/v1/pages/{slug}/workbook/editors with publish: true, an HTML
artifact project through POST /api/v1/pages/{slug}/artifact/share. Docs
documents and native Word and Sheet documents have a private audience but no
share path yet (#5617); returning one would be one-way, so it is refused with
no_reshare_path. Every 409 body carries a stable reason next to error.
Statuses:
Authorize a panel’s agent producer
agent/<slug> producer the owner did not name carries
producer_authorization: {"producer": "agent/<slug>", "can_authorize": <bool>}
on Get a page. Its reason starts with “Producer not authorized
by the owner”. can_authorize is true only for the owner. This call makes the
declared producer the owner’s own designation. It writes the audit entry
page.agent_producer.authorized, and the agent can push again. The designation
ends if the page changes owner, like any other. No body.
Response 200: {"page": "fleet-201", "panel": "sluzby", "producer": "agent/writer", "authorized": true, "changed": true}.
changed is false when the designation was already live under the page’s owner (on a crew-owned page, any member’s live designation counts, and it is not re-attributed). can_authorize is false on a private artifact.
Statuses:
Who reaches a page
slug. Query parameters: workspace_id when the
caller’s context supplies none; limit (default 100, at most 1000); cursor
from a previous page. No request body.
Authentication: session cookie or CLI token. The page owner or a workspace
ADMIN/OWNER — the same right as List grants, because this
answer contains everything the ACL does and more.
Response 200:
paths uses the same vocabulary as the list’s reach, with the grant arm
spelled out per level:
Rows are ordered users by email, then crews by slug, then agents by slug,
then the withheld row;
next_cursor is present when more follow and is
passed back as cursor.
What is withheld, and why. A page owner is not necessarily a member of
every crew that owns a panel on their page, and §7.1 rule 2 keeps such a
panel — and the crew behind it — sealed from them. This listing holds to the
same line: every path through a crew the caller cannot see is collected on
ONE anonymous row (subject_id is withheld, there is no label) and
appears on no named row. Attaching panel_crew:withheld to a named user or
crew would say which crew owns the hidden panel, one intersection at a time.
An administrator sees every crew named.
Statuses:
What a subject reaches
subject (required) — user:<email or id>,
crew:<slug> or agent:<slug>; or subject_type (user, crew, agent)
with a bare subject. workspace_id when the caller’s context supplies none;
limit and cursor as above. No request body.
Authentication: session cookie or CLI token. A workspace ADMIN/OWNER may
ask about anyone; any member may ask about themselves and nobody else.
Response 200:
next_cursor is
present when more follow.
Statuses:
Folders
A folder is a named group of pages owned by one crew, with an icon from the crew icon set and a colour from the crew palette — the same picker a crew uses. One level, a page in at most one folder; a page outside any folder is unfiled. Every folder read is filtered to the pages the caller reaches;page_count counts those, never the folder’s true size.
A folder can be shared, and what it is shared with applies to every page in
it right now. A folder’s permissions name a subject — a user, a crew, or
everyone in the workspace — as can view or can edit, and they apply
continuously to whatever is in the folder: filing a page in a shared folder
shares it, taking it out unshares it. A page’s own grants add to that and never
take from it. Can edit implies can view; the server stores both and refuses
a request that says otherwise. Can edit is page write for every page in
the folder, with no workspace-role floor — a VIEWER-role member named by it
edits those pages, subject to the same whole-document check as a page write
grant. Neither ever opens a panel owned by another
crew: a panel is sealed by its owning crew’s membership whatever the folder
says. Agents are never a folder subject; an agent reaches a page only by a
grant on that page.
An entry belongs to the folder, not to the person who set it: it stays until a
manager changes it or the folder is deleted, and set_by is audit only. This
is deliberately the opposite regime from a page grant, whose issuer’s standing
is re-checked at every use.
Every page row and page document carries folder ({slug, name, icon, color}
or null, always sent) and pages_version, which changes with every change to
the page’s folder membership. A move sends it back as a fence, together with
the folder’s acl_version, which changes with every change to the folder’s
permissions; a stale fence is refused with 409 carrying conflict
(pages_version or acl_version) and the current pair, so the client re-reads
and confirms again rather than retrying blind. The 409 carries the target’s
permissions only to a caller who may read them; everyone else gets the versions
and a sentence.
Every folder document carries shared — none, people (shared with named
people), crews (shared with named crews), people_and_crews (both) or
workspace — for readers who may not see the entries themselves. The label
never names anyone.
Who may do what:
Folder changes are journalled as
page.folder_changed; moves and removals as
page.folder_membership_changed; permission changes as
page.folder_acl_changed. Folder create, rename, delete and permission changes
broadcast page.folder.updated ({slug, folder_id}); a move or removal broadcasts the
page’s own page.updated.
List folders
workspace_id when the caller’s context supplies none. No request body.
Authentication: session cookie or CLI token.
Response 200: the folders the caller may read, by name.
Each folder carries caller-specific can_rename, can_share, can_delete and
can_accept_pages booleans. Rename and acceptance include live folder can edit
shares; share and delete require ADMIN/OWNER or a manager of the owning crew.
Deletion still requires an empty folder. The same flags appear on show, create
and update responses; they reveal no other member or hidden page count.
Create a folder
Response 201: the folder,
page_count 0.
Statuses:
Get a folder
slug. No request body.
Authentication: session cookie or CLI token. The owning crew, an admin,
anyone the folder’s permissions name, or anyone who reaches at least one page
in the folder.
Response 200: the folder, plus pages — the pages in it the caller
reaches, as index rows. page_count is their number.
Statuses:
Update a folder
name, icon, color. An empty string clears the
icon or the colour; an omitted field keeps it. The slug and the owner are fixed
at creation.
Delete a folder
File a page in a folder
Response 200:
{"page": …} — the page’s index row as the listing now
renders it, with its new folder and bumped pages_version. Filing a page
where it already is changes nothing and bumps nothing.
Statuses:
Remove a page from a folder
{"pages_version": 4} — the page’s pages_version as last
read. Required.
Response 200: {"page": …} — the page’s index row, folder now null.
A can edit holder who reached the page only through the folder gets the row
with an empty reach: the removal took their own path away.
Statuses:
File several pages in a folder
pages_version — under the same
rules as a single move, and a single refusal writes nothing and names the page.
Authentication: session cookie or CLI token. As for a single move, for
every page.
Request body:
{"pages": [...], "acl_version"} — the moved pages’ index
rows.
Statuses:
Read a folder’s permissions
shared label and
…/access/me are theirs.
Response 200:
can_read is always true. set_by is empty once the setter’s account is
gone; the entry stays. The owning crew and admins are not listed: they hold the
folder without an entry.
Statuses:
Share a folder
(folder, subject) and repeating the request is the same state.
Bumps acl_version, so a move confirmed against the previous permissions is
refused.
Authentication: session cookie or CLI token. A workspace ADMIN/OWNER, or
the owning crew’s MANAGER (or higher).
Request body:
Response 200: the permissions document
after the change, plus
entry, the row that was set.
Statuses:
Stop sharing a folder
acl_version. A user or crew is matched by the
stored id or by the reference a person types (an email, a slug), so an entry
for somebody who has since left can still be removed. The workspace subject has
no id: its path is …/acl/workspace/workspace.
Authentication: session cookie or CLI token. A workspace ADMIN/OWNER, or
the owning crew’s MANAGER (or higher). No request body.
Response 204, no body.
Statuses:
Set folder access for the owning crew’s agents
none (default), read or propose. At propose,
agents can read; on Docs they can propose changes for an editor to accept
(through the human’s explicit iteration request, re-checked on every
proposal; the run never commits). On every other kind propose is the same
as read. There is no edit level: an agent edits a page only through a grant
on that page from its owner. It applies only with the workspace feature flag
artifact_agent_access_modes on, and in a chat run the human must still read
the page as a member (docs/specs/pages.md §7.1c). The request is fenced on
acl_version, bumps it, and is journalled as
page.folder_agent_access_changed. GET …/acl reports the level as
agent_access, agent_access_available (true where the flag is on), and,
with the flag on, agent_propose_kinds: ["docs"]: the artifact kinds on which
propose gives a real proposal. The folder settings dialog offers Can
suggest only when this list names a kind it knows.
Authentication: session cookie or CLI token. A workspace ADMIN/OWNER, or
the owning crew’s MANAGER (or higher).
Response 200: {"folder": "ops-board", "agent_access": "read", "acl_version": 5}
Statuses:
My access to a page
reach
(owner, role, crew:<slug>, panel_crew:<slug>, folder:<slug>, grant),
plus the page’s folder and its shared label when it is filed. Anyone who can
open the page may ask; the answer describes them and nobody else.
Authentication: session cookie or CLI token.
Response 200:
List a panel’s actions
slug, panelId. No request body.
The buttons a panel declares, and what each one runs. The panel author declares
these in the spec; a caller cannot invent one.
Authentication: session cookie or CLI token; the caller must be able to see
the panel.
Response 200:
Dispatch an action
Idempotency-Key is honoured. The key is bound to the
resolved inputs, so retrying is safe and replaying with different inputs is
refused with 409 rather than silently dispatching a second run.
Response 202 — the run is queued, not finished:
status is SCHEDULED, or DEDUPED when an identical dispatch was already in
flight.
Statuses:
List versions
slug. Query parameters: workspace_id when the caller’s context supplies none. No request body.
The page’s structural history — which panels existed, their layout, owners
and producers. Panel data is not versioned.
Authentication: session cookie or CLI token; page edit permission — the
owner, a workspace ADMIN/OWNER, a write grantee, or a holder of can edit
on the page’s folder. A version row carries the whole
arrangement, panels sealed to a reader included, so seeing the page is not
enough.
Response 200:
retained is how many versions this build keeps.
Statuses:
Roll a page back
write grant.
Request body:
to is required — a rollback names the version to restore.
Response 200:
dimmed names those panels in the response, so the
operator who ran the rollback learns it here rather than from a blank panel
five minutes later.
Statuses:
Export a page
slug. Query parameters: workspace_id when the caller’s context supplies none. No request body.
Authentication: session cookie or CLI token; a caller with page edit
permission — the owner, a workspace ADMIN/OWNER, a write grantee, or a
holder of can edit on the page’s folder — who can also read
every panel in it.
Response 200 — a portable bundle: the spec, plus every reference it makes
to something outside itself, listed so the importer must bind them explicitly:
crewship-page-bundle/v2.
The bundle then carries project — the current draft’s source project, the
same crewship-page-source/v1 document PUT …/project accepts: source
files, lockfile and small assets (base64 entries) — and page is the
draft’s authored definition rather than the live one, with each panel’s
actions, wake, on_failure and refresh and with every public flag
cleared. Every routine a call action names joins references as
routine/<slug>, beside the crews, so the importer binds them the same way.
A draft that declares a link or custom action is not yet portable and
answers 422, as does a bundle whose encoded size exceeds the transfer cap
(the project document limit plus the spec cap plus 64 KiB). The v2 bundle
does not carry builds, publications, Git history, grants, credentials or
data; it is one revision’s source and definition, never the application’s
trusted state. An export does not need the compiler.
Statuses:
Import a page
page.create.
Request body: the bundle, the slug to create, and a binding for every
reference the bundle declares:
crew/ops into a workspace that happens to have a crew called ops would
otherwise hand a page to whoever holds that name.
A crewship-page-bundle/v2 body — format set to that and project
present — is accepted by the same endpoint and goes through the same binding:
every crew and every routine the actions name must be bound to one that
exists here, or the import is a 422 listing them. It creates an inert
draft: the page is created with its panels, the
bundle’s project is stored as source revision 1 with a Git checkpoint, and
the bundle’s authored definition (actions, wake gates, on_failure,
refresh) becomes the draft’s definition — but the live page is written
without them, nothing is built and nothing is published. Whoever imports it
builds, reviews and publishes it here, as for any candidate. A v1 body that
carries project, and a v2 body without one, are refused with 400;
public flags are never read from either. The v2 size cap is the project
document’s plus the spec cap plus 64 KiB, in place of the v1 envelope.
Response 201: the created page.
Statuses:
List public links
slug. Query parameters: workspace_id when the caller’s context supplies none. No request body.
Authentication: session cookie or CLI token. The page owner or a workspace
ADMIN/OWNER.
Response 200: the links, when each expires, whether it carries a password,
and whether it shows provenance. It cannot show the link itself — see
publish.
Statuses:
Publish a page
Response 201 — the token is returned once:
Withdraw a public link
slug, tokenId (from list public links). No request body.
Authentication: session cookie or CLI token. The page owner or a workspace
ADMIN/OWNER.
Response 200: {"id": "pgl_…", "revoked": true}, plus "already": true
when it was already revoked — revoking twice succeeds, because it is the state
that matters. Withdraws one link and leaves the others
working — several links per page is the intended shape.
Statuses:
List webhook tokens
slug. Query parameters: workspace_id when the caller’s context supplies none. No request body.
Authentication: session cookie or CLI token. The page owner or a workspace
ADMIN/OWNER.
Response 200:
token field: it is stored as a digest and cannot be re-read.
Statuses:
Mint a webhook token
page set instead — one write path,
and no credential to leak.
Authentication: session cookie. The page owner or a workspace ADMIN/OWNER.
Request body:
Revoke a webhook token
slug, webhookId (from list webhook tokens). No request body.
Authentication: session cookie or CLI token. The page owner or a workspace
ADMIN/OWNER.
Response 200: {"id": "pgwh_…", "revoked": true}, plus "already": true
when it was already revoked.
Statuses:
Fire a webhook
PUT …/data takes, judged by the same schema.
state — ok or failed, as on the main write path.
Response 200: {"accepted": true, "panel": "cron", "seq": 4413}.
Statuses:
View a public page
token — the published link’s token. No request body, no query parameters.
Authentication: the token in the URL. No account, no workspace, no session.
When the link carries a password, this answers 401 until
unlock has been called.
Response 200 — only the panels marked public, and only what a stranger may
see:
Unlock a public page
GET /api/v1/public/pages/{token} returns. There is no
separate “unlocked” acknowledgement to round-trip for, and a correct password
spends a view from the link’s cap, because it is the serving that the cap
bounds.
Statuses:
Password-work capacity is process-wide for public Pages, not a cluster-wide CPU
quota and not a limit on other authentication endpoints. The automatic global
limit uses
max(1, min(4, GOMAXPROCS / 2)), with one check per link. An existing
one-time background authentication hash warmup can overlap; a request holds its
slot through any lazy dummy-hash lookup and synchronous comparison, including
when its context is cancelled. The slot is released before serving the page.
Set auth.public_page_passwords in YAML or the corresponding
CREWSHIP_PUBLIC_PAGE_PASSWORD_* environment variables and restart to override.
For an anonymous CLI request, put the JSON password body in an owner-only file
or explicit stdin, then use the existing API command:
Related
- Pages guide — what a page is, the freshness contract, tabs, actions, wake gates and the permission model
- Page commands — the CLI, including the producer form
- Internal IPC — the routine and container write path
Custom application contract
Custom Pages store a portable React/TypeScript source project separately from live panel data. Draft edits and builds do not publish. Source operations below require session/CLI authentication, workspace context and Page edit permission; publication additionally requires Page ownership or workspace administration. Application reads/actions enforce the current viewer’s Page/panel reach. Errors use JSON{"error":"…"}. Common statuses are 401 without authentication,
403 without authority, 404 for an unavailable Page/resource, 500 for an
internal storage error, and 503 when required project/build/runtime services
are not configured. These endpoints are opt-in and experimental.
The supported source format is crewship-page-source/v1 with runtime
react-vite-typescript/v1. files contains {path, encoding, content} entries;
encoding is utf8 or canonical base64. Required files are package.json,
pnpm-lock.yaml and index.html. Limits: 256 files, 512 KiB decoded per file,
2 MiB decoded source, 4 MiB serialized transfer. Traversal, reserved paths,
case collisions and symlinks are rejected. The pinned compiler profile fixes
supported dependencies; project-defined install/build scripts are not executed.
Read custom source
GET /api/v1/pages/{slug}/project
Request: path slug, workspace context; no body.
Response 200: {revision, digest, git_commit, definition, project}. The
project contains exact file bytes; the definition is the authored Page document.
This is an editor-only response, never the reader’s application payload.
Statuses: 404 if no draft exists, plus the common authentication/storage
errors above. The response is no-store.
Save custom source
PUT /api/v1/pages/{slug}/project
Request: {expected_revision, project, definition?}. Revision 0 creates
an initial draft. An optional complete definition replaces the draft Page
spec; omitting it preserves the previous spec (or copies the existing Page on
initialization). Public-panel flags cannot be enabled in a portable draft.
Response 200: {revision, digest, git_commit, state:"draft"} after a Git
checkpoint and atomic revision update. Live publications are unchanged.
Statuses: 400 malformed request, 409 revision conflict, 413 oversized
transfer, 422 invalid source/definition/references, 507 exhausted quota,
plus common errors. Authentication requires Page edit permission.
Build custom source
POST /api/v1/pages/{slug}/project/build
Request: {expected_revision}; authenticated Page editor.
Response 202: build record {id, source_revision, source_digest, state, created_at}. Completion adds artifact_digest or error and completed_at.
States are running, ready, failed, interrupted. One offline compiler
runs per server; this response is admission, not completed compilation.
Statuses: 400 malformed revision, 409 draft changed, 413 oversized
request, 429 compiler busy, 507 build-record quota, plus common errors.
Read build preview
GET /api/v1/pages/{slug}/project/preview
Request: path slug; authenticated Page editor, no body.
Response 200: {revision, build, runtime_url, development_same_origin, artifact?}.
build is null before the first build; development_same_origin is true
only when the operator has enabled
CREWSHIP_PAGE_RUNTIME_DEVELOPMENT_SAME_ORIGIN. A ready build includes the immutable artifact
{format:"crewship-page-preview/v1", javascript, css, toolchain}. This response
is no-store; execute only through the configured separate-site bootstrap.
Statuses: 404 missing draft, common errors including 503 if the worker
or required runtime isolation configuration is unavailable. Preview does not
permit SDK actions against the published application.
List source history
GET /api/v1/pages/{slug}/project/history
Request: authenticated Page editor; optional positive before revision.
Response 200: {revisions, next_before} with at most 50 entries. Each entry
contains revision, digest, git_commit, actor, actor_kind,
created_at, restorable.
An agent-authored entry uses the agent ID as actor; it is not a user ID.
actor_kind is user, agent, crew or unknown and is the only field that
says which of those the opaque actor string holds.
next_before: 0 means no further page. Metadata is no-store.
Statuses: 400 invalid cursor, plus common errors.
Read historical source
GET /api/v1/pages/{slug}/project/history/{revision}
Request: authenticated Page editor; positive path revision.
Response 200: the same shape as the current source response, verified
against its Git checkpoint and saved Page definition.
Statuses: 400 invalid revision, 404 missing revision, 409 legacy
revision without a saved definition, plus common errors.
Restore source draft
POST /api/v1/pages/{slug}/project/restore
Request: authenticated Page editor; {revision, expected_revision} names
the historical source and the current draft revision respectively.
Response 200: {revision, digest, git_commit, state:"draft"} for a new
checkpoint. Restore does not move the live application or erase later history.
Statuses: 400 malformed body, 409 stale revision or unrestorable
history, 413 oversized body, 422 invalid current references, 507 quota,
plus common errors.
Check a publication candidate
POST /api/v1/pages/{slug}/project/check
Request: authenticated Page editor; {build_id, expected_revision}.
Response 200: {build_id, source_revision, git_commit, artifact_digest, checks} after source/artifact integrity and current reference checks.
browser_review and security_review remain required; this is not an
automatic safety certification and does not publish or invoke actions.
Statuses: 400 malformed body, or a declared reference — owner crew,
producer, call routine, gate target — that no longer exists, named in the
sentence, 403 that same reference problem on a panel the caller may not read,
where the sentence says only that a withheld part does not validate (or, when
this candidate also changes it, that it changes it) and how many panels are
withheld, 409 incompatible source/build or failed
integrity checks, 413 oversized body, 422 invalid current bindings, plus
common errors. Validation always runs over the whole candidate for everyone;
only whether the refusal may name what failed depends on the caller, and a
workspace administrator reads every panel and always gets the full sentence.
The project/check response filters checks.routine_definitions to routines
referenced by visible panels. Validation still covers the complete candidate;
publication provenance retains the complete map server-side.
Review a publication candidate
GET /api/v1/pages/{slug}/project/review
Request: authenticated Page editor; path slug, optional positive
publication query parameter, no body.
Response 200: {issued_at, candidate, baseline, routines, capabilities, blockers, initial_publication}, where baseline is
{publication_version, published, definition_digest, definition, excluded_panels, source_revision, git_commit, source_available, source_unavailable_reason, withheld_changed, definition_diverged} and
candidate is
{revision, git_commit, source_digest, created_at, actor, build, definition}.
candidate is the current draft revision with
its actor and the build of exactly that revision, and is null when there is
no draft, or when the draft is identical to a publication that is still
running. A withdrawn publication is not running, so an identical draft is
still a candidate: republishing it is how a withdrawal is undone.
Pass publication=<version> to ask what publishing that retained version
would be fenced on instead. candidate then describes that publication’s
archived source — its source revision, checkpoint, digest, the publisher it
recorded and when — with the build it recorded, and routines is computed
from its archived Page definition. candidate.actor and candidate.created_at
mean the source revision’s author and save time in draft mode, and the
publication’s publisher and publication time in this one. That is exactly the key set a
rollback_version publication must send as expected_routine_digests; the
draft’s routines are a different document’s routines, and no client can
recompute the current digest of each one. baseline is identical in both
modes, because restoring a version replaces the same live definition. A
version that is not retained is reported as no_candidate and one that is
already running as candidate_matches_live; both keep the rest of the
snapshot, and a retained candidate stays populated so the refusal can name
which version it is about. baseline.definition_digest is the
sha256 of the live Page definition and is the value a publication is fenced on.
baseline.definition is that same live Page document, read from the same
stored row in the same request, and candidate.definition is the document
this candidate would make live — the draft’s, or in ?publication=N mode the
archived one that version recorded. Both come out of this one response, so the
two sides of the comparison and the digest the publication attests to describe
one instant rather than three reads of three endpoints. Compare these two
documents and not a separately fetched Page or project, or a reviewer can
approve a comparison the fence does not cover.
Panels this caller may not read are removed from both — panel visibility is
its owning crew’s, and an edit grant is never a read grant — and the removal
is deliberately symmetric: a panel taken out of one document and left in the
other would be reported as added or removed by the publication, which is false
about a panel that is merely not this reader’s to see.
baseline.excluded_panels is how many panels were withheld from the
comparison, counting a panel withheld from both documents once, so a partial
comparison can say so.
Full authoring reads require visibility of every declared panel. The review
screen reads /project/source and /project/history/{revision}/source, which
omit the definition; the authorized comparison comes from this snapshot.
Application source remains shared Page code, not automatically redacted text.
baseline.withheld_changed is whether any of those withheld panels actually
differs between the live definition and the candidate — added, removed,
modified, or re-pointed between a crew this caller may see and one they may
not. A count is a warning; this is the answer that settles what the consent
underneath the review can honestly cover. False means the comparison on screen
covers everything that moves and publishing stays available. True adds the
withheld_change blocker and the publication is refused, and nothing about
what changed is disclosed either way: the flag, and the count beside it, are
the whole of it. routines follows the same rule — a routine is listed only
when a panel that survived withholding declares it, so the response does not
name what it has just withheld — and routines[].in_candidate is therefore
exactly the fence the publication rebuilds for this caller. A routine only a
withheld panel calls is not fenced by a publisher who cannot read that panel:
the fence asks a human to attest that a value has not moved since they
reviewed it, and they never reviewed that one. A workspace administrator
reads every panel, so their list and their fence are unchanged.
definition_digest is unaffected by any of this, because the fence compares
the full stored document. Either document is null only when the stored bytes
cannot be read as a Page document, and there is then no basis for a comparison
at all; when there is no candidate, candidate itself is null.
baseline.definition_diverged says the live Page definition and the
definition the live publication shipped with have drifted apart — somebody
changed panels outside the application flow. It is a statement, not a refusal.
The comparison on this snapshot is derived from the current live definition
and the candidate, so it is complete regardless of what the publication once
shipped, and publishing the candidate is what ends the divergence; refusing on
it would block the only action that does. It is true in the withdrawn state
too, where published is false and nothing is running, so a note about it
must say “the live publication”, never “the running application”. Do not
confuse it with the definition_moved blocker code, which is reserved for the
publish fence tripping — a base that moved between the render and the click,
where refreshing genuinely is the cure.
baseline.source_available:false means the retained source for the live
publication cannot be read back — a missing comparison, never “no changes” —
and source_unavailable_reason says why in a sentence.
routines is a union: the candidate’s own call routines and the ones the
live publication recorded, so a routine being dropped stays visible.
routines[].in_candidate marks the rows that belong in a publication’s
expected_routine_digests — the candidate declares them, so the server
rebuilds and compares exactly those. Sending a row without the flag is a key
the server does not have and is refused as a routines conflict naming a
routine nobody moved. routines[].state is unchanged, changed or
unknown; unknown covers a publication that recorded no digest for a
routine and a routine that no longer resolves, and is never rendered as
agreement. blockers[].code is one of
no_candidate, candidate_matches_live, build_missing, build_failed,
build_stale, baseline_unavailable, routine_unresolved,
definition_moved, withheld_change, not_permitted and
storage_unavailable. definition_moved is reserved for the publish fence;
the review does not emit it.
routine_unresolved is emitted for every in_candidate routine with no
current digest: publishing such a candidate is refused, so the review says so
rather than reporting the routine as merely unknown beside a ready build. Missing build storage or a missing runtime origin is a
blocker, not a 503: a reviewer who cannot publish can still read the snapshot.
Statuses: 400 non-positive or malformed publication, plus common
errors. Responses are no-store.
Publish or roll back an application
POST /api/v1/pages/{slug}/project/publish
Authentication: Page owner or workspace administrator; edit grant alone
is insufficient. Request: {build_id, expected_revision, expected_publication, reviewed_code:true, expected_definition_digest, expected_routine_digests}. Use publication 0 for the first
publication. For rollback, send {rollback_version, expected_publication, reviewed_code:true} with both fence fields, and omit build_id and
expected_revision.
acknowledged_unavailable_baseline is optional and defaults to false. When
the live publication’s retained source cannot be read back — the same
condition the review reports as baseline_unavailable — the publication is
refused with 409 and conflict: "baseline" unless it is true. It states
that nobody compared this candidate with what is running. It proves nothing
about the candidate itself, whose source, checkpoint, artifact and bindings
are verified either way, and the answer is recorded in the publication’s
checks as baseline_source (verified, unavailable_acknowledged, or
initial_publication) so a receipt says which publications shipped without a
diff basis. An initial publication has no prior source and is never refused
for this reason. The server refuses by default rather than blocking outright
because retention and compaction legitimately discard old checkpoints, and a
workspace whose history was reclaimed must still be able to publish a sound
candidate — by saying so, not by having it assumed.
reviewed_code: true attests that the whole change was reviewed, and the
server refuses an attestation the caller cannot make. Publishing requires Page
ownership or workspace administration; seeing a panel requires membership of
that panel’s owning crew or the same administration. A Page owner who is not
an administrator therefore may publish a Page carrying panels they cannot
read. Nothing there leaks and nothing bypasses authorization — the operation
was always theirs — but the claim about what was reviewed was not true of the
part that was hidden. So when a panel this caller may not read differs between
the live definition and the candidate, the publication is refused with 403
and a sentence that says such a part exists and how many panels are withheld,
and nothing about what it is. The rollback path is included: restoring a
retained version replaces the live definition too, and the comparison is
against that version’s archived declaration. Read
baseline.withheld_changed on the review snapshot to know in advance. This is
not a state conflict, so the body carries no conflict kind and refetching
changes nothing, and unlike acknowledged_unavailable_baseline there is no
flag that waives it: that one says nobody made a comparison, this one would
say the publisher may not see what they are signing for. A workspace
administrator reads every panel, so it never applies to one.
expected_definition_digest and expected_routine_digests are required on
both paths and are the values the reviewer was shown — read them from the
review snapshot above. The digest is 64 lowercase hex characters; the map is
keyed by routine slug and is {} when the candidate declares no call
actions. Both are compared inside the publishing transaction, before any
write, so a Page definition or a routine script that moved between review and
publication refuses the publication instead of shipping it. An exact retry
short-circuits to its original receipt before the comparison runs: the receipt
records what already happened, and the fence guards what is about to.
Response 200: immutable receipt {version, build_id, source_revision, source_digest, git_commit, artifact_digest, created_at}. The live pointer and
Page declaration change atomically. An exact retry returns its original
receipt without rewinding a newer live publication. Rollback creates a new
publication from the old artifact and declaration; it preserves the draft and
does not undo completed routine effects.
Statuses: 400 invalid or conflicting fields, missing review confirmation
or a malformed fence — and a declared reference that no longer exists (owner
crew, producer, call routine, gate target), which the authoring gate refuses
ahead of the fence and therefore without a conflict kind, even when it was
deleted concurrently, 403 publishing is not this caller’s to do, a panel
they may not read differs between the live definition and the candidate, or a
panel they may not read fails that reference validation — the refusal then
says only that a withheld part changes or does not validate, and how many
panels are withheld, never which reference or which panel, 409
changed draft, publication or declaration, 413
oversized body, 422 invalid bindings, 507 publication quota, plus common
errors. A 409 body carries conflict — definition, routines,
publication, draft or baseline — naming which base moved or is missing, and a routines conflict
also lists the routines that moved.
Read the live application
GET /api/v1/pages/{slug}/application
Authentication: current Page reach. Request: path slug; optional
If-None-Match header containing the previously returned ETag.
Response 200: {publication, publication_version, can_publish, artifact?, runtime_url?, development_same_origin?}. An
unpublished Page returns publication:null. A published response includes the
immutable receipt and compiled artifact, never the source project. 304 is
returned for an unchanged ETag only after current authorization is checked;
no artifact bytes are read or retransmitted. The tag includes publication,
runtime and publishing authority. Responses are no-store; the page in the
browser keeps the active artifact in memory and sends its ETag for
revalidation. The response also carries publication_version — the live
publication’s number, 0 before any — and, when a publication is running,
development_same_origin: true only when the operator has enabled
CREWSHIP_PAGE_RUNTIME_DEVELOPMENT_SAME_ORIGIN, so a client can show the
isolation warning. A withdrawn application answers publication: null with
its publication_version kept.
Statuses: common errors; 404 also conceals a Page outside viewer reach.
Reading published artifacts works with the compiler disabled.
Dispatch a published action
POST /api/v1/pages/{slug}/application/actions/{panelId}/{actionId}
Authentication: existing action-dispatch role, current Page/panel access
and routine policy. Request: Idempotency-Key header (1–128 bytes), JSON
{publication, inputs} at most 32 KiB. Only a stored call action is accepted;
there is no shell, arbitrary URL or routine-name parameter. The SDK broker in
the page obtains confirmation in the trusted host before sending this request.
Response 202: existing action queue receipt including pending_id; this
does not mean the routine completed. Keys/debounce are scoped by viewer and
publication. Publication/declaration checks and enqueue share a transaction.
Statuses: 400 missing key or invalid inputs, 404 inaccessible action,
409 publication/declaration changed, 413 body too large, 429 rate limit,
plus common errors. Refresh and review the new declaration after 409.
Read own application action status
GET /api/v1/pages/{slug}/application/actions/{pendingId}
Authentication: only the user who dispatched this pending action, with
current access to the originating panel. Request: Page slug and the
returned pendingId; no body.
Response 200: {pending_id, pending_status, run_id, run_status}. Run fields
can be empty before execution. A disconnect or client timeout is not cancellation.
Statuses: 401 unauthenticated, 403 forbidden, 404 unavailable Page,
panel or another viewer’s pending action, 500 storage failure.
Bootstrap the isolated runtime
GET /api/v1/pages/runtime/bootstrap
Authentication: none. Request: no body; serve on the configured origin
on a different site from the browser origin (CREWSHIP_PAGE_STUDIO_ORIGIN).
Response 200: fixed text/html bootstrap with sandbox/CSP protections. It
contains no user data, code artifacts, source or credentials; the authorized
page host initializes a private MessagePort.
Status 404: runtime origin is not configured. This is the only route that
needs exposure on the runtime reverse-proxy alias. A separate site does not
provide a portable hard browser CPU/memory limit or complete anti-exfiltration
protection; custom source still requires review.
Publication history and withdrawal
GET /api/v1/pages/{slug}/project/publications requires Page edit access and
returns at most 50 receipts, next_before, publication_version, published
and can_publish. Use ?before=<version> to paginate. Each receipt identifies
its exact source revision/build, original publisher, rollback target and any
withdrawal time. Source inspection uses the existing project-history endpoint.
POST /api/v1/pages/{slug}/project/unpublish requires Page ownership or workspace
administration and a body {"expected_publication":3}. A stale version returns
409. Withdrawal hides the application, preserves panels and history, and keeps
the version counter for future publication. Repeating the same withdrawal is
idempotent; an old successful publish retry cannot reactivate withdrawn code.
Application panel history
GET /api/v1/pages/{slug}/application/panels/{panelId}/history requires readable
panel access and publication=<mounted-version>. Optional limit is 1–20;
before is a positive sequence cursor. The response contains items (sequence,
data, producedAt, state), next_before (0 at the end), and publication.
Responses are bounded to 1 MiB and never contain producer/run metadata. A stale,
withdrawn or definition-mismatched publication returns 409; an inaccessible panel
returns 404. The SDK exposes this as getPanelHistory(panelId, {limit, before}).
POST /api/v1/pages/maintenance
Authentication: workspace OWNER or ADMIN. Request: JSON object; optionaldiscard_history defaults to false. Setting it to true also requires
confirm: true and discards optional history across the workspace. Current
drafts, live publication pointers and running builds remain protected.
Response 200: compacted, discarded_optional_history, and preserved.
Statuses: 400 malformed request or missing confirmation; 403 unauthorized;
503 project storage disabled; 500 storage maintenance failure.
GET /api/v1/pages/{slug}/project/fsck
healthy, checked_sources, checked_checkpoints,
checked_artifacts, checked_git_objects, and failures (kind, id, error).
An unhealthy result is still HTTP 200: callers must inspect healthy.
This checks source, checkpoint contents, referenced artifacts and reachable Git
objects without changing them. Statuses: 403 no edit access; 404 unavailable
Page; 503 storage disabled or maintenance busy; 500 database/read failure.
Whole-document authoring and source review
A Page write grant does not grant visibility of another crew’s panels.GET /pages/{slug}/project, GET /pages/{slug}/project/history/{revision},
and Page export return 403 unless the caller can read every panel in the
returned definition. Agent project reads apply the same rule. These endpoints
never return a truncated document that could delete hidden panels on save.
PUT /pages/{slug}/project (including source restore) requires visibility of
all panels in the live definition, existing draft, and proposed definition.
A rejected save leaves the draft revision unchanged.
For reviewing application source, use GET /pages/{slug}/project/source and
GET /pages/{slug}/project/history/{revision}/source. Both retain the Page
edit-permission gate and return revision, digest, git_commit, and project,
with no definition. The review snapshot supplies the authorized panel
comparison. Application source is shared Page code; these reads do not redact
panel names or other text an author has written into source files.
Read candidate source evidence
GET /api/v1/pages/{slug}/project/source
Request: path slug, workspace context; no body. Requires Page edit permission.
Response 200: {revision, digest, git_commit, project} with exact source
files and no definition. Panel comparisons belong to the review snapshot.
Statuses: 401 unauthenticated, 403 no edit authority, 404 Page or draft
missing, 500 storage/integrity error, 503 project storage unavailable.
The response is no-store.
Read archived source evidence
GET /api/v1/pages/{slug}/project/history/{revision}/source
Request: path slug and positive revision, workspace context; no body.
Requires Page edit permission.
Response 200: {revision, digest, git_commit, project} verified against the
archived source digest, without the archived panel definition.
Statuses: 400 invalid revision, 401 unauthenticated, 403 no edit
authority, 404 Page or revision missing, 409 unsupported legacy revision,
500 archive/integrity error, 503 project storage unavailable.
The response is no-store.
Native document availability
GET /api/v1/documents/status
Authentication: a current human session or CLI credential and workspace
membership. Response: { "enabled": false } until the instance is configured
for documents. While native Word and Sheet run, applications gives the
instance administrator’s mode for each, {"wordcraft": "open" | "draining" | "closed", "gridcraft": …}; wordcraft_native and gridcraft_native are true
only while it is open. Statuses: 200 availability; 400 missing workspace; 401 invalid
credential; 403 workspace boundary; 500 unavailable storage. Responses are not
cached. CLI: crewship doc status.
Read a native document
GET /api/v1/pages/{slug}/document
Authentication: a current human credential with current document read access;
scoped CLI credentials need pages:read. Response: the confirmed content tree,
outline, revision, opaque editing epoch and current write capability. Comment
and resolve capabilities are disabled. The request does not accept a block_id
or revision selector in this release. Any supplied revision query, including
an empty or repeated value, returns 400 before contacting the document engine;
it never falls forward to the current head. Malformed query encoding also
returns 400 without reading content. Read a retained checkpoint through
the checkpoint endpoint below instead. Statuses: 200 document; 400 unsupported selector;
401 invalid credential; 403 missing access/scope; 404 unavailable Page/document;
409 incompatible content; 413 oversized content; 500 storage failure;
502 invalid engine response; 503 disabled or unavailable service. Responses use
Cache-Control: no-store. CLI: crewship doc read and crewship doc outline.
Name the people mentioned in a native document
GET /api/v1/pages/{slug}/document/people
Authentication: a current human session, or a current CLI token with pages:read, with current read
access to the Page and its document; agent run credentials are refused with 403.
Request: the Page slug or immutable @PageID and current workspace; query
parameters ids (a comma-separated list of at most 100 mention user ids) or
q (at most 100 characters of name text for the @-mention picker), never both;
no request body. Response: people, an array of {id, name}. With ids, only
the listed people who can currently read this document are named; anyone else,
including an unknown id, is simply absent, so the answer never reveals whether
an id exists. With q, at most 20 such readers whose name contains the text
(an empty q lists the first 20). The name match and a first access filter
both cover every member, so a reader is found however many other members share
the text; at most 200 of those candidates get the exact access check per
request. Email addresses are never matched or returned.
A caller who cannot read the document gets 404, as for a missing Page.
Each person may make 30 lookups at once and 2 per second after that, per
workspace; beyond that the answer is 429 with Retry-After and code
document_people_rate_limit. A workspace owner’s or administrator’s lookup
that only their role makes possible is audited once per document and session
(or CLI token) per hour, not once per keystroke.
Statuses: 200 people; 400 invalid ids, both selectors, a repeated parameter or too-long text;
401 invalid credential; 403 agent or missing scope; 404 unavailable Page or
document; 429 lookup limit; 500 storage or audit failure; 503 disabled service. Responses use
Cache-Control: no-store. CLI: crewship doc people.
Export a native document as Markdown or Word
GET /api/v1/pages/{slug}/document/export?format=markdown|docx
Exports include the current confirmed Page content only. Canvas-only items and
layout, unsent changes and selected historical revisions are not included. Mention
names use the exporting reader’s current document access; unavailable people remain
unknown. If the Page changes while export is prepared, retry the export.
Authentication and access are exactly those of
Read a native document: a current human credential
with current document read access (scoped CLI credentials need pages:read).
The documents engine reads the confirmed state through the same private
authority. Private output is readable by its custodian and currently authorized
workspace OWNER/ADMIN readers, whose foreign private read is audited before
any byte is returned. A caller who may not read the document gets exactly the
error GET /document gives it: the same 404 as a missing document. Restricted members
cannot export at all (404), not even private output they hold custody of.
One explicit format must be markdown (or md) or docx; any other value
returns 400 before the engine is contacted. Markdown response: 200 with Content-Type: text/markdown; charset=utf-8, Content-Disposition: attachment; filename="<slug>.md",
X-Content-Type-Options: nosniff and Cache-Control: no-store. Markdown
covers headings, paragraphs, lists, checklists, quotes, simple tables, links,
bold, italic, strikethrough, inline code and fenced code blocks with their
language; LaTeX, CSV and Markdown code blocks export as their source.
Content Markdown cannot represent (for example a code block inside a table)
returns 422 with code unsupported_markdown and a reason, never a file with
parts missing.
Word response (format=docx): 200 with Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document,
Content-Disposition: attachment; filename="<slug>.docx" and the same
nosniff/no-store headers. The engine’s formatter writes headings 1–3 as
Word heading styles, bullet and numbered lists as Word numbering, checklists as
paragraphs led by ☐/☑, quotes in a Quote style, simple tables as Word tables
with header rows, links as external hyperlinks (never fetched), bold, italic,
strikethrough, inline code and code blocks in code styles with tabs and line
breaks kept; LaTeX, CSV and Markdown code blocks keep their source text. Block
IDs, comments and history are not part of the file. Content Word cannot hold
(lists nested deeper than nine levels, characters XML cannot carry) returns
422 with code unmappable-content and the reason. The formatter’s conversion
ceilings (500,000 characters of content JSON, 10,000 nodes, nesting depth 40)
return 422 invalid-content, and a package over just under 3 MiB
(3,145,680 bytes) returns 422 docx_export_limit. Documents in a schema the
engine does not serve yet return 409. Statuses: 200 file; 400 unsupported format or selector; 401
invalid credential; 403 missing access/scope; 404 unavailable Page/document;
409 incompatible content; 422 not representable; 500 storage failure; 502
invalid engine response; 503 disabled or unavailable service. CLI:
crewship doc export.
List saved document checkpoints
GET /api/v1/pages/{slug}/document/checkpoints
Authentication: a current human credential with current Page and document read
access; scoped CLI credentials need pages:read. Agent run credentials are
refused. Request: the Page slug or immutable @PageID and current workspace;
no request body. Response: checkpoints, an array of at most 1000 entries with
id, rev, schema, actor and created_at. This does not create a checkpoint.
Statuses: 200 list; 400 invalid selector; 401 invalid or revoked credential;
403 missing scope or human credential; 404 unavailable Page or document;
409 incompatible state; 429 capacity limit; 500 storage failure;
502 malformed engine response; 503 disabled or unavailable service.
Responses use Cache-Control: no-store.
CLI: crewship doc checkpoints <page-slug>.
Read one saved document checkpoint
GET /api/v1/pages/{slug}/document/checkpoints/{checkpoint}
Authentication: the same current human read access, checked again on each read.
A historical checkpoint never restores earlier permissions. Request: a Page
selector and checkpoint ID of 1–128 ASCII letters, digits, underscores or hyphens;
no request body. Response: exactly page_id, id, rev, schema and the
retained document content. No editing epoch, binary snapshot or write
capability is returned. Unsupported schemas return 409 without content.
Statuses: 200 checkpoint; 400 invalid identity; 401 invalid or revoked credential;
403 missing scope or human credential; 404 unavailable Page, document or checkpoint;
409 incompatible schema; 429 capacity limit; 500 storage failure;
502 malformed engine response; 503 disabled or unavailable service.
Responses use Cache-Control: no-store.
CLI: crewship doc checkpoint <page-slug> <checkpoint-id>.
Restore a saved document checkpoint
POST /api/v1/pages/{slug}/document/restore
Authentication: a current human credential with current Page and document write
access; scoped CLI credentials need pages:write. Agent run credentials are
refused. Reading somebody else’s private document as workspace OWNER requires
an audit entry before disclosure; earlier checkpoint permissions are not reused.
Request: one JSON object of at most 4096 bytes, with exactly page_id, id,
schema (2 to 6), epoch, ifRev and checkpoint. Use the immutable Page ID,
the current editing epoch and revision, a retained checkpoint ID and a new
mutation ID. Page, mutation and checkpoint IDs contain 1–128 ASCII letters,
digits, underscores or hyphens. A changed Page identity, revision or epoch
refuses the operation; the server does not select a replacement checkpoint.
Response 200: page_id, id, rev, a new epoch, kind: "restore" and
schema (the Document’s schema after the restore) and optional duplicate.
Restoration creates a new revision, preserving the retained checkpoint. A
schema 5 Document stays at schema 5 when you restore a checkpoint from before
its upgrade: older content is valid schema 5 content, and new agent proposals
are made at schema 5. A Canvas (schema 6) Document stays at schema 6 in the
same way; a checkpoint from before Canvas was enabled restores the Page and
leaves the Canvas layout, cards and notes empty. Below schema 5 the Document
takes the checkpoint’s schema. After an uncertain confirmation, retry the original
packet with the same mutation ID and preconditions; an exact authorized retry
returns the original receipt without another restoration. A lost confirmation
is not evidence that the write failed.
Statuses: 200 confirmed receipt; 400 invalid or oversized packet or Page identity;
401 invalid or revoked credential; 403 missing write scope or human credential;
404 unavailable Page, document or checkpoint; 409 stale or incompatible state;
413 engine size limit; 422 rejected content; 429 capacity limit; 500 audit failure;
502 invalid receipt; 503 disabled service or unavailable confirmation.
Responses use Cache-Control: no-store.
CLI: crewship doc restore <page-slug> --file <request.json>.
Initialize a native document
POST /api/v1/pages/{slug}/document/initialize
Authentication: a current human credential owning an empty Page, with current
write permission; scoped CLI credentials need both pages:read and pages:write.
Request body: one JSON object of at most 2 MiB containing id, schema (2, 3 or 4)
and body. Schemas 3 to 6 also require the original page_id. Schema 4 adds
bold, italic and strike marks, a code block language, blockquote and
taskList/taskItem (checked); see crewship doc initialize. Stage a Page through
POST /api/v1/pages with panels: [] and allow_empty: true; this is an explicit
human-only opt-in and cannot assign crew ownership. Existing panel Pages retain
normal validation. Response: first durable initialization state, or the original
receipt on an exact retry. Always read the document before preparing an edit.
Statuses: 200 confirmed initialization; 400 invalid request; 401 invalid
credential; 403 wrong owner/access/scope; 404 unavailable Page; 409 incompatible
or conflicting initialization; 413 oversized request; 422 invalid content;
429 capacity limit; 500 storage failure; 502 invalid engine response;
503 disabled or unavailable service. Responses use Cache-Control: no-store.
CLI: crewship doc initialize <page-slug> --file <request.json>.
Update a native document
POST /api/v1/pages/{slug}/document/patch
Authentication: a current human credential with current document write access;
scoped CLI credentials need both pages:read and pages:write. Request body:
one JSON object of at most 2 MiB. Semantic replacement requires id, schema,
epoch, target, text, ifRev and ifHash. The editor’s incremental form
uses kind: "human" and base64 update; schemas 3 to 6 require the original
page_id. The service rechecks the exact credential and permission within the
storage transaction. Response: a receipt for the confirmed revision. Repeating
the original operation after a lost confirmation returns its receipt without
another write; revocation still refuses the retry. A stale request is never
automatically rebased. Statuses: 200 confirmed receipt; 400 invalid request;
401 invalid credential; 403 missing access/scope; 404 unavailable document;
409 stale revision/hash/epoch or conflicting operation ID; 413 oversized
request; 422 invalid content; 429 temporary operation limit; 500 storage failure;
502 invalid engine response; 503 disabled or unavailable service. Responses use
Cache-Control: no-store. CLI: crewship doc patch <page-slug> --file <request.json>.
Upgrade a native document (enable Canvas)
POST /api/v1/pages/{slug}/document/upgrade
The explicit human schema upgrade; today it enables the Docs Canvas (schema 6)
on an older document. Authentication: a current human credential with current
document write (Edit) access; scoped CLI credentials need both pages:read and
pages:write. Agent run credentials are refused. Request body: one JSON object
with id (operation ID), schema (the document’s current schema, which must
support upgrade), target_schema (6), page_id, epoch and ifRev from the
current read. Nothing in the content changes: text, block IDs and hashes,
versions and comments stay as they are. Open proposals can afterwards only be
rejected, never accepted. The schema and the document generation advance, so editors still open at the old schema are
refused with 409 and must reload. Response: a receipt with rev and schema.
Repeating the original request after a lost confirmation returns its receipt
with duplicate: true and never upgrades twice. Statuses: 200 confirmed
receipt; 400 invalid request; 401 invalid credential; 403 missing access/scope
or an agent credential; 404 unavailable document; 409 stale revision/epoch, a
schema that cannot upgrade, a wrong target or a conflicting operation ID; 413
oversized request; 429 temporary operation limit; 500 storage failure; 502
invalid engine response; 503 disabled or unavailable service. Responses use
Cache-Control: no-store. CLI: crewship doc upgrade <page-slug> --file <request.json>.
List document comments
GET /api/v1/pages/{slug}/document/comments
Authentication: a current human credential with read access to the document;
scoped CLI credentials need pages:read. Agent run credentials are refused.
Reading somebody else’s private document as workspace OWNER is audited, as for
the document itself. Request: no body or query parameters.
Response 200: page_id, comments (at most 1,000, oldest first), and
can_comment and can_resolve for the caller. Each comment has id, body,
actor, rev, version, resolved and created_at. A thread also has
block, quote, from, to (UTF-16 offsets in the current text) and status
(attached, collapsed, detached or resolved); a reply has parent.
Statuses: 200 listing; 400 invalid request; 401 invalid credential; 403 missing
access/scope; 404 unavailable document; 409 unsupported schema; 429 capacity
limit; 500 storage failure; 502 invalid engine response; 503 disabled or
unavailable service. Responses use Cache-Control: no-store.
CLI: crewship doc comments <page-slug>.
Comment on a document
POST /api/v1/pages/{slug}/document/comments
Authentication: a current human credential with Comment or Edit access to the
document (Edit, or a Comment or Edit grant); on private output only its owner.
Scoped CLI credentials need pages:write; agent credentials are refused.
Request body: id, schema, epoch, ifRev, text (1–10,000 characters) and,
for schemas 3 to 6, page_id. A new thread adds block, from and to (the
quoted UTF-16 range in one paragraph, heading or code block); a reply adds
parent instead. Response: a receipt with id, rev, epoch, actor and
kind: "comment"; an exact retry returns it again. Comments never change
content, revision or epoch. Statuses: 200 confirmed; 400 invalid request or
range; 401 invalid credential; 403 missing access/scope; 404 unavailable
document or thread; 409 stale revision/epoch or conflicting operation ID;
413 anchor limit; 429 comment or operation limit; 500 storage failure; 502 invalid
engine response; 503 disabled or unavailable service.
CLI: crewship doc comment <page-slug> --file <request.json>.
Resolve a document comment thread
POST /api/v1/pages/{slug}/document/comments/resolve
Authentication: as for commenting. Request body: id, schema, epoch,
ifRev, page_id (schemas 3 to 6), comment (thread ID), version (current)
and resolved (true resolves, false reopens). Response: a receipt with
kind: "resolve". Statuses: 200 confirmed; 400 invalid request; 401 invalid
credential; 403 missing access/scope; 409 stale version, revision or epoch;
429 operation limit; 500 storage failure; 502 invalid engine response;
503 disabled or unavailable service.
CLI: crewship doc comment-resolve <page-slug> --file <request.json>.
List agent proposals on a document
GET /api/v1/pages/{slug}/document/proposals
Authentication: a human session or CLI token with read access to the document
(pages:read for scoped credentials). Agent run credentials are refused; agents
never review proposals, and restricted members have no access to this route.
Request: path parameter slug only. Response: page_id and proposals, oldest
first; each has id, author, run_id, target.block_ids, base_rev,
status (open, stale, accepted or rejected), text and created_at.
Proposals exist on documents whose schema supports them (4, 5 and 6), each bound to
the schema it was made at; GET /api/v1/pages/{slug}/document reports
proposals: true where they are served and the schema’s capabilities. Statuses: 200 listed; 401
invalid credential; 403 missing access or an agent credential; 404 no such
document; 409 unsupported schema; 502 invalid engine response; 503
disabled or unavailable service.
CLI: crewship doc proposals <page-slug>.
Read one agent proposal
GET /api/v1/pages/{slug}/document/proposals/{proposal}
Authentication: as for listing proposals. Request: path parameters slug and
proposal. Response: the proposal with base_content (the target block as the
agent saw it) and proposed_content (the block after the change), both
document nodes. Statuses: 200 read; 400 invalid proposal ID; 401 invalid
credential; 403 missing access; 404 no such proposal; 502 invalid engine
response; 503 disabled or unavailable service.
CLI: crewship doc proposal <page-slug> <proposal-id>.
Accept or reject an agent proposal
POST /api/v1/pages/{slug}/document/proposals/{proposal}/accept
POST /api/v1/pages/{slug}/document/proposals/{proposal}/reject
Authentication: a human session or CLI token with edit access to the document
(pages:read and pages:write for scoped credentials); agent credentials are
refused. Request body: exactly request_id (the idempotency key; an
Idempotency-Key header, when sent, must equal it) and expected_rev (the
revision the reviewer saw). Accept applies exactly the proposed block as a new
human revision in the same transaction that marks the proposal accepted; reject
closes it without changing content. Response: page_id, proposal, id,
rev, kind (human or proposal-reject) and duplicate on an exact retry.
Statuses: 200 decided; 400 not a closed decision; 401 invalid credential; 403
missing edit access or an agent credential; 404 no such proposal; 409 newer
head, changed target, or a proposal that is no longer open; 429 operation
limit; 500 storage failure; 502 invalid engine response; 503 disabled or
unavailable service.
CLI: crewship doc proposal-accept|proposal-reject <page-slug> <proposal-id> --expected-rev <n> --request-id <id>.
Document presence heartbeat
POST /api/v1/pages/{slug}/document/presence
Who else has the document open, and where their caret is. Presence is
ephemeral: the server keeps it in memory only, never in the database or the
document, and forgets a tab after 6 seconds without a heartbeat. Clients send
one heartbeat a second, and an extra one (at most every 150 ms) only when the
caret actually moved.
Authentication: a current human credential with read access to the document;
every heartbeat is authorized like a document read, at that moment. Scoped CLI
credentials need pages:read; agent credentials are refused. On private output
only its owner takes part (nobody else is ever listed there).
Request body (at most 2 KiB, unknown fields refused): client, this tab’s id
(8–64 of A-Z a-z 0-9 - _); optionally anchor and head, both or neither,
the caret and range as base64 Yjs relative positions (at most 192 bytes each);
leave: true removes this tab at once. Optional canvas carries a pointer
with both x and y in canvas coordinates (absolute value at most 1000000),
and selection, at most 8 unique Page block or canvas item IDs matching
^[a-zA-Z0-9_-]{1,80}$. An empty canvas counts as none; omit it after
leaving Canvas. These fields share the same read authorization and TTL. A
client cannot name itself or choose a colour.
Response 200: peers, the other people on this document, one entry per
person however many tabs they have open (never the caller, nor the caller’s
other tabs), each with tabs (how many of that person’s tabs are present),
client and anchor/head of the tab whose caret or Canvas presence moved last (a tab sharing either is preferred to one without), user_id, name (the member’s display
name, or Workspace member when they have none; never an email), color (an index the server assigns per document,
different for each person while free colours remain, kept while they stay) and
anchor/head and canvas when that tab shares them; plus the caller’s own color, ttl_ms and
interval_ms. Statuses: 200 heartbeat recorded; 400 invalid request; 401
invalid credential; 403 agent credential or missing scope; 404 document
unavailable or read access gone (every tab of the caller on this document is
removed at the same time); 429 too many tabs on the document (at most 64, and
8 per person); 503 Docs disabled. A revoked session or CLI token, a suspended
account, an ended membership, a role or access change and a deleted workspace
remove the person’s tabs at once; a revoked Page grant removes them on their
next heartbeat, which is refused. A person who can still read reappears with
their next heartbeat. Responses use Cache-Control: no-store.
CLI: crewship doc presence <page-slug>.
Page read and list responses include has_document, which identifies saved native
document content. They also include has_slides and slides_schema: saved Slides
content is reported even for an unknown schema, so a viewer can refuse unsupported
content explicitly. Pages without a saved deck return false and 0. The list also carries artifact_kind
(project, word or sheet) for a Page with a version head and artifact_shared_version
for the version shared with readers; both are omitted otherwise. The latest version is not
in the list: a reader sees only the shared version, and the artifact read decides who sees more. Page creation accepts allow_empty: true to stage a human-owned
Page without panels; combining this flag with panels or a crew owner is refused.
Saved documents from a chat
GET /api/v1/chats/{chatId}/document-results returns a results array of up to
20 saved Document links, newest first. Each result includes page_id,
type: "document", page_slug, title, the creation revision, created_at,
agent_id, agent_name, run_id and on_behalf_of_user_id. The creation
revision is zero; it does not claim to be the document’s current revision.
This is a human read. Scoped CLI credentials require pages:read, and both chat
access and the current Page ACL apply. Hidden results are omitted without a
hidden count. Results contain no document contents, transcript or execution
credentials. A missing or inaccessible chat returns 404; invalid credentials
return 401, missing CLI scope returns 403, and disabled Documents return 503.
Completed and recovered runs retain their saved links for authorized readers.
Saved Document chat previews clear their displayed content and result titles on page.deleted. A failed refresh cannot restore that deleted result from the earlier cached or pending response.
Personal Documents view
When Documents are enabled, My space in Artifacts shows the current user’s private Documents within the existing workspace. It does not create another workspace. Custody access to another user’s private output belongs to the workspace OWNER and remains a separate audited access path. Authorized Page index rows include the read-only booleanprivate_audience. A personal view requires both private_audience: true and the current user’s owner reference; an unfiled Page or an ownership reference alone does not establish privacy. Existing crewship page list --format json output exposes this classification. Missing audience information is unknown, rather than permission to infer that a Page is public.
The index accepts audience=personal for explicitly private Pages owned by the current human, or audience=all for the existing authorized catalog. OWNER custody of other people’s private Pages is excluded from the personal view. Unknown audience values return 400. X-Total-Count counts only authorized rows matching the audience. Catalog responses use Cache-Control: no-store; foreign private metadata requires the existing OWNER audit before its release, and an unavailable audit refuses the response.
Optional limit and offset apply after authorization and audience filtering. The default limit is 100 when either paging parameter is present, the maximum is 500, and negative offsets become zero. With neither paging parameter the existing unpaged JSON array is preserved. crewship api request GET /api/v1/pages --query audience=personal --query limit=20 --format json requests a personal catalog page.
The same index supports literal case-insensitive q search over names and slugs;
kind=project|dashboard|page|docs|word|sheet|slides|design (docs is a structured
Docs document, has_document without an artifact_kind; word is native Word
only, artifact_kind: word), access=private|open,
version=shared|unshared|unversioned, and canonical owner=user/ID|crew/slug|me
facets. Repeat a facet or separate values with commas for OR; different facets
are combined with AND. folder selects an exact slug or ~unfiled. empty=exclude|only|include
selects Pages with nothing to open yet (no typed kind, no Word, Sheet or Slides
storage and no panels); omitted includes them.
sort=updated|name|kind keeps the index order (most recent update, then slug)
for ties, so every window is deterministic. Invalid facet values return 400.
Filters and the X-Total-Count are evaluated only over authorized rows before
paging; filtering a shared Project’s kind cannot reveal its private latest kind.
OWNER custody reads audit every private candidate consumed by these predicates,
including when the filter or page window returns nothing. Classification,
counting and the existing audit postconditions share one transaction; an
unavailable audit releases neither rows nor a count. Audience, Test and Archive
visibility are applied before selecting those audit candidates.
The response remains an array. These filters do not expose lease or comment
queue state, or change Page access.
The private-chat document composer shows the target personal space and its audience before submission. This view and label do not publish a Document, change its audience, enable shared-chat creation, or provide a work-folder sharing operation.
Artifact project creation
Theartifact_projects workspace feature is enabled by default. A workspace
override (crewship feature-flag disable artifact_projects) or the instance
default (PATCH /api/v1/feature-flags/artifact_projects) can turn it off; the
routes then answer 404 and availability reports {"enabled": false}. Setting
CREWSHIP_ARTIFACT_PROJECTS_ENABLED=true on the server forces it on for every
workspace. Page creation authority and existing workspace policy apply when it
is enabled.
GET /api/v1/pages/artifacts/availability
Auth: authenticated workspace member; CLI credentials requirepages:read.
Request: no body. Select the workspace with workspace_id or X-Workspace-ID.
Optional agent_id scopes the answer to that agent’s crew.
Response: JSON { "enabled": false }, or true for an enabled workspace.
With agent_id it also carries can_create: false with
"code": "artifact_crew_not_allowed" when the agent is unknown or its crew is
outside the workspace artifact-creation policy, otherwise true for a member
who may create Pages. A send refused for that reason emits a chat error event
with the same code and starts no run.
Statuses: 200 success, 401 invalid authentication, 403 unavailable workspace
or read scope, 500 internal failure. Availability grants no write authority.
CLI: crewship page artifact availability [--agent <id>].
POST /api/v1/pages/artifacts
Auth: authenticated current workspace Page creation authority; CLI credentials requirepages:write. The server determines the human owner.
Request: JSON slug, name, entrypoint, complete files and optional
message. Each file requires string path, content and media_type; empty
content is valid. A new project uses base_version: 0 when supplied. Paths must
be unique, relative and safe. Authored HTML can use stable artifact--prefixed
element IDs for later precise selection; files are preserved as authored.
Response: HTTP 201 JSON { "page_id": "...", "slug": "demo", "version": 1, "url": "/artifacts/<page_id>?workspace_id=..." }. Publish and restore return
the same url form; share returns /artifacts/<page_id>?version=N&workspace_id=...,
which opens that shared version. Older /pages/<slug>?artifact=1[&version=N]
links still open: with the Artifacts library in the web build they redirect to
/artifacts/<page_id> with the same workspace and version, otherwise they open
the Pages project viewer. In a build without the library,
/artifacts/<page_id>[?version=N] goes to /pages/@<page_id>?artifact=1[&version=N]
for a project and to /pages/@<page_id> for every other kind.
The Page is private and the complete version commits atomically. A failure does not acknowledge a version.
Statuses: 201 created, 400 invalid manifest or request, 401 invalid
authentication, 403 missing current authority, 404 disabled feature, 409 occupied
address (code: "artifact_slug_taken"), 413 request/history limit or a workspace
that already holds 100 Pages, 500 internal failure, 503 unavailable durable
storage. Retain the candidate after a refusal. CLI:
crewship page artifact create demo --name "Demo" --file manifest.json.
Artifact project versions
Auth: reads apply the current Page ACL and require CLI
pages:read scope.
Publication requires current pages:write authority and either the human owner
or a human with a live Edit entitlement: an explicit Page write grant or
folder write access, on a Page that is no longer private. The version records
the editor’s own identity. An editor reads only the latest manifest: no
retained history, no version other than the latest, and a quota with
retention: "latest-version-only" and zero usage figures. A read-scoped owner
can read history with can_write: false. Other authorized readers, including
Comment grantees, receive only the shared pin, no private history, and a quota
with retention: "shared-version-only" and zero usage figures.
Request: reads take a Page slug or @page_id, workspace selection and an
optional positive version query. Publication takes the exact positive latest
base_version, entrypoint, complete files and optional message. Every file
requires path, UTF-8 content and media_type; omitted files are absent from
the successor. Existing versions remain retained.
Response: reads return page_id, name, slug, origin, enabled,
can_write, can_share, can_restore, can_send_to_agent, can_comment,
latest_version, shared_version, manifest, versions, quota and
comments, plus artifact_kind: "slides" when the Slides backend is enabled
and the selected manifest is a valid authored deck. can_share, can_restore
and can_send_to_agent are owner capabilities; can_write alone never implies
them. origin ({chat_id,agent_id} or null) is shown only to the owner.
Publication returns {page_id,slug,version,url,actor} and leaves the shared pin
unchanged. It does not retry a conflicting candidate.
Statuses: 200 success; 400 invalid request or version; 401 invalid credential;
403 missing current authority; 404 disabled, missing or inaccessible content;
409 stale publication base (code: "artifact_version_conflict"); 413
publication quota/request limit (code: "artifact_history_quota" for a full
history); 500 internal failure; 503 unavailable durable storage. Keep a refused
candidate locally.
Limits: one version holds 1–256 files and at most 32 MiB of file content; a
path is at most 512 bytes and a media type at most 255; the optional message
is at most 4096 bytes and a create name at most 200. Each project keeps every
version (quota.retention: "keep-all" for the owner) within 256 MiB of history.
Identical file contents are stored once per project, and each version also
counts its manifest, message and attribution. quota.warning turns true at
80 % of limit_bytes. A request body over 36 MiB is refused with 413 before it
is parsed. The CLI reads a manifest file of at most 9 MiB.
CLI: crewship page artifact get demo --version 1,
crewship page artifact versions demo, and
crewship page artifact publish demo --base-version 1 --file manifest.json.
Version-bound artifact project feedback (pilot)
Artifact projects are disabled by default; these workspace routes return404
until enabled.
Restore, share and reply are owner operations (the human owner, or that owner’s
admitted agent run for restore and reply). A human with a Page write grant can
publish and comment on the latest version but cannot restore, share or reply.
A Comment grantee, or a workspace ADMIN/OWNER without a grant, can comment on
the current shared version only. A Read or Produce grantee sees only the shared
pin and cannot comment or mutate.
Restore and share require the exact latest
base_version. A stale base returns
409; keep the candidate and reconcile deliberately. Sharing an existing
retained version does not grant an unrelated workspace member access. Sharing
does end the project’s private audience: from then on the ordinary
Page reach rules decide who opens the shared version (the
owner, a workspace ADMIN/OWNER, grantees and folder access).
A comment names the version its author may see: the latest version for the
owner or an editor, the current shared version for anyone else allowed to
comment. The
selector is one #id (no spaces or combinators) that matches exactly one
element in that HTML file, and quote must still match that element’s text.
text is required, at most 10000 bytes; selector and quote at most 2000.
A stale version or a path absent from that version returns 409
(artifact_version_conflict), a selection that no longer matches returns 409
(artifact_anchor_mismatch), and neither stores a comment.
send_to_agent:true queues a version-bound task; it does not by itself prove
agent delivery, and a Comment grantee’s task never starts the owner’s agent. A normal reply names a newer
retained version; needs_clarification:true may address the original version
without claiming an edit. Readers cannot inspect unpublished reply metadata
or request another private version through the comments endpoint.
Snapshot comments include the required boolean delivery_retryable. It is true
only for the current human owner’s exact pending task on the selected latest
version, with current Page write access and a readable private source chat,
when no delivery message has already been accepted. Shared readers always see
false. Claimed, answered, stale-version and already accepted tasks are not
retryable, including the interval before an accepted message starts its run.
The creation response conservatively returns false until a fresh snapshot read.
Retry rereads this metadata before sending the same saved comment and stable
submission ID through the existing chat admission. It does not create another
comment or grant execution rights. Clients treat an absent field as false;
old cached responses cannot authorize a resend.
All requests use the existing Page authentication and workspace context.
Responses include 400 for invalid input, 401 for missing authentication,
403 for a known reader’s write, and 404 for disabled or inaccessible projects.
Restore quota refusal is 413 and preserves retained versions. Human CLI
commands are page artifact comments, comment, reply, restore and share.
Collaborative Design (disabled by default)
Every route below answers 404 unless Design is enabled: either the server environment variableCREWSHIP_ARTIFACTS_DESIGN_ENABLED=true or the
workspace-scoped artifacts_design feature flag (seeded off). The browser
editor additionally needs the build-time NEXT_PUBLIC_ARTIFACTS_DESIGN=true.
The flag enables standard Yjs sync and awareness.
Slugs and immutable @page_id references use existing workspace Page grants.
Nodes have stable IDs and types frame, rect, text or image. Live content
is separate from retained snapshots; awareness is transient and never grants
write permission. CLI equivalents are under crewship page design.
Request bodies are closed JSON objects: unknown fields, duplicate keys, null
values and trailing JSON are rejected with 400. A body over the route limit
(8 KiB for create, snapshot, restore, share and agent; 20,000 bytes for a
comment; 4 MiB for operations) is rejected with 413. Every Yjs step runs in a
short-lived Node subprocess with a 5-second timeout; a missing node binary or
a timeout answers 503 and nothing is acknowledged.
Persistence. Each Design Page has one live Yjs head of at most 4 MiB
encoded. An accepted websocket update is written to that live head immediately.
Every successful operations or restore call also commits a new retained
version in the same transaction. Websocket edits become a retained version
through an explicit snapshot or, while an editor’s socket is open, through an
automatic snapshot (message Automatic Design checkpoint) once the live head
has been unchanged for about 10 seconds. Retained history uses the shared
artifact history quota (256 MiB per Page); exceeding it answers 413 and keeps
existing versions.
POST /api/v1/pages/design
Auth: authenticated human with current Page creation permission and CLI
pages:write scope; an agent run cannot create a Design. Request: JSON
{slug,name,created_by_test?} and workspace selection; name is required and
at most 200 bytes. Response: HTTP 201 {page_id,slug,version} for an empty
Design Page and its initial retained version. Statuses: 201 created, 400
invalid input, 401 unauthenticated, 403 missing authority, 404 disabled, 409
occupied slug, 413 body too large or the workspace already has 100 Pages, 500
persistence failure, 503 unavailable engine.
GET /api/v1/pages/{slug}/design
Auth: current Page read access and CLI pages:read scope. Request: no
body; optional positive version selects a retained snapshot. Editors may read
history; shared-only readers may select only the shared pin. Without version,
Edit authority or the separately audited administrative read path exposes the
live canvas; shared-only readers still receive the shared snapshot. Response: {page_id,nodes,order,can_edit, can_share,can_comment,version,latest_version,shared_version,authority_revision,actor,origin}.
can_share is true only for the Page’s owner with write rights, the same rule
the share endpoint enforces; Edit and workspace roles do not qualify.
authority_revision is an opaque string; a fresh authorized read establishes
a new connection after rights change. origin is null unless available to
the authorized editor. When version is supplied, the current
handler reports the selected snapshot in both version and latest_version;
use GET .../design/versions for the latest retained version. Statuses:
200 success, 400 invalid version, 401 unauthenticated, 403 invalid scope, 404 disabled or missing
accessible content, 500 internal failure, 503 unavailable engine.
POST /api/v1/pages/{slug}/design/operations
Auth: current Page Edit permission and CLI pages:write; agents additionally
need their original live run and exact selected-Page mandate. Request:
{operations:[...],message?}. An upsert has {op:"upsert",node:{id,...}}; delete
has {op:"delete",id}; reorder has {op:"reorder",order:[ids]}. Partial upserts
preserve other fields. New nodes need type and finite geometry; supported string
fields are name, parentId, fill, text and src. Any other node field is
rejected. Geometry (x, y, width, height) must be numbers within
±1,000,000 and sizes must not be negative. String limits are id and
parentId 128, type 16, name 2,000, fill 256, text 100,000 and src
2,000,000 characters. Reorder replaces the whole order and may name only
existing nodes; delete also removes the node from the order. One request
carries 1–500 operations, and the result may hold at most 2,000 nodes, 4,000
order entries and 4 MiB of encoded Yjs state; breaking these engine limits is a
400, not a 413. A message is at most 4,096 bytes. Response: committed
{nodes,order,version}. Works without an open browser. Statuses: 200 success,
400 invalid update, 401 unauthenticated, 403 no current Edit authority, 404
unavailable Page, 409 concurrent head, 413 body over 4 MiB or history quota,
500 persistence failure, 503 engine unavailable. Failed publication preserves
the previous live head.
POST /api/v1/pages/{slug}/design/snapshots
Auth: current Page Edit and CLI pages:write; agents need their exact live
mandate. Request: {message?}. Response: retained {version,actor}
receipt; no change to the shared pin. Statuses: 200 success, 400 invalid
request, 401 unauthenticated, 403 no Edit authority, 404 unavailable Page, 409
concurrent head, 413 capacity, 500 persistence failure, 503 engine unavailable.
GET /api/v1/pages/{slug}/design/versions
Auth: current Page read and CLI pages:read. Request: no body.
Response: {versions,latest_version,shared_version}. Editors receive retained
history; readers receive only their authorized shared snapshot. Statuses:
200 success, 401 unauthenticated, 403 invalid scope, 404 unavailable Page or
shared content, 500 internal failure.
GET /api/v1/pages/{slug}/design/export
Auth: current Page read access and CLI pages:read scope, decided exactly
as for GET .../design: current Edit authority (a browser session, or a CLI
credential that also carries pages:write) and workspace OWNER/ADMIN readers
(also with pages:read alone) may export any retained version; shared-only
callers, including Read and Comment audiences and owners or Edit grantees
narrowed to pages:read, only the shared version. Request: no body; optional format (only html) and
optional positive version. Without version an editor exports the latest
retained version and a shared-only reader the shared version; the live canvas
is never exported. Response: text/html; charset=utf-8 attachment named
<slug>-design-v<N>.html, with X-Crewship-Design-Version: <N> and the
policy default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandbox.
The file is one HTML document with every screen as a section, absolutely
positioned layers, escaped text, raster data: images embedded and other
image sources left out, prototype links as <a href="#screen-N"> and no
script. The title and heading carry the Design’s current name; otherwise the
output depends only on the version, so the same version under the same name
always exports to the same bytes. A workspace
OWNER/ADMIN’s export of someone else’s Design is audited as
design.workspace_admin_accessed with operation export. Statuses: 200
success, 400 invalid version, unsupported format or unknown parameter, 401
unauthenticated, 403 invalid scope, 404 disabled, missing or unauthorized
version (the same answer as GET .../design), 413 file over 8 MiB (code
design_export_limit), 500 internal failure, 503 unavailable engine.
POST /api/v1/pages/{slug}/design/restore
Auth: current Page Edit and CLI pages:write; an agent also needs its exact
live mandate. Request: {version} for a positive retained snapshot.
Response: new retained {version,actor} receipt. Restore changes the live
canvas, preserves history and leaves the shared pin unchanged. Statuses:
200 success, 400 invalid request, 401 unauthenticated, 403 no Edit authority,
404 unavailable snapshot, 409 concurrent head, 413 capacity, 500 persistence
failure, 503 engine unavailable.
GET /api/v1/pages/{slug}/design/comments
Auth: current Page read and CLI pages:read. Request: no body.
Response: {comments:[...]} with exact version, stable node selector,
quoted text, feedback, task status and authorized replies, oldest first and at
most 500 comments. Readers see only feedback and replies for the shared pin.
Statuses: 200 success, 401
unauthenticated, 403 invalid scope, 404 unavailable Page, 500 internal failure.
POST /api/v1/pages/{slug}/design/comments
Auth: current Page feedback authority and CLI pages:write; Read and Produce
never grant comment permission. Request: {version,path:"design.json", selector,quote,text,send_to_agent}. The selector is a stable node ID of at most
128 bytes; an optional empty quote skips matching, otherwise the quote (at most
2,000 bytes) must equal the node’s text or name. text is required,
non-blank and at most 10,000 bytes. version must equal the
latest retained version, and the node and quote are checked against it, never
unsaved live state. Canonical Comment grants
allow feedback when that shared grant feature is installed; send_to_agent
additionally requires Edit. Response: HTTP 201 stored comment and
optional pending task. Queuing is not proof of agent delivery. Statuses:
201 created, 400 invalid input, 401 unauthenticated, 403 missing feedback
permission, 404 unavailable Page, 409 stale version or changed node, 500 internal
failure, 503 engine unavailable.
POST /api/v1/pages/{slug}/design/share
Auth: current human Page owner and CLI pages:write. Request: positive
retained {version}. Response: {version,shared_version}. Existing Page
grants remain in force; this operation never grants an unrelated caller access.
Statuses: 200 success, 400 invalid request, 401 unauthenticated, 403 not the
current owner, 404 unavailable snapshot, 409 concurrent head, 500 persistence
failure.
POST /api/v1/pages/{slug}/design/agent
Auth: current human Page owner and CLI pages:write. Request: {chat_id}
for an existing private chat owned by that same human in this workspace.
Response: {origin:{chat_id,agent_id}}. This informational origin never
replaces a fresh message intent and exact live-run mandate. Statuses:
200 success, 400 invalid request, 401 unauthenticated, 403 invalid owner/chat,
404 unavailable Page, 500 persistence failure.
GET /api/v1/pages/{slug}/design/ws
Auth: authenticated current Page reader with same-origin browser
credentials or CLI pages:read; every update additionally checks current Edit
permission under the database writer fence. A browser Origin header must
match the request host. Request: WebSocket upgrade; optional
authority_revision query parameter from the latest GET .../design must
still match the workspace authority revision or the upgrade is refused with
403. Binary standard y-protocols sync and awareness messages only, at most
4 MiB per frame; a text frame closes the socket. Response: HTTP 101
followed by standard binary frames. Editors receive a sync step 1 on connect.
Read clients may send presence and sync requests, never document updates. The
host replaces user.name and user.id in awareness state with the
authenticated actor, and allows one awareness client ID per connection. The
server pings every 20 seconds and closes a socket that answers no ping
within 60 seconds or whose outbound queue overflows. Authority is rechecked every 2
seconds and before each delivered frame; revocation blocks writes and stops
content delivery on the old socket. Statuses: 101 upgraded, 400 malformed
upgrade, 401 unauthenticated, 403 invalid origin or scope, 404 unavailable Page,
500 internal failure, 503 engine unavailable. Invalid protocol messages or
revoked authority close the socket with code 1008.
Dashboard JSON collections (disabled by default)
These routes require bothartifact_projects and artifact_dashboard_data.
Select the workspace with workspace_id; {slug} also accepts @page_id.
A project code manifest declares up to 32 unique collections with
dashboard.json: {"schema_version":1,"collections":["sales"]}. Collection and
document IDs are 1–128 ASCII letters, digits, _ or -, starting with a letter
or digit. value is a JSON object. Each document response includes id,
version, value, updated_at, source_label and source_kind; private
account and run IDs are omitted for every reader, including owners.
Authority: reads require current Page read access and pages:read scope.
Owners may select retained code versions. Other readers must select the current
shared pin and can read only collections declared there. Pin selection,
declaration and current ACL are checked together in the data transaction and
again before commit. Writes require the owner, a human with a current Edit share or inherited folder
write access, or an admitted owner-consented agent run with the exact Page
mandate. Scoped CLI credentials also require pages:write.
The supplied base_version must still be the latest code version. Clients
cannot set attribution or timestamps.
Concurrency: ifVersion:0 creates a new document; otherwise it must equal
the current document version. Counters are exact integers no greater than
9007199254740991. A conflict rolls back the entire batch. Data changes do not
publish code versions, change shared pins or append comment versions. Restoring
code preserves the independently mutable datasets.
Limits: 256 KiB JSON per document; 50 writes / 1 MiB per batch; 4096 documents
and 8 MiB stored JSON per collection; 32 collections per Page. GET responses are
bounded at 16 MiB, including metadata. Duplicate keys, case aliases of transport
fields, invalid UTF-8 and excessive nesting fail closed. JSON scalar numbers in
values are carried without conversion through floating point.
Statuses: 200 success; 400 invalid body or version; 401 unauthenticated;
403 current write authority denied; 404 disabled, inaccessible, missing or
undeclared collection; 409 stale document/code base or shared pin; 413 byte/count
limit; 500 internal failure; 503 durable transaction unavailable. Existing data
is retained after a rejection. A collection is created by its first successful
batch; there is no delete operation.
CLI commands are crewship page artifact data collections, data get and
data batch. Original-run MCP tools are artifact_data_collections,
artifact_data_read and artifact_data_batch.
Dashboard producer runs
A producer records each refresh of a collection as a run. A run never writes
data or changes a code version; the producer writes with the batch route
between start and finish. Batches are not staged: each applies immediately,
so readers may see values of a run that is still going or that failed.
idempotency_key is 1–128 letters, digits, ., _, : or -, scoped to
the collection and starting code version. The
producer and the finisher are authenticated principals stored on the server;
the request cannot supply them, and responses project them as started_by
and finished_by (You, Contributor, Agent or Former contributor).
Data generation: a collection’s generation is the sum of its document
versions. Documents are never deleted, so it only grows. The batch route
returns it as generation, and a run records it as start_generation. A
success must name as data_generation the current generation returned by
the producer’s last batch linked by run_id. Both linked writes and success
require the starting code version; if it changes, a writer can still mark
the old run failed using the latest version declaring the collection. A success over unchanged data
must set unchanged: true with the start generation; unchanged over
changed data is refused; unchanged is the producer’s claim, which the
server checks only against writes made during the run. A success is also
refused while another run of the collection is running, or after one failed
with changed data while this run was going (artifact_data_run_overlap;
the response lists them in blocking_runs, and the list route returns every
running run as active_runs to the owner and editors, so any writer can find
and abandon a run whose producer died). Retention can keep the newest such partial failure
as evidence while a run it blocks is still going. A
failure carries neither field. A failed run whose generation moved (by it or
another writer) is reported as partial.
Authentication and authority: start and finish require exactly the
authority of a data batch for a human caller (the owner or a current Edit
share), pages:write scope, and a base_version equal to
the latest code version that declares the collection. The list route requires
the authority of a data read and returns only collections the selected version
declares. Only the producer that started a run can finish it as succeeded;
any writer can finish it as failed, and the finisher is recorded. A run that
is never finished stays running; there is no server timeout and a running
run is never pruned (clients show it as stalled after the list route’s
stalled_after_seconds, 30 minutes by default). Agent runs on the artifact tool path cannot record runs yet.
failure_reason is returned to the owner and editors only, never to a reader or
an auditing workspace administrator. A failure
reason is cleaned on the server: control and invisible characters are removed,
common credential patterns are redacted (bearer and basic credentials,
key=value, key: value, key => value and key is value secrets, PEM
private key blocks, JWTs, Crewship, GitHub, GitLab, Google, AWS and other
provider tokens, URL user info), and it is cut to 500 bytes. Redaction is
pattern based, not a guarantee.
Limits (configurable server defaults, not contract): at most 4 running
runs per collection (CREWSHIP_ARTIFACT_DATA_RUNS_ACTIVE); the newest 20
finished runs plus the newest success are kept
(CREWSHIP_ARTIFACT_DATA_RUNS_KEPT), and a running run is never pruned
whatever the limit; the stalled threshold is
CREWSHIP_ARTIFACT_DATA_RUN_STALLED_AFTER (TTL below:
CREWSHIP_ARTIFACT_DATA_RUN_KEY_TTL); the
key of a finished run stays reserved until 24 hours pass or the run is pruned,
whichever comes first, while the key of a running run never expires.
Statuses: 200 success or idempotent replay; 201 run created; 400 invalid
body, key, state, version, or a success without data_generation; 401
unauthenticated; 403 write authority denied, or a success by a writer that did
not start the run (artifact_data_run_forbidden); 404 disabled,
inaccessible, undeclared collection or unknown run (including a run of
another Page or workspace); 409 stale code base, a key owned by another
producer, a finish whose outcome differs from the stored one
(artifact_data_run_conflict), a success whose generation is not current or
whose unchanged claim does not match (artifact_data_run_generation), a
success that overlaps another running or partly failed run
(artifact_data_run_overlap), or
too many running runs (artifact_data_run_busy); 413 storage quota; 500
internal failure; 503 durable transaction unavailable.
CLI commands are crewship page artifact data runs start, runs finish and
runs list. There is no MCP tool; agents use the CLI.
Artifact kind metadata
Page lists and authenticated detail responses includeartifact_kind for a
versioned artifact (project, dashboard, slides, word, sheet, design) and
artifact_shared_version when a shared pin exists. Dashboard classification
requires the enabled Dashboard data backend and a valid bounded dashboard.json
declaration in the selected code manifest. The current human owner uses latest
code; other Page readers use only the current shared pin. A private latest
Dashboard therefore does not change the kind shown to a shared Project reader.
No artifact kind is inferred from Page names or addresses. Classification does
not change the artifact’s version storage, data authority or editor profile.
The same responses carry artifact_profile, read from the file names of the
same selected manifest (never from file content, never from a name):
An interactive project is therefore an App, not a Dashboard, in the list, the
kind catalog filter and the detail. The kind filter and sort=kind treat a
design system as design, as the library shows it, while its artifact_kind
stays project. The profile is derived in the catalog query itself, so listing
does not load manifests. Whether its scripts may run is still
decided by the interactive runtime switches, not by the profile.
Authored Slides and PDF export
Theartifact_slides workspace flag is disabled by default and requires
artifact_projects. CREWSHIP_ARTIFACT_SLIDES_ENABLED=true enables the backend
explicitly; the separate build-time UI flag is NEXT_PUBLIC_ARTIFACT_SLIDES=true.
The existing artifact VersionStore and CommentQueue retain code, sharing pins,
restores and anchored comments. No native Slides editor or storage is created.
Both operations require an explicit canonical positive version at most
9007199254740991. Owners can select retained code versions; readers can select
only the current shared version. Current Page credentials, workspace rights,
run consent, feature flags, selection mode and selected source bytes are checked
again after parsing, rendering and response encoding, before delivery. Missing
or private reader pins return 404. Unsupported source and text overflow return
422; resource caps return 413. Failed exports never return a partial PDF.
The closed authoring profile uses
deck.json with
{"schema_version":1,"order":["intro"]} and exactly the referenced
slides/intro.html files. Each authored slide has a matching section ID and
stable element IDs. The projection uses the existing schema-1 1920×1080 deck,
fixed embedded Go Regular font, text, rectangle, ellipse and table elements.
Scripts, external assets, imported PDFs and supplied fonts are unsupported.
The bounds are 100 slides, 200 elements per slide, 1000 elements total and
2 MiB of source. Selected snapshots emit artifact_kind:"slides" only after
full profile validation. Page list/detail classification reads only the bounded
selected index and manifest references; invalid or ambiguous source retains
ordinary Project metadata and cannot authorize a Slides preview.
Original signed-run tools artifact_slides_read and artifact_export_pdf take
only {slug:"@pageID",version:N} and retain the exact original human/run Page
mandate. Requests remain bounded to 1 MiB. The PDF tool returns
{media_type:"application/pdf",encoding:"base64",code_version,byte_length,sha256,data};
only these two tools allow the bounded 32 MiB outer response. A caller-local CLI
output path is never forwarded to the host.