Files
Docwell/api/openapi.yaml
T
tajniak81andClaude Opus 5.5 5e1dcf4291 Add real-time collaboration with page history
Pages are now shared Yjs documents. docwell-server relays the y-websocket
protocol at /collab (token sent as the first message), flushes updates to
page_yupdates every second, and compacts them into page_ydoc with yrs
compiled to WebAssembly under wazero (ADR-3) after 30 s idle or when the
last editor leaves. Compaction refreshes content_json/content_text and
records page_versions; versions can be listed, previewed and restored.

The editor connects through a small y-protocols provider with carets and
presence. Pages saved before this change are seeded from content_json.
The yrs module lives in Server/ycrdt-wasm and is built by go generate,
CI and the Dockerfiles rather than committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:52:55 +01:00

1113 lines
38 KiB
YAML

openapi: 3.1.0
info:
title: Docwell API
version: 0.0.1
license:
name: AGPL-3.0-or-later
identifier: AGPL-3.0-or-later
description: |
Public API of docwell-server. This file is the source of truth: the Go
handlers and the TypeScript and Dart clients are generated from it.
servers:
- url: http://localhost:8080
paths:
/healthz:
get:
operationId: getHealth
summary: Liveness probe
responses:
"200":
description: Server process is up
content:
application/json:
schema: { $ref: "#/components/schemas/Status" }
/readyz:
get:
operationId: getReadiness
summary: Readiness probe (checks the database)
responses:
"200":
description: Ready
content:
application/json:
schema: { $ref: "#/components/schemas/Status" }
"503":
description: A dependency is unavailable
content:
application/json:
schema: { $ref: "#/components/schemas/Status" }
/api/v1/version:
get:
operationId: getVersion
summary: Server name and version
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Version" }
/api/v1/auth/methods:
get:
operationId: getAuthMethods
tags: [auth]
summary: Enabled sign-in methods
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AuthMethods" }
/api/v1/auth/signup:
post:
operationId: signup
tags: [auth]
summary: Create an account and sign in (the first account becomes the instance admin)
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/SignupRequest" }
responses:
"200": { $ref: "#/components/responses/Session" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/auth/login:
post:
operationId: login
tags: [auth]
summary: Sign in with email and password
description: Returns 401 with error "mfa_required" and an mfaId when a second factor is needed.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/LoginRequest" }
responses:
"200": { $ref: "#/components/responses/Session" }
"401": { $ref: "#/components/responses/Error" }
/api/v1/auth/otp/request:
post:
operationId: requestOtp
tags: [auth]
summary: Email a one-time sign-in code
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/EmailRequest" }
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
required: [otpId]
properties:
otpId: { type: string }
/api/v1/auth/otp/login:
post:
operationId: loginWithOtp
tags: [auth]
summary: Sign in with an emailed one-time code
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [otpId, code]
properties:
otpId: { type: string }
code: { type: string }
mfaId: { type: string }
responses:
"200": { $ref: "#/components/responses/Session" }
"401": { $ref: "#/components/responses/Error" }
/api/v1/auth/refresh:
post:
operationId: refreshSession
tags: [auth]
summary: Exchange a valid token for a new one
security: [{ bearer: [] }]
responses:
"200": { $ref: "#/components/responses/Session" }
"401": { $ref: "#/components/responses/Error" }
/api/v1/auth/me:
get:
operationId: getMe
tags: [auth]
summary: The signed-in user
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/User" }
"401": { $ref: "#/components/responses/Error" }
/api/v1/auth/password-reset/request:
post:
operationId: requestPasswordReset
tags: [auth]
summary: Email a password reset link (succeeds for unknown emails too)
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/EmailRequest" }
responses:
"204": { description: Sent }
/api/v1/auth/password-reset/confirm:
post:
operationId: confirmPasswordReset
tags: [auth]
summary: Set a new password with the emailed token
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [token, password]
properties:
token: { type: string }
password: { type: string, minLength: 8 }
responses:
"204": { description: Password changed }
"400": { $ref: "#/components/responses/Error" }
/api/v1/auth/verification/request:
post:
operationId: requestVerification
tags: [auth]
summary: Email an address verification link
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/EmailRequest" }
responses:
"204": { description: Sent }
/api/v1/auth/verification/confirm:
post:
operationId: confirmVerification
tags: [auth]
summary: Confirm an email address with the emailed token
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [token]
properties:
token: { type: string }
responses:
"204": { description: Verified }
"400": { $ref: "#/components/responses/Error" }
# Rights cascade: superadmin (every organization) > admin (own organization)
# > user. Org admins and superadmins own every workspace in their scope;
# other users get their workspace membership role.
/api/v1/users:
get:
operationId: listUsers
tags: [users]
summary: List users (superadmin - everyone; admin - own organization)
security: [{ bearer: [] }]
parameters:
- { name: page, in: query, schema: { type: integer, minimum: 1 } }
- { name: perPage, in: query, schema: { type: integer, minimum: 1, maximum: 200 } }
- { name: q, in: query, description: Search in email and name, schema: { type: string } }
- { name: organization, in: query, description: "Superadmin only: an organization id, or 'none'", schema: { type: string } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/UserList" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
post:
operationId: createUser
tags: [users]
summary: Create a user (admins - in their own organization, never a superadmin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CreateUserRequest" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/User" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/users/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateUser
tags: [users]
summary: Edit a user. Nobody changes their own role; only superadmins move users between organizations.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/UpdateUserRequest" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/User" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteUser
tags: [users]
summary: Delete a user (never your own account)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/orgs:
get:
operationId: listOrgs
tags: [organizations]
summary: List organizations (superadmin - all; admin - own)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Organization" } }
"403": { $ref: "#/components/responses/Error" }
post:
operationId: createOrg
tags: [organizations]
summary: Create an organization. A user without one becomes its admin; a superadmin stays unattached.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/NameRequest" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Organization" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/orgs/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: renameOrg
tags: [organizations]
summary: Rename an organization (superadmin - any; admin - own)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/NameRequest" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Organization" }
"403": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteOrg
tags: [organizations]
summary: >-
Delete an organization without workspaces or (other) members. An admin
deleting their own is detached and demoted to user.
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/workspaces:
get:
operationId: listWorkspaces
tags: [workspaces]
summary: Workspaces the caller can open, with their effective role
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Workspace" } }
post:
operationId: createWorkspace
tags: [workspaces]
summary: Create a workspace (org admins - own organization; superadmins - name one)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string }
organization: { type: string }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Workspace" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: renameWorkspace
tags: [workspaces]
summary: Rename a workspace (workspace admin or above)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/NameRequest" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Workspace" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteWorkspace
tags: [workspaces]
summary: Delete a workspace with its spaces and pages (owner)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/members:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listWorkspaceMembers
tags: [workspaces]
summary: Explicit members (org admins and superadmins have access without being listed)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/WorkspaceMember" } }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: setWorkspaceMember
tags: [workspaces]
summary: >-
Add a user of the same organization or change their role. Workspace
admins grant roles up to their own and never change someone ranked above them.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email, role]
properties:
email: { type: string, format: email }
role: { $ref: "#/components/schemas/WorkspaceRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WorkspaceMember" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/members/{userId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: userId, in: path, required: true, schema: { type: string } }
delete:
operationId: removeWorkspaceMember
tags: [workspaces]
summary: Remove a member (anyone may leave)
security: [{ bearer: [] }]
responses:
"204": { description: Removed }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/spaces:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listSpaces
tags: [spaces]
summary: Spaces of a workspace the caller can open, with their effective space role
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Space" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createSpace
tags: [spaces]
summary: Create a space (workspace admin or above)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string, maxLength: 120 }
description: { type: string, maxLength: 1000 }
icon: { type: string, maxLength: 32 }
visibility: { $ref: "#/components/schemas/SpaceVisibility" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Space" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getSpace
tags: [spaces]
summary: One space with the caller's space role
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Space" }
"404": { $ref: "#/components/responses/Error" }
patch:
operationId: updateSpace
tags: [spaces]
summary: Change a space's settings (space admin); only the fields sent change
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string, maxLength: 120 }
description: { type: string, maxLength: 1000 }
icon: { type: string, maxLength: 32 }
visibility: { $ref: "#/components/schemas/SpaceVisibility" }
defaultRole: { $ref: "#/components/schemas/SpaceDefaultRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Space" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteSpace
tags: [spaces]
summary: Delete a space with all of its pages (workspace admin or above)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/members:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listSpaceMembers
tags: [spaces]
summary: Explicit space members (workspace admins manage every space without being listed)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/SpaceMember" } }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: setSpaceMember
tags: [spaces]
summary: Add a workspace member to the space or change their role (space admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email, role]
properties:
email: { type: string, format: email }
role: { $ref: "#/components/schemas/SpaceRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/SpaceMember" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/members/{userId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: userId, in: path, required: true, schema: { type: string } }
delete:
operationId: removeSpaceMember
tags: [spaces]
summary: Remove a space member (space admin; anyone may leave)
security: [{ bearer: [] }]
responses:
"204": { description: Removed }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/pages:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listPages
tags: [pages]
summary: >-
The space's live page tree as a flat list in depth-first order, siblings
sorted by position. Pages in the trash, and everything under them, are left out.
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/PageNode" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createPage
tags: [pages]
summary: Create a page (editor)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
parent: { type: string, description: Parent page id; empty or missing for the top level }
title: { type: string, maxLength: 500 }
index: { type: integer, minimum: 0, description: Position among the parent's children; missing appends }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/trash:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listTrash
tags: [pages]
summary: Trashed pages, newest first (pages inside a trashed page come back with it)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/TrashedPage" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getPage
tags: [pages]
summary: One page with its breadcrumbs and the caller's space role
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"404": { $ref: "#/components/responses/Error" }
patch:
operationId: updatePage
tags: [pages]
summary: Rename a page or change its icon (editor)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title: { type: string, maxLength: 500 }
icon: { type: string, maxLength: 32 }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deletePage
tags: [pages]
summary: >-
Move a page and its subtree to the trash (editor). With permanent=true,
delete a page that is already in the trash for good (space admin).
security: [{ bearer: [] }]
parameters:
- { name: permanent, in: query, schema: { type: boolean } }
responses:
"204": { description: Deleted }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/content:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getPageContent
tags: [pages]
summary: >-
The page's document as Tiptap JSON (null for a page that was never edited).
Editors sync the live document over the WebSocket at /collab instead
(y-websocket protocol; send the session token as the first, text, message).
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageContent" }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: savePageContent
tags: [pages]
summary: >-
Replace the page's document (editor). The change is applied as an edit
to the live document, so open editors see it at once.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [content]
properties:
content: { type: object, additionalProperties: true, description: 'Tiptap JSON with type "doc"' }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageContent" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/versions:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listPageVersions
tags: [pages]
summary: >-
The page's history, newest first. A version is recorded at most every
10 minutes while people edit, and when the last editor leaves.
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/PageVersion" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/versions/{versionId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: versionId, in: path, required: true, schema: { type: string } }
get:
operationId: getPageVersion
tags: [pages]
summary: One version's document
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageContent" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/versions/{versionId}/restore:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: versionId, in: path, required: true, schema: { type: string } }
post:
operationId: restorePageVersion
tags: [pages]
summary: >-
Make an old version the page's document again (editor). It is applied as
a new edit, so open editors update live and the current text stays in the history.
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageContent" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/move:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: movePage
tags: [pages]
summary: Move a page with its subtree within its space (editor)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [index]
properties:
parent: { type: string, description: New parent page id; empty for the top level }
index: { type: integer, minimum: 0, description: Position among the new parent's other children }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/restore:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: restorePage
tags: [pages]
summary: Take a page out of the trash (editor); it goes to the top level if its parent is gone
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
components:
securitySchemes:
bearer:
type: http
scheme: bearer
description: PocketBase auth token returned by login, signup and refresh.
responses:
Session:
description: Signed in
content:
application/json:
schema: { $ref: "#/components/schemas/Session" }
Error:
description: Error
content:
application/json:
schema: { $ref: "#/components/schemas/Error" }
schemas:
Error:
type: object
required: [error]
properties:
error:
type: string
description: >-
invalid_json, validation, invalid_credentials, mfa_required, unauthorized,
forbidden, account_disabled, signup_disabled, domain_not_allowed, invalid_token,
invalid, not_found, conflict, internal
message: { type: string, description: Human-readable explanation }
fields:
type: object
additionalProperties: { type: string }
mfaId: { type: string }
Role:
type: string
enum: [user, admin, superadmin]
description: Instance role. admin manages their own organization; superadmin manages everything.
WorkspaceRole:
type: string
enum: [owner, admin, member, guest]
User:
type: object
required: [id, email, name, avatar, locale, theme, status, verified, created, role, organization, organizationName]
properties:
id: { type: string }
email: { type: string, format: email }
name: { type: string }
avatar: { type: string }
locale: { type: string }
theme: { type: string }
status: { type: string, enum: [active, invited, disabled] }
verified: { type: boolean }
created: { type: string }
role: { $ref: "#/components/schemas/Role" }
organization: { type: string, description: Organization id, empty when none }
organizationName: { type: string }
CreateUserRequest:
type: object
required: [email, password, name]
properties:
email: { type: string, format: email }
password: { type: string, minLength: 8 }
name: { type: string }
role: { $ref: "#/components/schemas/Role" }
organization: { type: string, description: Superadmins only; admins always create in their own }
UpdateUserRequest:
type: object
properties:
email: { type: string, format: email }
name: { type: string }
role: { $ref: "#/components/schemas/Role" }
password: { type: string, minLength: 8 }
status: { type: string, enum: [active, invited, disabled] }
verified: { type: boolean }
organization: { type: string, description: Superadmins only; empty string detaches }
NameRequest:
type: object
required: [name]
properties:
name: { type: string, maxLength: 120 }
Organization:
type: object
required: [id, name, created, members, workspaces]
properties:
id: { type: string }
name: { type: string }
created: { type: string }
members: { type: integer }
workspaces: { type: integer }
Workspace:
type: object
required: [id, name, slug, organization, organizationName, role, created]
properties:
id: { type: string }
name: { type: string }
slug: { type: string }
organization: { type: string }
organizationName: { type: string }
role: { $ref: "#/components/schemas/WorkspaceRole" }
created: { type: string }
WorkspaceMember:
type: object
required: [user, role]
properties:
user:
type: object
required: [id, email, name]
properties:
id: { type: string }
email: { type: string }
name: { type: string }
role: { $ref: "#/components/schemas/WorkspaceRole" }
SpaceRole:
type: string
enum: [admin, editor, commenter, viewer]
SpaceDefaultRole:
type: string
enum: [editor, commenter, viewer]
description: Role that workspace members (not guests) get in an open space without an explicit role.
SpaceVisibility:
type: string
enum: [open, private]
description: open - every workspace member gets the default role; private - explicit members only.
Space:
type: object
required: [id, workspace, name, slug, icon, description, visibility, defaultRole, role, created]
properties:
id: { type: string }
workspace: { type: string }
name: { type: string }
slug: { type: string }
icon: { type: string }
description: { type: string }
visibility: { $ref: "#/components/schemas/SpaceVisibility" }
defaultRole: { $ref: "#/components/schemas/SpaceDefaultRole" }
role: { $ref: "#/components/schemas/SpaceRole" }
created: { type: string }
SpaceMember:
type: object
required: [user, role]
properties:
user:
type: object
required: [id, email, name]
properties:
id: { type: string }
email: { type: string }
name: { type: string }
role: { $ref: "#/components/schemas/SpaceRole" }
PageNode:
type: object
required: [id, parent, title, icon, position, updated]
properties:
id: { type: string }
parent: { type: string, description: Parent page id; empty at the top level }
title: { type: string }
icon: { type: string }
position: { type: string, description: Fractional sort key among siblings }
updated: { type: string }
PageRef:
type: object
required: [id, title, icon]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
Page:
type: object
required: [id, workspace, space, parent, title, icon, created, updated, deletedAt, inTrash, ancestors, role]
properties:
id: { type: string }
workspace: { type: string }
space: { type: string }
parent: { type: string }
title: { type: string }
icon: { type: string }
created: { type: string }
updated: { type: string }
deletedAt: { type: string, description: When the page itself was trashed; empty otherwise }
inTrash: { type: boolean, description: The page or one of its ancestors is in the trash }
ancestors: { type: array, items: { $ref: "#/components/schemas/PageRef" }, description: Root first }
role: { $ref: "#/components/schemas/SpaceRole" }
PageContent:
type: object
required: [content, updated]
properties:
content:
oneOf: [{ type: object, additionalProperties: true }, { type: "null" }]
description: Tiptap JSON with type "doc"; null for a page that was never edited
updated: { type: string }
PageVersion:
type: object
required: [id, author, label, created]
properties:
id: { type: string }
author: { type: string, description: Name (or email) of the last person who edited before it was taken }
label: { type: string }
created: { type: string }
TrashedPage:
type: object
required: [id, title, icon, deletedAt]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
deletedAt: { type: string }
Session:
type: object
required: [token, user]
properties:
token: { type: string }
user: { $ref: "#/components/schemas/User" }
UserList:
type: object
required: [items, page, perPage, totalItems]
properties:
items: { type: array, items: { $ref: "#/components/schemas/User" } }
page: { type: integer }
perPage: { type: integer }
totalItems: { type: integer }
AuthMethods:
type: object
required: [password, otp, mfa, oauth2, signup]
properties:
password: { type: boolean }
otp: { type: boolean }
mfa: { type: boolean }
oauth2: { type: array, items: { type: string } }
signup: { type: boolean }
SignupRequest:
type: object
required: [email, password, name]
properties:
email: { type: string, format: email }
password: { type: string, minLength: 8 }
name: { type: string }
LoginRequest:
type: object
required: [email, password]
properties:
email: { type: string, format: email }
password: { type: string }
mfaId: { type: string }
EmailRequest:
type: object
required: [email]
properties:
email: { type: string, format: email }
Status:
type: object
required: [status]
properties:
status: { type: string, enum: [ok, unavailable] }
db: { type: string }
Version:
type: object
required: [name, version]
properties:
name: { type: string }
version: { type: string }