Files
Docwell/api/openapi.yaml
T
tajniak81andClaude Opus 5.5 c98b127f1e
CI / go (Media) (push) Successful in 13m40s
CI / go (Server) (push) Failing after 23m20s
CI / go (Web-App) (push) Canceled after 0s
CI / frontend (push) Failing after 10m35s
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / desktop (ubuntu-latest) (push) Failing after 3h4m42s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
CI / mobile (push) Failing after 9m19s
CI / docker (push) Successful in 2h2m57s
Add columns, suggesting mode, verified pages, scanned PDF search and server translations
- Columns: /columns puts 2 to 4 columns side by side, with widths dragged
  between them; they stack on phones. HTML export and import keep them
  (also Notion column lists and Confluence page layouts).
- Suggesting mode: edits become suggested insertions and deletions that
  editors accept or reject one by one or all at once. Text only.
- Verified pages: editors verify a page for a while or without end; the
  verifier is notified when it runs out (migration 1764700000).
- Scanned PDFs attached to pages are read by AI for search where a
  workspace turns it on.
- The server writes error messages, emails, digests and phone
  notifications in English, Polish, German, French and Spanish; the apps
  send their language with each request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:38:08 +01:00

5768 lines
222 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/totp/verify:
post:
operationId: verifyTotp
tags: [auth]
summary: Finish signing in with an authenticator code or a recovery code
description: Sign-in answers 401 totp_required with a challenge for accounts with two-step sign-in on; send it here with a code.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [challenge, code]
properties:
challenge: { type: string }
code: { type: string, description: 6 digits from the app, or a recovery code }
responses:
"200": { $ref: "#/components/responses/Session" }
"400": { $ref: "#/components/responses/Error" }
/api/v1/auth/oauth2/start:
post:
operationId: startOAuth
tags: [auth]
summary: Begin signing in with an OAuth2 / OpenID Connect provider
description: Send the browser to url; the provider comes back to redirect with code and state.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [provider, redirect]
properties:
provider: { type: string, description: A name from AuthMethods.providers }
redirect: { type: string, description: The web app's /oauth/callback, or docwell://oauth/callback }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/OAuthStart" }
"400": { $ref: "#/components/responses/Error" }
/api/v1/auth/oauth2/finish:
post:
operationId: finishOAuth
tags: [auth]
summary: Finish signing in with the code and state from the provider
description: New accounts follow the sign-up rules; may answer totp_required like other sign-ins.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [state, code]
properties:
state: { type: string }
code: { type: string }
responses:
"200": { $ref: "#/components/responses/Session" }
"400": { $ref: "#/components/responses/Error" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/me/totp:
get:
operationId: getTotpStatus
tags: [account]
summary: Whether the caller signs in with an authenticator app
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/TotpStatus" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/me/totp/setup:
post:
operationId: setupTotp
tags: [account]
summary: Create a secret for an authenticator app (confirm it with enable)
description: Not with API tokens.
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/TotpSetup" }
"400": { $ref: "#/components/responses/Error" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/me/totp/enable:
post:
operationId: enableTotp
tags: [account]
summary: Turn two-step sign-in on with a first code; returns the recovery codes (shown once)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [code]
properties:
code: { type: string }
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
required: [recoveryCodes]
properties:
recoveryCodes: { type: array, items: { type: string } }
"400": { $ref: "#/components/responses/Error" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/me/totp/disable:
post:
operationId: disableTotp
tags: [account]
summary: Turn two-step sign-in off with a current code or a recovery code
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [code]
properties:
code: { type: string }
responses:
"204": { description: Off }
"400": { $ref: "#/components/responses/Error" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/me/tokens:
get:
operationId: listApiTokens
tags: [account]
summary: The caller's API tokens
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/ApiToken" } }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
post:
operationId: createApiToken
tags: [account]
summary: Create an API token; the token itself is returned only now
description: >-
Send it as "Authorization: Bearer dw_…". It acts as you with your rights; read tokens can only make GET
requests. Tokens cannot manage tokens or two-step sign-in.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, scope]
properties:
name: { type: string, maxLength: 100 }
scope: { type: string, enum: [read, write] }
expiresDays: { type: integer, minimum: 0, maximum: 3650, description: 0 never expires }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/NewApiToken" }
"400": { $ref: "#/components/responses/Error" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/me/tokens/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
delete:
operationId: revokeApiToken
tags: [account]
summary: Revoke one of the caller's API tokens
security: [{ bearer: [] }]
responses:
"204": { description: Revoked }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/me/devices:
get:
operationId: listDevices
tags: [auth]
summary: The caller's phones registered for push notifications, newest first
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/PushDevice" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: registerDevice
tags: [auth]
summary: Register a phone for push notifications (UnifiedPush)
description: >-
endpoint is the address the phone's UnifiedPush distributor (ntfy, NextPush, …) gave the app.
For each notification docwell-server POSTs a PushMessage there, encrypted to the app's
Web Push keys (RFC 8291, aes128gcm). Registering the
same endpoint again updates it. Endpoints that answer 404 or 410 are forgotten. A person
keeps up to 10 phones; registering an 11th drops the oldest.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [endpoint, p256dh, auth]
properties:
endpoint: { type: string, maxLength: 1000 }
p256dh: { type: string, description: The app's P-256 public key, uncompressed, base64url }
auth: { type: string, description: The app's 16-byte auth secret, base64url }
name: { type: string, maxLength: 100, description: e.g. the phone's model }
responses:
"201":
description: Registered
content:
application/json:
schema: { $ref: "#/components/schemas/PushDevice" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/me/devices/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
delete:
operationId: removeDevice
tags: [auth]
summary: Stop push notifications to one of the caller's phones
security: [{ bearer: [] }]
responses:
"204": { description: Removed }
"404": { $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}/snapshot:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: exportWorkspaceSnapshot
tags: [workspaces]
summary: Download a snapshot of the workspace that restores 1:1 (workspace admin or above)
description: >-
One zip: snapshot.json (the workspace's settings, spaces, pages and their place in the
tree, tags, properties, shared collections, comments and the attachments' details),
pages/<id>.ydoc (each page's Yjs state), pages/<id>.json (the same document as JSON)
and files/<id> (each attachment). It holds what the caller can open: other people's
journals and pages hidden from the caller are left out, as are trashed pages. Members,
page sharing, share links, webhooks, AI settings and page history are not included.
security: [{ bearer: [] }]
responses:
"200":
description: The zip, streamed as it is built
content:
application/zip:
schema: { type: string, format: binary }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/restore:
post:
operationId: restoreWorkspaceSnapshot
tags: [workspaces]
summary: Make a new workspace from a snapshot (organization admin or superadmin)
description: >-
Every record gets a new id and old ids are replaced wherever they appear (links,
mentions, embedded pages, database relations, property values, collection rules), so
a snapshot can be restored next to its original. Pages come back from their Yjs state,
so comments stay anchored to their text. People named in the snapshot keep their
comments and collections when they exist on this server; everything else is the
caller's. On any error nothing is left behind. Up to 4 GB.
security: [{ bearer: [] }]
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file: { type: string, format: binary }
name: { type: string, description: The new workspace's name; empty keeps the snapshot's }
organization: { type: string, description: Organization id (required for superadmins) }
responses:
"201":
description: The new workspace
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: updateWorkspace
tags: [workspaces]
summary: Rename a workspace, change how its new pages open, or its sharing switches (workspace admin or above)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string, maxLength: 120 }
defaultPageMode: { $ref: "#/components/schemas/PageMode" }
allowSharing: { type: boolean, description: Off turns every share link of the workspace off until it is on again }
urlPreview: { type: boolean, description: "Let chat apps show private pages' titles in link previews" }
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/spaces/{id}/archive:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listArchive
tags: [pages]
summary: Archived pages, newest first (pages inside an archived page come back with it)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/ArchivedPage" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/pinned:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listPinned
tags: [pages]
summary: Pages pinned to the space's home, in the order they were pinned
description: Pinned pages in the trash or the archive are left out until they are restored.
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/PinnedPage" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/export:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: exportSpace
tags: [pages]
summary: Download the whole space as a zip of Markdown or HTML files
description: >-
One file per page the caller can open (archived pages included, trashed ones not),
subpages in a folder named like their parent, an index file, and the pages'
attachments under _files/. Links between exported pages and to attachments are
relative, so the folder works offline; links to other pages point at DOCWELL_PUBLIC_URL.
security: [{ bearer: [] }]
parameters:
- { name: format, in: query, schema: { type: string, enum: [markdown, html], default: markdown } }
responses:
"200":
description: The zip, streamed as it is built
content:
application/zip:
schema: { type: string, format: binary }
"400": { $ref: "#/components/responses/Error" }
"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, change its icon, layout, tags or properties, or make it a template (editor)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title: { type: string, maxLength: 500 }
icon: { type: string, maxLength: 32 }
isTemplate: { type: boolean, description: Offer the page as a template for new pages }
fullWidth: { type: boolean, description: Use the whole window instead of the reading column }
font: { $ref: "#/components/schemas/PageFont" }
defaultMode: { $ref: "#/components/schemas/PageMode" }
tags: { type: array, items: { type: string }, maxItems: 100, description: "Replaces the page's tags (tag ids)" }
properties:
type: object
additionalProperties: true
description: Sets these custom property values by property id; null clears one
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}/archive:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: archivePage
tags: [pages]
summary: >-
Archive a page with its subtree (editor). Archived pages leave the page tree and
become read-only, but stay readable, searchable and linkable.
security: [{ bearer: [] }]
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}/unarchive:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: unarchivePage
tags: [pages]
summary: Put an archived page back in the tree (editor); it goes to the top level if its parent is gone or archived
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/link-preview:
get:
operationId: previewLink
tags: [pages]
summary: A web page's title, description and picture, for link cards
description: >-
docwell-server fetches the page itself (public addresses only: private, loopback
and link-local ones are refused, redirects included). A page that can't be read
still gets a preview with its address and site name. GitHub issues, pull requests and
repositories, Linear issues and Figma files are read through their APIs and get a kind,
status and details; with workspace set (a workspace the caller belongs to), that
workspace's tokens reach private items.
security: [{ bearer: [] }]
parameters:
- { name: url, in: query, required: true, schema: { type: string, maxLength: 2000 } }
- { name: workspace, in: query, required: false, schema: { type: string } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/LinkPreview" }
"400": { $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" }
/api/v1/settings/public:
get:
operationId: getPublicSettings
tags: [settings]
summary: Branding and signup availability, for signed-out pages
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PublicSettings" }
/api/v1/admin/settings:
get:
operationId: getInstanceSettings
tags: [settings]
summary: Every instance setting (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/InstanceSettings" }
"403": { $ref: "#/components/responses/Error" }
patch:
operationId: updateInstanceSettings
tags: [settings]
summary: Change the sections that are present (superadmin)
description: >-
Mail and storage settings are PocketBase's own. Passwords and secrets are write-only:
leave them out to keep the stored value. Environment variables such as
DOCWELL_SMTP_HOST are applied again when docwell-server starts.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/InstanceSettingsUpdate" }
responses:
"200":
description: Saved
content:
application/json:
schema: { $ref: "#/components/schemas/InstanceSettings" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/settings/test-email:
post:
operationId: sendTestEmail
tags: [settings]
summary: Send a test email with the saved mail settings (superadmin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [to]
properties:
to: { type: string, format: email }
responses:
"204": { description: Sent }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/settings/test-storage:
post:
operationId: testStorage
tags: [settings]
summary: Check that the configured S3 bucket is reachable (superadmin)
security: [{ bearer: [] }]
responses:
"204": { description: Reachable }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/invites:
get:
operationId: listInvites
tags: [invites]
summary: Open invites (one workspace's for its admins; otherwise the organization's or, for superadmins, all)
security: [{ bearer: [] }]
parameters:
- { name: workspace, in: query, schema: { type: string } }
- { name: organization, in: query, description: Superadmins only, schema: { type: string } }
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Invite" } }
"403": { $ref: "#/components/responses/Error" }
post:
operationId: createInvite
tags: [invites]
summary: Invite someone by email
description: >-
Organization invites follow the rules for creating users; workspace invites need
workspace admin. Someone who already has an account in the workspace's organization
is added directly (status "added"). The response carries the link, so it can be passed
on when mail is not configured (mailed false).
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CreateInviteRequest" }
responses:
"201":
description: Invited
content:
application/json:
schema: { $ref: "#/components/schemas/Invite" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/invites/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
delete:
operationId: revokeInvite
tags: [invites]
summary: Revoke an open invite
security: [{ bearer: [] }]
responses:
"204": { description: Revoked }
"404": { $ref: "#/components/responses/Error" }
/api/v1/invites/{id}/resend:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: resendInvite
tags: [invites]
summary: Email a new link (the old one stops working)
security: [{ bearer: [] }]
responses:
"200":
description: Sent
content:
application/json:
schema: { $ref: "#/components/schemas/Invite" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/auth/invites/{token}:
parameters:
- { name: token, in: path, required: true, schema: { type: string } }
get:
operationId: getInviteInfo
tags: [auth]
summary: Describe an open invite to whoever holds its token
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/InviteInfo" }
"400": { $ref: "#/components/responses/Error" }
/api/v1/auth/invites/accept:
post:
operationId: acceptInvite
tags: [auth]
summary: Accept an invite
description: >-
Signed out, this creates the account (name and password required) and signs it in.
Signed in, it attaches the current account, which must own the invited email and
have no other organization.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [token]
properties:
token: { type: string }
name: { type: string }
password: { type: string, minLength: 8 }
responses:
"200": { $ref: "#/components/responses/Session" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/users/{id}/password-reset:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: sendPasswordReset
tags: [users]
summary: Email the user a password-reset link
security: [{ bearer: [] }]
responses:
"204": { description: Sent }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
# Groups hold some of a workspace's members; spaces grant roles to groups
# like to people, and a member gets the highest of the two.
/api/v1/workspaces/{id}/groups:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listGroups
tags: [groups]
summary: A workspace's groups (members and above)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Group" } }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createGroup
tags: [groups]
summary: Create a group (workspace admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/GroupRequest" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Group" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/groups/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateGroup
tags: [groups]
summary: Rename a group or change its description (workspace admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/GroupRequest" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Group" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteGroup
tags: [groups]
summary: Delete a group and its space grants (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/groups/{id}/members:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listGroupMembers
tags: [groups]
summary: A group's members
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/MemberUser" } }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: addGroupMember
tags: [groups]
summary: Add a workspace member to a group by email (workspace admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/EmailRequest" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/MemberUser" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/groups/{id}/members/{userId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: userId, in: path, required: true, schema: { type: string } }
delete:
operationId: removeGroupMember
tags: [groups]
summary: Remove someone from a group (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Removed }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/groups:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listSpaceGroups
tags: [spaces]
summary: Groups with a role in the space
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/SpaceGroup" } }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: setSpaceGroup
tags: [spaces]
summary: Grant a group a role in the space (space admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [group, role]
properties:
group: { type: string }
role: { $ref: "#/components/schemas/SpaceRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/SpaceGroup" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/groups/{groupId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: groupId, in: path, required: true, schema: { type: string } }
delete:
operationId: removeSpaceGroup
tags: [spaces]
summary: Take a group's role in the space away (space admin)
security: [{ bearer: [] }]
responses:
"204": { description: Removed }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/favorites:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listFavorites
tags: [pages]
summary: The caller's favorite pages in the workspace, newest first
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/PageItem" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/recent:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listRecentPages
tags: [pages]
summary: Pages the caller visited last in the workspace
security: [{ bearer: [] }]
parameters:
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 50 } }
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/PageItem" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/favorite:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
put:
operationId: addFavorite
tags: [pages]
summary: Add the page to the caller's favorites
security: [{ bearer: [] }]
responses:
"204": { description: Added }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: removeFavorite
tags: [pages]
summary: Remove the page from the caller's favorites
security: [{ bearer: [] }]
responses:
"204": { description: Removed }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/pin:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
put:
operationId: pinPage
tags: [pages]
summary: Pin the page to its space's home for everyone (editor; at most 12 per space)
security: [{ bearer: [] }]
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: unpinPage
tags: [pages]
summary: Take the page off its space's home (editor)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/verify:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
put:
operationId: verifyPage
tags: [pages]
summary: Verify the page as the caller, for some days or without end (editor)
description: Verifying again replaces the earlier verification. When it runs out, the caller gets a verify_expired notification.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/VerifyPage" }
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: unverifyPage
tags: [pages]
summary: Take the page's verification off (editor)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Page" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/visit:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: recordPageVisit
tags: [pages]
summary: Note that the caller opened the page (for the recent list)
security: [{ bearer: [] }]
responses:
"204": { description: Recorded }
"404": { $ref: "#/components/responses/Error" }
# Files attached to pages. Documents refer to them by url (/api/v1/files/{id}).
/api/v1/pages/{id}/attachments:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listAttachments
tags: [files]
summary: The page's files, oldest first
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Attachment" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: uploadAttachment
tags: [files]
summary: Upload a file to the page (editor)
description: The size limit is DOCWELL_MAX_UPLOAD_MB (default 50).
security: [{ bearer: [] }]
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file: { type: string, format: binary }
responses:
"201":
description: Uploaded
content:
application/json:
schema: { $ref: "#/components/schemas/Attachment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/attachments/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
delete:
operationId: deleteAttachment
tags: [files]
summary: Delete a file (editor of its page)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/files/token:
post:
operationId: createFileToken
tags: [files]
summary: A short-lived token for file links (?token=), which cannot carry the Authorization header
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
required: [token, expires]
properties:
token: { type: string }
expires: { type: string, format: date-time }
"401": { $ref: "#/components/responses/Error" }
/api/v1/files/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: downloadFile
tags: [files]
summary: Download a file (anyone who can read its page)
description: >-
Authenticate with the bearer token or ?token= (a file token). Images, PDFs, audio
and video are served inline; everything else as a download.
security: [{ bearer: [] }, {}]
parameters:
- { name: token, in: query, schema: { type: string } }
responses:
"200":
description: The file
content:
application/octet-stream:
schema: { type: string, format: binary }
"401": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/search:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: searchPages
tags: [search]
summary: Full-text search of page titles and text, in the spaces the caller can open
description: >-
Trashed pages are not found. The index catches up with edits within a few seconds.
The filters narrow the results; with an empty q and at least one filter, the
matching pages are listed, most recently changed first. A space the caller cannot
open finds nothing.
security: [{ bearer: [] }]
parameters:
- { name: q, in: query, required: true, schema: { type: string, maxLength: 200 } }
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 50 } }
- { name: space, in: query, description: Only pages in this space, schema: { type: string } }
- { name: tag, in: query, description: Only pages with this tag, schema: { type: string } }
- { name: author, in: query, description: Only pages this user created or last edited, schema: { type: string } }
- name: updatedAfter
in: query
description: Only pages changed at or after this time (RFC 3339) or day (YYYY-MM-DD)
schema: { type: string }
- name: updatedBefore
in: query
description: Only pages changed at or before this time (RFC 3339) or the end of this day (YYYY-MM-DD)
schema: { type: string }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/SearchResult" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/export:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: exportPage
tags: [pages]
summary: Download the page as Markdown, HTML, PDF or Word
description: >-
Attachment links point at DOCWELL_PUBLIC_URL and need a file token to open.
PDFs are A4 with a bookmark per heading; images stored on the page are drawn in,
diagrams become a link to their file and Mermaid charts show their source.
Word files (docx) embed the page's images the same way and keep headings, lists,
to-dos, callouts, tables, colours and alignment in a form Docwell imports back.
security: [{ bearer: [] }]
parameters:
- { name: format, in: query, schema: { type: string, enum: [markdown, html, pdf, docx], default: markdown } }
responses:
"200":
description: The file
content:
text/markdown:
schema: { type: string }
text/html:
schema: { type: string }
application/pdf:
schema: { type: string, format: binary }
application/vnd.openxmlformats-officedocument.wordprocessingml.document:
schema: { type: string, format: binary }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/spaces/{id}/import:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: importPages
tags: [pages]
summary: Create pages from Markdown, HTML, Word, CSV, OneNote, Notion, Obsidian or Bear files (editor)
description: >-
One page per Markdown, HTML or Word file (.md, .markdown, .txt, .html, .htm up to
5 MB; .docx up to 25 MB). A leading level-1 heading (a Word title) becomes the title,
otherwise the file name. A .csv (up to 5 MB) becomes a page with a database, or, when
it is a Readwise export, a "Readwise" page with a page of highlights per book. A .mht or
.mhtml web archive (up to 100 MB; OneNote's "Single File Web Page" export) becomes a page
per page it holds, with its images. A .zip (up to 100 MB) is read as a Notion export
(Markdown & CSV or HTML; each database becomes a page listing its rows with the row pages
under it) or as a folder of Markdown notes: an Obsidian vault, Bear TextBundles, or any
Markdown with its images, Docwell's own space export included. Folders become pages
(a note named like its folder is that page), [[wikilinks]] and ![[embeds]] are found by
name, YAML front matter becomes properties (made when missing) and tags, and #tags are
added to the page's tags. A Bear backup (.bear2bk) is read the same way. Page trees,
links between pages, images and files are kept. At most 20 files and 2000 pages at once.
Content is reduced to what the editor supports; scripts and styles are dropped. The
response lists the pages created at the parent's level.
security: [{ bearer: [] }]
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file: { type: array, items: { type: string, format: binary } }
parent: { type: string, description: Parent page id; empty for the top level }
responses:
"201":
description: The pages created at the parent's level (subpages of a Notion export are under them)
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Page" } }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
# Page-level permissions: grants to people and groups, and restricted pages.
/api/v1/pages/{id}/access:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getPageAccess
tags: [sharing]
summary: Who has access to the page beyond the space's members (viewer)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"404": { $ref: "#/components/responses/Error" }
patch:
operationId: setPageRestricted
tags: [sharing]
summary: Restrict the page and its subpages to the people it is shared with, or lift that (editor)
description: Space admins always keep access. An editor who restricts a page keeps editor on it through a grant.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [restricted]
properties:
restricted: { type: boolean }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/access/users:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
put:
operationId: sharePageWithUser
tags: [sharing]
summary: Share the page and its subpages with someone by email (editor)
description: >-
A workspace member gets the role on the page. Someone from the workspace's organization who is not
in the workspace joins it as a guest. Anyone else is invited as a guest (workspace members only).
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email, role]
properties:
email: { type: string, format: email }
role: { $ref: "#/components/schemas/PageGrantRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/SharePageResult" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/access/users/{userId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: userId, in: path, required: true, schema: { type: string } }
delete:
operationId: unsharePageWithUser
tags: [sharing]
summary: Remove someone's grant on the page (editor, or the person themselves)
security: [{ bearer: [] }]
responses:
"200":
description: The page's access afterwards
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/access/groups/{groupId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: groupId, in: path, required: true, schema: { type: string } }
put:
operationId: sharePageWithGroup
tags: [sharing]
summary: Share the page and its subpages with a group of the workspace (editor)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [role]
properties:
role: { $ref: "#/components/schemas/PageGrantRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: unsharePageWithGroup
tags: [sharing]
summary: Remove a group's grant on the page (editor)
security: [{ bearer: [] }]
responses:
"200":
description: The page's access afterwards
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
# Public share links: read access for anyone with the link.
/api/v1/pages/{id}/share:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getShareLink
tags: [sharing]
summary: The page's public link (404 when sharing is off)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/ShareLink" }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: setShareLink
tags: [sharing]
summary: Turn the public link on, or change what it covers (editor)
description: An existing link keeps its URL.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
includeSubpages: { type: boolean }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/ShareLink" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteShareLink
tags: [sharing]
summary: Turn the public link off; its URL stops working (editor)
security: [{ bearer: [] }]
responses:
"204": { description: Off }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/share/{token}:
parameters:
- { name: token, in: path, required: true, schema: { type: string } }
get:
operationId: getSharedPage
tags: [sharing]
summary: Read a shared page (no account needed)
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/SharedPage" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/share/{token}/pages/{pageId}:
parameters:
- { name: token, in: path, required: true, schema: { type: string } }
- { name: pageId, in: path, required: true, schema: { type: string } }
get:
operationId: getSharedSubpage
tags: [sharing]
summary: Read a page under the shared page, when the link includes subpages
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/SharedPage" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/share/{token}/files/{fileId}:
parameters:
- { name: token, in: path, required: true, schema: { type: string } }
- { name: fileId, in: path, required: true, schema: { type: string } }
get:
operationId: downloadSharedFile
tags: [sharing]
summary: Download an attachment of a page readable through the link
responses:
"200":
description: The file
content:
application/octet-stream:
schema: { type: string, format: binary }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/invite-link:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getInviteLink
tags: [sharing]
summary: The workspace's invite link (404 when it has none; workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/InviteLink" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: setInviteLink
tags: [sharing]
summary: Create or change the invite link (workspace admin)
description: An existing link keeps its URL unless reset is true.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
role: { type: string, enum: [member, guest], description: Default member }
approval: { type: boolean, description: Joining needs an admin's approval }
expiresInDays:
type: integer
minimum: 0
maximum: 365
description: Days from now; 0 means the link does not expire
reset: { type: boolean, description: Make a new URL; the old one stops working }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/InviteLink" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteInviteLink
tags: [sharing]
summary: Turn the invite link off; its URL stops working (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Off }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/join-requests:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listJoinRequests
tags: [sharing]
summary: Requests to join through the invite link that wait for a decision (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: Oldest first
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/JoinRequest" } }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/join-requests/{requestId}/approve:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: requestId, in: path, required: true, schema: { type: string } }
post:
operationId: approveJoinRequest
tags: [sharing]
summary: Let the person in and tell them (workspace admin)
security: [{ bearer: [] }]
requestBody:
content:
application/json:
schema:
type: object
properties:
role: { $ref: "#/components/schemas/WorkspaceRole", description: Overrides the link's role }
responses:
"204": { description: Approved }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/join-requests/{requestId}/decline:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: requestId, in: path, required: true, schema: { type: string } }
post:
operationId: declineJoinRequest
tags: [sharing]
summary: Turn the request down and tell the person (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Declined }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/auth/join/{token}:
parameters:
- { name: token, in: path, required: true, schema: { type: string } }
get:
operationId: getJoinInfo
tags: [sharing]
summary: Describe an invite link (no account needed; status is filled in when signed in)
security: [{}, { bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/JoinInfo" }
"401": { $ref: "#/components/responses/Error" }
post:
operationId: joinWorkspace
tags: [sharing]
summary: Join through an invite link, or ask to when it needs approval
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/JoinResult" }
"401": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/analytics:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: days, in: query, schema: { type: integer, minimum: 7, maximum: 90, default: 30 } }
get:
operationId: getPageAnalytics
tags: [sharing]
summary: How often and by whom the page was opened (editor)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageAnalytics" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/unused-files:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listUnusedFiles
tags: [files]
summary: Files no page of the workspace uses any more (workspace admin)
description: >-
A file is in use when a page's current document (trashed pages included), a page icon or a comment refers
to it. Files uploaded in the last 24 hours are never listed. Old page versions are not searched.
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/UnusedFiles" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/unused-files/delete:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: deleteUnusedFiles
tags: [files]
summary: Delete unused files (workspace admin)
description: Deletes the listed files, or every unused file when ids is empty. Files that came into use since are kept.
security: [{ bearer: [] }]
requestBody:
content:
application/json:
schema:
type: object
properties:
ids: { type: array, items: { type: string } }
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
required: [deleted]
properties:
deleted: { type: integer }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/previews/pages/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getPagePreview
tags: [sharing]
summary: Title of a private page for chat apps' link previews (only when the workspace turned URL previews on)
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PagePreview" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/previews/share/{token}:
parameters:
- { name: token, in: path, required: true, schema: { type: string } }
- { name: page, in: query, description: A page under the shared one, schema: { type: string } }
get:
operationId: getSharePreview
tags: [sharing]
summary: Title and opening text of a page reached through a share link, for link previews
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PagePreview" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/people:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listPeople
tags: [workspaces]
summary: Find people in the workspace by name or email (for mentions; any member)
security: [{ bearer: [] }]
parameters:
- { name: q, in: query, schema: { type: string } }
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 50 } }
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/MemberUser" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/comments:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listComments
tags: [comments]
summary: The page's comments and replies, oldest first (threads are the ones without a parent)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Comment" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createComment
tags: [comments]
summary: Start a thread on the page, or reply to one (commenter)
description: The author starts watching the page. Watchers, the thread's people and mentioned people are notified.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [body]
properties:
body: { type: string, maxLength: 5000 }
quote: { type: string, maxLength: 500, description: The commented text (threads only) }
anchor:
type: object
additionalProperties: true
description: The editor's encoding of the commented range, opaque to the server (threads only)
parent: { type: string, description: The thread to reply to }
mentions: { type: array, items: { type: string }, description: Ids of the people mentioned in body }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Comment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/comments/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateComment
tags: [comments]
summary: Change a comment's text (its author)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [body]
properties:
body: { type: string, maxLength: 5000 }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Comment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteComment
tags: [comments]
summary: Delete a comment, and a thread's replies with it (its author, or a space admin)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/comments/{id}/resolve:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: resolveComment
tags: [comments]
summary: Resolve a thread, or open it again (commenter)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [resolved]
properties:
resolved: { type: boolean }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Comment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/comments/{id}/reactions:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: reactToComment
tags: [comments]
summary: Add or remove the caller's emoji reaction (commenter)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [emoji, on]
properties:
emoji: { type: string, maxLength: 32 }
on: { type: boolean }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Comment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/backlinks:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listBacklinks
tags: [pages]
summary: The pages the caller can open that link to this one
security: [{ bearer: [] }]
responses:
"200":
description: OK (at is when the linking page last changed)
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/PageItem" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/apply-template:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: applyTemplate
tags: [pages]
summary: Replace the page's content with a template's (editor)
description: An untitled page also takes the template's title and icon. The change is a history version, so restoring undoes it.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [template]
properties:
template: { type: string, description: A template page of the same workspace }
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/workspaces/{id}/properties:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listProperties
tags: [organize]
summary: The workspace's custom page properties, in order
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Property" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createProperty
tags: [organize]
summary: Add a custom page property to the workspace (members)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PropertyInput" }
responses:
"200":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Property" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/properties/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateProperty
tags: [organize]
summary: Rename a property, change its type, options, visibility or place (members)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PropertyInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Property" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteProperty
tags: [organize]
summary: Remove a property; pages' values for it are ignored from then on (members)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/tags:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listTags
tags: [organize]
summary: The workspace's tags by name, with how many live pages use each
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Tag" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createTag
tags: [organize]
summary: Add a tag (members); names are unique in the workspace, ignoring case
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/TagInput" }
responses:
"200":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Tag" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/tags/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateTag
tags: [organize]
summary: Rename or recolour a tag (members)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/TagInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Tag" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteTag
tags: [organize]
summary: Take a tag off every page and delete it (members)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/tags/{id}/merge:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: mergeTag
tags: [organize]
summary: Move every page from this tag to another one, then delete this one (members)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [into]
properties:
into: { type: string, description: The tag that stays }
responses:
"200":
description: The tag that stays
content:
application/json:
schema: { $ref: "#/components/schemas/Tag" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/docs:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listDocs
tags: [organize]
summary: All docs, the workspace's live pages the caller can open with their properties
description: >-
Newest change first. Archived pages, trashed pages and pages in other people's
journals are left out. The query narrows the list; every part is optional.
security: [{ bearer: [] }]
parameters:
- { name: space, in: query, description: Only pages in this space, schema: { type: string } }
- { name: tag, in: query, description: Only pages with this tag, schema: { type: string } }
- { name: collection, in: query, description: Only the pages of this collection, schema: { type: string } }
- { name: filter, in: query, description: A DocFilter as JSON, schema: { type: string } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/DocList" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/collections:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listCollections
tags: [organize]
summary: The caller's own collections and the shared ones, by name
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Collection" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createCollection
tags: [organize]
summary: Save a collection (members)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CollectionInput" }
responses:
"200":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Collection" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/collections/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateCollection
tags: [organize]
summary: Change a collection (its creator; workspace admins for shared ones)
description: Only the creator can change shared.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CollectionInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Collection" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteCollection
tags: [organize]
summary: Delete a collection; its pages stay where they are
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/collections/{id}/pages/{page}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: page, in: path, required: true, schema: { type: string } }
put:
operationId: addCollectionPage
tags: [organize]
summary: Add a page to the collection by hand
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Collection" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: removeCollectionPage
tags: [organize]
summary: Take a page out of the collection, even when its rules match it
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Collection" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/integrations:
get:
operationId: getIntegrations
tags: [integrations]
summary: Which outside services this server can reach for people
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Integrations" }
/api/v1/oauth/{provider}/callback:
parameters:
- { name: provider, in: path, required: true, schema: { type: string, enum: [google, microsoft] } }
get:
operationId: oauthCallback
tags: [integrations]
summary: Where Google and Microsoft send the browser back after a sign-in
description: >-
Register {DOCWELL_PUBLIC_URL}/api/v1/oauth/google/callback and
{DOCWELL_PUBLIC_URL}/api/v1/oauth/microsoft/callback as redirect URIs of the OAuth apps.
The signed state says who signed in and why; the browser is sent on to the web app.
parameters:
- { name: state, in: query, schema: { type: string } }
- { name: code, in: query, schema: { type: string } }
- { name: error, in: query, schema: { type: string } }
responses:
"302": { description: On to the web app }
/api/v1/calendars/google/connect:
get:
operationId: connectGoogleCalendar
tags: [calendars]
summary: Where to send the browser to connect a Google account's calendars (read-only)
description: Needs DOCWELL_GOOGLE_CLIENT_ID and DOCWELL_GOOGLE_CLIENT_SECRET. Afterwards the browser returns to account settings.
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/ConnectURL" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/onenote/connect:
get:
operationId: connectOneNote
tags: [integrations]
summary: Where to send the browser to sign in to Microsoft and import OneNote notebooks into a space
description: Needs DOCWELL_MICROSOFT_CLIENT_ID and DOCWELL_MICROSOFT_CLIENT_SECRET. The browser returns to the space with ?onenote=<connection>.
security: [{ bearer: [] }]
parameters:
- { name: space, in: query, required: true, schema: { type: string } }
- { name: parent, in: query, schema: { type: string } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/ConnectURL" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/onenote/connections/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getOneNoteConnection
tags: [integrations]
summary: The signed-in Microsoft account and its notebooks (a connection lasts an hour)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/OneNoteConnection" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/onenote/connections/{id}/import:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: importOneNoteNotebook
tags: [integrations]
summary: Start importing a notebook into a space (editor); it runs in the background
description: >-
The notebook, its section groups and sections become pages; each OneNote page a page under
its section (subpages under their parent page), with pictures and attached files as
attachments. At most 2000 pages and 512 MB of files.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [notebook, space]
properties:
notebook: { type: string }
space: { type: string }
parent: { type: string }
responses:
"202":
description: Started
content:
application/json:
schema: { $ref: "#/components/schemas/OneNoteJob" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/onenote/jobs/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getOneNoteJob
tags: [integrations]
summary: How a OneNote import is going
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/OneNoteJob" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/readwise:
get:
operationId: getReadwise
tags: [integrations]
summary: The caller's Readwise sync (connected false when there is none)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/ReadwiseConnection" }
put:
operationId: saveReadwise
tags: [integrations]
summary: Connect Readwise, or change where highlights go
description: >-
The token (readwise.io/access_token) is checked with Readwise and sealed. Every hour new
books get a page under a "Readwise" page in the space, and new highlights are added to
the end of their book's page. Choosing another space starts over there.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ReadwiseInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/ReadwiseConnection" }
"400": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteReadwise
tags: [integrations]
summary: Disconnect Readwise (the pages stay)
security: [{ bearer: [] }]
responses:
"204": { description: Disconnected }
"404": { $ref: "#/components/responses/Error" }
/api/v1/readwise/sync:
post:
operationId: syncReadwise
tags: [integrations]
summary: Add new Readwise highlights now
security: [{ bearer: [] }]
responses:
"200":
description: The sync with its result
content:
application/json:
schema: { $ref: "#/components/schemas/ReadwiseConnection" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/calendars:
get:
operationId: listCalendars
tags: [calendars]
summary: The caller's calendar subscriptions (passwords are never returned)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/CalendarAccount" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createCalendar
tags: [calendars]
summary: Subscribe to an iCalendar feed or a CalDAV account (read once first, to check it)
description: >-
kind "ics" reads an .ics or webcal:// address (Google Calendar's secret address in iCal
format, Outlook's published calendar, any feed), with an optional user name and password.
kind "caldav" reads a CalDAV calendar, or every event calendar of the account when the
address is the server or the account's home (Nextcloud, iCloud with an app password,
Fastmail…). Addresses follow the webhook rules: loopback and link-local addresses are
refused unless DOCWELL_WEBHOOKS_ALLOW_LOCAL is on. At most 20 calendars per person.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarAccountInput" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarAccount" }
"400": { $ref: "#/components/responses/Error" }
/api/v1/calendars/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateCalendar
tags: [calendars]
summary: Rename, recolour, turn off or change the address or sign-in of a calendar
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarAccountInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarAccount" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteCalendar
tags: [calendars]
summary: Remove a calendar subscription
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"404": { $ref: "#/components/responses/Error" }
/api/v1/calendars/{id}/refresh:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: refreshCalendar
tags: [calendars]
summary: Read a calendar from its source and store its events now (otherwise every 15 minutes)
security: [{ bearer: [] }]
responses:
"200":
description: The calendar with its new sync time or error
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarAccount" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/calendar/events:
get:
operationId: listCalendarEvents
tags: [calendars]
summary: The caller's events between two days, from their enabled calendars
description: >-
Read from the stored copy the calendars.sync job keeps (every 15 minutes, 90 days back
and 400 days ahead), so it answers at once and still shows events when a source is down.
Repeating events are expanded, changed and cancelled occurrences applied. All-day events
come first.
security: [{ bearer: [] }]
parameters:
- { name: from, in: query, required: true, schema: { type: string, format: date } }
- { name: to, in: query, required: true, description: Inclusive; at most 92 days after from, schema: { type: string, format: date } }
- { name: tz, in: query, description: "IANA time zone the days are in (default UTC)", schema: { type: string } }
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/CalendarEvent" } }
"400": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/journals:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getJournal
tags: [organize]
summary: The caller's journal days in a date range (at most a year), newest first
security: [{ bearer: [] }]
parameters:
- { name: from, in: query, required: true, schema: { type: string, format: date } }
- { name: to, in: query, required: true, schema: { type: string, format: date } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/JournalInfo" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
patch:
operationId: setJournalTemplate
tags: [organize]
summary: Pick the page new journal pages are filled from (empty for none)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [template]
properties:
template: { type: string }
responses:
"200":
description: OK (days is empty)
content:
application/json:
schema: { $ref: "#/components/schemas/JournalInfo" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/journals/{date}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: date, in: path, required: true, schema: { type: string, format: date } }
put:
operationId: openJournal
tags: [organize]
summary: The caller's journal page for a day, made (with the journal space) if there is none yet
description: >-
A new page goes to the top of the journal space, newest day first, and is filled
from the journal template when one is set. The journal space is private to its
owner; workspace admins do not see into it.
security: [{ bearer: [] }]
requestBody:
content:
application/json:
schema:
type: object
properties:
title: { type: string, maxLength: 500, description: Title for a new page; the date when empty }
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/workspaces/{id}/templates:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listTemplates
tags: [pages]
summary: The workspace's template pages the caller can open
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Template" } }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/watch:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getPageWatch
tags: [notifications]
summary: Whether the caller watches the page
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WatchState" }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: setPageWatch
tags: [notifications]
summary: Watch the page, or mute it
description: Muting is remembered, so commenting later does not start watching again.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/WatchState" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WatchState" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/notifications:
get:
operationId: listNotifications
tags: [notifications]
summary: The caller's newest notifications with the unread count
security: [{ bearer: [] }]
parameters:
- { name: unread, in: query, description: Only unread ones, schema: { type: boolean } }
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100 } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationList" }
"401": { $ref: "#/components/responses/Error" }
/api/v1/notifications/read:
post:
operationId: markNotificationsRead
tags: [notifications]
summary: Mark notifications read (the listed ones, or all)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
ids: { type: array, items: { type: string } }
all: { type: boolean }
responses:
"200":
description: The unread count afterwards
content:
application/json:
schema:
type: object
required: [unread]
properties:
unread: { type: integer }
"400": { $ref: "#/components/responses/Error" }
/api/v1/notifications/settings:
get:
operationId: getNotificationSettings
tags: [notifications]
summary: The caller's notification preferences
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationSettings" }
put:
operationId: setNotificationSettings
tags: [notifications]
summary: Change the caller's notification preferences
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationSettings" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationSettings" }
"400": { $ref: "#/components/responses/Error" }
/api/v1/admin/audit:
get:
operationId: listAuditLog
tags: [admin]
summary: The audit log, newest first (superadmin - everything; admin - their organization)
security: [{ bearer: [] }]
parameters:
- { name: q, in: query, description: Matches the action, actor email, target id or IP, schema: { type: string } }
- { name: since, in: query, schema: { type: string } }
- { name: until, in: query, schema: { type: string } }
- { name: page, in: query, schema: { type: integer, minimum: 1 } }
- { name: perPage, in: query, schema: { type: integer, minimum: 1, maximum: 200 } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AuditPage" }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/audit/export:
get:
operationId: exportAuditLog
tags: [admin]
summary: The matching audit log entries as CSV (up to 50 000)
security: [{ bearer: [] }]
parameters:
- { name: q, in: query, schema: { type: string } }
- { name: since, in: query, schema: { type: string } }
- { name: until, in: query, schema: { type: string } }
responses:
"200":
description: CSV
content:
text/csv:
schema: { type: string }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/tokens:
get:
operationId: listAllApiTokens
tags: [admin]
summary: API tokens of the users the caller manages
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/ApiToken" } }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/tokens/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
delete:
operationId: adminRevokeApiToken
tags: [admin]
summary: Revoke someone's API token (a manager of its owner)
security: [{ bearer: [] }]
responses:
"204": { description: Revoked }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/users/{id}/totp:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
delete:
operationId: resetUserTotp
tags: [users]
summary: Turn off someone's two-step sign-in, e.g. after they lost their phone (their manager)
security: [{ bearer: [] }]
responses:
"204": { description: Off }
"401": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/integrations:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getWorkspaceIntegrations
tags: [integrations]
summary: The workspace's integrations (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WorkspaceIntegrations" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/integrations/tokens/{service}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: service, in: path, required: true, schema: { type: string, enum: [github, linear, figma] } }
put:
operationId: setIntegrationToken
tags: [integrations]
summary: Store a token for link previews (workspace admin); an empty token removes it
description: >-
The token is checked with the service first (GitHub /user, Linear viewer, Figma /v1/me), then
sealed. Link previews of members of the workspace use it to read private items.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [token]
properties:
token: { type: string, maxLength: 500 }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WorkspaceIntegrations" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/integrations/slack:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
put:
operationId: setSlackIntegration
tags: [integrations]
summary: Connect or change the workspace's Slack app (workspace admin); missing fields stay as they are
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/SlackIntegrationInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WorkspaceIntegrations" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteSlackIntegration
tags: [integrations]
summary: Disconnect Slack (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WorkspaceIntegrations" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/integrations/slack/test:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: testSlackIntegration
tags: [integrations]
summary: Post a hello to the Slack channel (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Posted }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/slack/{workspace}/events:
parameters:
- { name: workspace, in: path, required: true, schema: { type: string } }
post:
operationId: slackEvents
tags: [integrations]
summary: "Slack's Events API for one workspace's app: the URL check, and link_shared (Docwell link previews)"
description: >-
Called by Slack, signed with the app's Signing Secret (X-Slack-Signature, at most five minutes
old). Only pages every member of the workspace can open get a preview.
requestBody:
required: true
content:
application/json:
schema: { type: object, additionalProperties: true }
responses:
"200": { description: Taken (the URL check answers with its challenge) }
"401": { description: Bad or missing signature }
/api/v1/slack/{workspace}/commands:
parameters:
- { name: workspace, in: path, required: true, schema: { type: string } }
post:
operationId: slackCommands
tags: [integrations]
summary: "The /docwell slash command: a search as the Docwell member with the Slack user's email"
description: Called by Slack, signed like the events. The answer is shown only to the person who asked.
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema: { type: object, additionalProperties: true }
responses:
"200": { description: An ephemeral Slack message }
"401": { description: Bad or missing signature }
/api/v1/workspaces/{id}/webhooks:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listWebhooks
tags: [webhooks]
summary: The workspace's webhooks (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Webhook" } }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createWebhook
tags: [webhooks]
summary: Add a webhook (workspace admin); the response carries its signing secret, shown only now
description: >-
Deliveries are JSON POSTs ({id, event, workspace, created, data}) with headers X-Docwell-Event,
X-Docwell-Delivery and X-Docwell-Signature (sha256=hex HMAC-SHA256 of the body with the secret).
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/WebhookInput" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/Webhook" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/webhooks/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateWebhook
tags: [webhooks]
summary: Change a webhook (workspace admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/WebhookInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Webhook" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteWebhook
tags: [webhooks]
summary: Remove a webhook and its delivery log (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/webhooks/{id}/deliveries:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listWebhookDeliveries
tags: [webhooks]
summary: The webhook's latest deliveries (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/WebhookDelivery" } }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/webhooks/{id}/test:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: testWebhook
tags: [webhooks]
summary: Send a "ping" now and return the delivery (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WebhookDelivery" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/admin/stats:
get:
operationId: getAdminStats
tags: [admin]
summary: Dashboard numbers (superadmin - the instance; admin - their organization)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AdminStats" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/health:
get:
operationId: getAdminHealth
tags: [admin]
summary: Version, uptime and database health (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AdminHealth" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/jobs:
get:
operationId: listJobs
tags: [admin]
summary: Background jobs and how their last run went (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Job" } }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/jobs/{name}/run:
parameters:
- { name: name, in: path, required: true, schema: { type: string } }
post:
operationId: runJob
tags: [admin]
summary: Start a runnable job now (superadmin)
security: [{ bearer: [] }]
responses:
"202": { description: Started }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/admin/backups:
get:
operationId: listBackups
tags: [admin]
summary: Database backups kept by docwell-db (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Backup" } }
"403": { $ref: "#/components/responses/Error" }
post:
operationId: createBackup
tags: [admin]
summary: Write a new backup of the database and its files (superadmin)
description: Answers when the archive is complete, which can take a while on large instances.
security: [{ bearer: [] }]
responses:
"204": { description: Created }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/backups/{key}:
parameters:
- { name: key, in: path, required: true, schema: { type: string } }
get:
operationId: downloadBackup
tags: [admin]
summary: Download a backup archive (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: The archive
content:
application/zip:
schema: { type: string, format: binary }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteBackup
tags: [admin]
summary: Delete a backup archive (superadmin)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getWorkspaceAi
tags: [ai]
summary: What AI offers in the workspace to the caller (member)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiAvailability" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/settings:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getAiSettings
tags: [ai]
summary: The workspace's AI switches (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiSettings" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: saveAiSettings
tags: [ai]
summary: Replace the workspace's AI switches (workspace admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiSettings" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiSettings" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/profiles:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listAiProfiles
tags: [ai]
summary: The workspace's AI provider profiles, in order (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiProfile" } }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createAiProfile
tags: [ai]
summary: Add a provider profile at the end (workspace admin)
description: >-
Workspace profiles follow the webhook address rules: they cannot reach loopback or private addresses unless DOCWELL_WEBHOOKS_ALLOW_LOCAL is set.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiProfileInput" }
responses:
"201":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiProfile" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/profiles/order:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
put:
operationId: orderAiProfiles
tags: [ai]
summary: Set the order of the workspace's profiles (workspace admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/IdList" }
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiProfile" } }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/admin/ai/profiles:
get:
operationId: listInstanceAiProfiles
tags: [admin]
summary: The instance's default AI profiles (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiProfile" } }
"403": { $ref: "#/components/responses/Error" }
post:
operationId: createInstanceAiProfile
tags: [admin]
summary: Add an instance default profile (superadmin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiProfileInput" }
responses:
"201":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiProfile" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/ai/profiles/order:
put:
operationId: orderInstanceAiProfiles
tags: [admin]
summary: Set the order of the instance's profiles (superadmin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/IdList" }
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiProfile" } }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/ai/profiles/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateAiProfile
tags: [ai]
summary: Change a profile; a missing apiKey keeps the stored one (workspace admin, or superadmin for instance profiles)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiProfileInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiProfile" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteAiProfile
tags: [ai]
summary: Remove a profile
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/ai/profiles/{id}/test:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: testAiProfile
tags: [ai]
summary: Send a one-word chat (and a one-line embedding) through a profile
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiTestResult" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/index:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getAiIndex
tags: [ai]
summary: Embeddings progress of the workspace (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiIndexStatus" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/index/rebuild:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: rebuildAiIndex
tags: [ai]
summary: Drop the workspace's vectors and embed every page again (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Started }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/files:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listAiFiles
tags: [ai]
summary: Extra documents chat retrieves from (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiFile" } }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: addAiFile
tags: [ai]
summary: Add a text, Markdown, HTML or Word file (up to 10 MB) for retrieval (workspace admin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file: { type: string, format: binary }
responses:
"201":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiFile" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/ai/files/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
delete:
operationId: deleteAiFile
tags: [ai]
summary: Remove an extra file and its vectors (workspace admin)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/sessions:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: listAiSessions
tags: [ai]
summary: The caller's AI chats in the workspace, newest first
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiSessionSummary" } }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createAiSession
tags: [ai]
summary: Start an AI chat about the workspace, a space or a page
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiSessionInput" }
responses:
"201":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiSession" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/ai/sessions/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getAiSession
tags: [ai]
summary: One of the caller's chats with its messages
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiSession" }
"404": { $ref: "#/components/responses/Error" }
patch:
operationId: updateAiSession
tags: [ai]
summary: Rename a chat or change what it asks about
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiSessionInput" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiSession" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteAiSession
tags: [ai]
summary: Delete a chat
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"404": { $ref: "#/components/responses/Error" }
/api/v1/ai/sessions/{id}/fork:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: forkAiSession
tags: [ai]
summary: Copy a chat up to a message (all of it without one)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiForkInput" }
responses:
"201":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiSession" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/ai/sessions/{id}/messages:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: askAi
tags: [ai]
summary: Ask a question in a chat; the answer streams as server-sent events
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { type: object, required: [content], properties: { content: { type: string, maxLength: 8000 } } }
responses:
"200":
description: >-
Events: sources ({citations: AiCitation[]}), delta ({text}), then done ({user: AiMessage, message: AiMessage}) or error ({message}). Errors before the stream starts are JSON.
content:
text/event-stream:
schema: { type: string }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/write:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: aiWrite
tags: [ai]
summary: Run a writing action on a piece of text; the result (Markdown) streams as server-sent events
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiWriteInput" }
responses:
"200":
description: >-
Events: delta ({text}), then done ({}) or error ({message}). Errors before the stream starts are JSON.
content:
text/event-stream:
schema: { type: string }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/mcp:
post:
operationId: mcp
tags: [ai]
summary: Model Context Protocol endpoint (Streamable HTTP, JSON responses)
description: >-
One JSON-RPC 2.0 message or batch per request: initialize, ping, tools/list, tools/call. Authenticate
with a Docwell API token; read tokens get list_workspaces, list_spaces, list_pages, search, read_page
and ask, write tokens also create_page and update_page. Notifications are answered with 202.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { type: object, additionalProperties: true }
responses:
"200":
description: The JSON-RPC response
content:
application/json:
schema: { type: object, additionalProperties: true }
"202": { description: A notification was received }
"401": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/usage:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getAiUsage
tags: [ai]
summary: The workspace's AI usage this month, with its caps (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiUsage" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/admin/ai/usage:
get:
operationId: listAiUsage
tags: [admin]
summary: Every workspace's AI usage this month, most first (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiUsage" } }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/ai/settings:
get:
operationId: getInstanceAiSettings
tags: [admin]
summary: The server's AI rules (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiInstanceSettings" }
"403": { $ref: "#/components/responses/Error" }
put:
operationId: saveInstanceAiSettings
tags: [admin]
summary: Replace the server's AI rules (superadmin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiInstanceSettings" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiInstanceSettings" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/files/{id}/transcribe:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: transcribeFile
tags: [ai]
summary: Turn an audio or video attachment (up to 25 MB) into text, and optionally a summary (page reader)
description: >-
Uses the first profile of the page's workspace with a speech-to-text model (OpenAI-compatible
/audio/transcriptions). The summary comes from the workspace's chat profiles.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { type: object, properties: { summarize: { type: boolean } } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiTranscript" }
"400": { $ref: "#/components/responses/Error" }
"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, totp_required (with challenge), invalid_code, 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 }
challenge: { type: string, description: With totp_required; send it to /api/v1/auth/totp/verify }
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 }
totp: { type: boolean, description: Signs in with an authenticator app too }
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, defaultPageMode, allowSharing, urlPreview]
properties:
id: { type: string }
name: { type: string }
slug: { type: string }
organization: { type: string }
organizationName: { type: string }
role: { $ref: "#/components/schemas/WorkspaceRole" }
created: { type: string }
defaultPageMode: { $ref: "#/components/schemas/PageMode", description: The view new pages of the workspace open in }
allowSharing: { type: boolean, description: False when public share links are off for the whole workspace }
urlPreview: { type: boolean, description: "Chat apps may show private pages' titles in link previews" }
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, limited, journal, 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/SpaceCallerRole" }
limited: { type: boolean, description: The caller cannot open the space itself and sees only pages shared with them }
journal: { type: boolean, description: "A journal space: one person's daily pages, private to them" }
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, restricted, updated]
properties:
id: { type: string }
parent:
type: string
description: Parent page id; empty at the top level. In a page tree, a page whose parent the caller cannot open hangs from its nearest visible ancestor.
title: { type: string }
icon: { type: string }
position: { type: string, description: Fractional sort key among siblings }
restricted: { type: boolean, description: This page itself is restricted }
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, archivedAt, archived, ancestors, role, restricted, isTemplate, favorite, pinnedAt, fullWidth, font, defaultMode, tags, properties, journalDate, createdBy, lastEditedBy, verification]
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 }
archivedAt: { type: string, description: When the page itself was archived; empty otherwise }
archived: { type: boolean, description: The page or one of its ancestors is archived (read-only) }
ancestors: { type: array, items: { $ref: "#/components/schemas/PageRef" }, description: Root first; pages the caller cannot open are left out }
role: { $ref: "#/components/schemas/SpaceRole", description: The caller's role on this page }
restricted: { type: boolean, description: The page or one of its ancestors is restricted }
isTemplate: { type: boolean, description: Offered as a template for new pages }
favorite: { type: boolean, description: In the caller's favorites }
pinnedAt: { type: string, description: When the page was pinned to its space's home; empty if not }
fullWidth: { type: boolean, description: Shown across the whole window instead of the reading column }
font: { $ref: "#/components/schemas/PageFont" }
defaultMode: { $ref: "#/components/schemas/PageMode" }
tags: { type: array, items: { type: string }, description: Tag ids }
properties:
type: object
additionalProperties: true
description: Custom property values by property id (see Property for their shapes)
journalDate: { type: string, description: The day (YYYY-MM-DD) of a journal page; empty otherwise }
createdBy: { $ref: "#/components/schemas/PageUser" }
lastEditedBy: { $ref: "#/components/schemas/PageUser" }
verification: { $ref: "#/components/schemas/PageVerification" }
PageVerification:
type: object
description: Whether someone vouched for the page; at is empty when nobody has
required: [by, at, until, expired]
properties:
by: { $ref: "#/components/schemas/PageUser" }
at: { type: string, description: When the page was verified; empty if it is not }
until: { type: string, description: When the verification runs out; empty when it does not }
expired: { type: boolean, description: The verification ran out (until has passed) }
VerifyPage:
type: object
required: [days]
properties:
days:
type: integer
minimum: 0
maximum: 3660
description: How many days the verification lasts; 0 for one that does not run out
PageMode:
type: string
enum: [page, edgeless]
description: The view a page opens in for everyone, its text or the edgeless canvas; "?mode=" in an address overrides it
PageFont:
type: string
enum: ["", serif, mono]
description: The body font for everyone reading the page; empty is the default sans
PageGrantRole: { type: string, enum: [editor, commenter, viewer] }
SpaceCallerRole:
type: string
enum: [admin, editor, commenter, viewer, ""]
description: The caller's space role; empty when they see only pages shared with them
PageGrant:
type: object
required: [type, id, name, email, role, page, inherited]
properties:
type: { type: string, enum: [user, group] }
id: { type: string }
name: { type: string }
email: { type: string, description: Empty for groups }
role: { $ref: "#/components/schemas/PageGrantRole" }
page: { $ref: "#/components/schemas/PageRef", description: Where the grant was made }
inherited: { type: boolean, description: Granted on an ancestor }
PageInvite:
type: object
required: [id, email, role, expires]
properties:
id: { type: string }
email: { type: string }
role: { $ref: "#/components/schemas/PageGrantRole" }
expires: { type: string }
PageAccess:
type: object
required: [restricted, inheritedFrom, grants, invites, role, canManage, canInvite]
properties:
restricted: { type: boolean, description: The page or an ancestor is restricted; space members then see it only through grants }
inheritedFrom:
oneOf: [{ $ref: "#/components/schemas/PageRef" }, { type: "null" }]
description: The restricted ancestor, when the restriction comes from one
grants: { type: array, items: { $ref: "#/components/schemas/PageGrant" }, description: This page's grants first, then inherited ones }
invites: { type: array, items: { $ref: "#/components/schemas/PageInvite" }, description: Pending guest invites for this page (editors only) }
role: { $ref: "#/components/schemas/SpaceRole", description: The caller's role on this page }
canManage: { type: boolean }
canInvite: { type: boolean, description: May share with people outside the workspace, who join as guests }
SharePageResult:
type: object
required: [access, invite]
properties:
access: { $ref: "#/components/schemas/PageAccess" }
invite:
oneOf: [{ $ref: "#/components/schemas/Invite" }, { type: "null" }]
description: Set when the person was invited as a guest; the grant is made when they accept
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 }
PushDevice:
type: object
required: [id, name, created]
properties:
id: { type: string }
name: { type: string }
created: { type: string }
PushMessage:
type: object
description: The JSON body docwell-server POSTs to a phone's push endpoint
required: [title, body, route]
properties:
title: { type: string, description: The page's icon and title }
body: { type: string, description: 'For example "Ann mentioned you: …"' }
route: { type: string, description: 'The app route to open, for example /p/<id>?comment=<id>' }
ArchivedPage:
type: object
required: [id, title, icon, archivedAt]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
archivedAt: { type: string }
PinnedPage:
type: object
required: [id, title, icon, updated, pinnedAt]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
updated: { type: string }
pinnedAt: { type: string }
LinkPreview:
type: object
required: [url, title, description, image, site]
properties:
url: { type: string }
title: { type: string }
description: { type: string }
image: { type: string, description: Address of the page's picture on its own site; empty when it has none }
site: { type: string }
kind:
type: string
description: For links read through a service's API (github.issue, github.pull, github.repo, linear.issue, figma.file)
status: { type: string, description: "The service's word for the item's state (Open, Merged, In Progress)" }
state:
type: string
description: The state for its colour
enum: [open, started, draft, merged, done, closed, canceled]
meta: { type: string, description: "A line of details (acme/app #12 · alice)" }
WorkspaceIntegrations:
type: object
required: [github, linear, figma, slack]
properties:
github: { $ref: "#/components/schemas/IntegrationToken" }
linear: { $ref: "#/components/schemas/IntegrationToken" }
figma: { $ref: "#/components/schemas/IntegrationToken" }
slack: { $ref: "#/components/schemas/SlackIntegration" }
IntegrationToken:
type: object
required: [set]
properties:
set: { type: boolean, description: A token is stored (it is never sent back) }
SlackIntegration:
type: object
required: [connected, hasSigningSecret, team, teamName, channel, channelName, events, unfurl, search, lastError, eventsUrl, commandsUrl, manifest]
properties:
connected: { type: boolean, description: A bot token is stored }
hasSigningSecret: { type: boolean }
team: { type: string, description: The Slack workspace id the bot belongs to }
teamName: { type: string }
channel: { type: string, description: The channel id posts go to; empty for none }
channelName: { type: string }
events: { type: array, items: { type: string }, description: Events posted to the channel }
unfurl: { type: boolean, description: Docwell links posted in Slack get a preview }
search: { type: boolean, description: /docwell searches Docwell }
lastError: { type: string, description: The last post that failed; empty when the last one worked }
eventsUrl: { type: string, description: Request URL for the Slack app's Event Subscriptions }
commandsUrl: { type: string, description: Request URL for the /docwell slash command }
manifest: { type: string, description: A Slack app manifest (JSON) with those URLs and the scopes Docwell needs }
SlackIntegrationInput:
type: object
properties:
botToken: { type: string, description: The app's Bot User OAuth Token (xoxb-…); checked with Slack }
signingSecret: { type: string, description: The app's Signing Secret }
channel: { type: string, description: "A public channel id or name (#news); empty for none" }
events:
type: array
items:
type: string
enum: [page.created, page.updated, page.moved, page.archived, page.unarchived, page.restored, comment.created, comment.resolved]
unfurl: { type: boolean }
search: { type: boolean }
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, providers, signup]
properties:
password: { type: boolean }
otp: { type: boolean }
mfa: { type: boolean }
oauth2: { type: array, items: { type: string } }
providers:
type: array
items:
type: object
required: [name, displayName]
properties:
name: { type: string }
displayName: { 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 }
PublicSettings:
type: object
required: [appName, accentColor, logo, signup, magicLink]
properties:
appName: { type: string }
accentColor: { type: string, description: "#rrggbb, or empty for the default" }
logo: { type: string, description: A data URL, or empty for the Docwell logo }
signup: { type: boolean, description: Self-service signup is open }
magicLink: { type: boolean, description: Sign-in links by email are enabled }
SignupSettings:
type: object
required: [enabled, domains]
properties:
enabled: { type: boolean }
domains: { type: array, items: { type: string }, description: Allowed email domains; empty allows all }
BrandingSettings:
type: object
required: [appName, accentColor, logo]
properties:
appName: { type: string, maxLength: 60 }
accentColor: { type: string }
logo: { type: string, description: "data:image/(png|jpeg|webp|svg+xml);base64,..., at most 256 KB" }
SmtpSettings:
type: object
required: [enabled, host, port, username, passwordSet, tls, senderName, senderAddress]
properties:
enabled: { type: boolean }
host: { type: string }
port: { type: integer }
username: { type: string }
password: { type: string, writeOnly: true, description: Leave out to keep the stored password }
passwordSet: { type: boolean, readOnly: true }
tls: { type: boolean }
senderName: { type: string }
senderAddress: { type: string }
StorageSettings:
type: object
required: [s3, bucket, region, endpoint, accessKey, secretSet, forcePathStyle]
properties:
s3: { type: boolean, description: false stores files on docwell-db's disk }
bucket: { type: string }
region: { type: string }
endpoint: { type: string }
accessKey: { type: string }
secret: { type: string, writeOnly: true, description: Leave out to keep the stored secret }
secretSet: { type: boolean, readOnly: true }
forcePathStyle: { type: boolean }
InstanceSettings:
type: object
required: [signup, auth, branding, smtp, storage]
properties:
signup: { $ref: "#/components/schemas/SignupSettings" }
auth: { $ref: "#/components/schemas/AuthSettings" }
branding: { $ref: "#/components/schemas/BrandingSettings" }
smtp: { $ref: "#/components/schemas/SmtpSettings" }
storage: { $ref: "#/components/schemas/StorageSettings" }
InstanceSettingsUpdate:
type: object
properties:
signup: { $ref: "#/components/schemas/SignupSettings" }
auth: { $ref: "#/components/schemas/AuthSettings" }
branding: { $ref: "#/components/schemas/BrandingSettings" }
smtp: { $ref: "#/components/schemas/SmtpSettings" }
storage: { $ref: "#/components/schemas/StorageSettings" }
OAuthStart:
type: object
required: [url, state]
properties:
url: { type: string }
state: { type: string }
TotpStatus:
type: object
required: [enabled, recoveryCodesLeft]
properties:
enabled: { type: boolean }
recoveryCodesLeft: { type: integer }
TotpSetup:
type: object
required: [secret, url, qr]
properties:
secret: { type: string, description: For typing into the app by hand }
url: { type: string, description: The otpauth:// address }
qr: { type: string, description: PNG data URL of the QR code }
ApiToken:
type: object
required: [id, name, prefix, scope, lastUsed, expires, created]
properties:
id: { type: string }
name: { type: string }
prefix: { type: string, description: The token's first characters }
scope: { type: string, enum: [read, write] }
lastUsed: { type: string }
expires: { type: string, description: Empty when it never expires }
created: { type: string }
user:
type: object
description: In admin listings
required: [id, email, name]
properties:
id: { type: string }
email: { type: string }
name: { type: string }
NewApiToken:
allOf:
- { $ref: "#/components/schemas/ApiToken" }
- type: object
required: [token]
properties:
token: { type: string, description: The token; it is not shown again }
AuditEntry:
type: object
required: [id, created, action, actorId, actorEmail, targetType, targetId, status, ip, userAgent, meta]
properties:
id: { type: string }
created: { type: string }
action: { type: string, description: 'A sign-in step ("auth.login", "auth.login.failed") or the route of a change ("PATCH /pages/{id}")' }
actorId: { type: string }
actorEmail: { type: string }
targetType: { type: string }
targetId: { type: string }
status: { type: integer }
ip: { type: string }
userAgent: { type: string }
meta:
oneOf: [{ type: object, additionalProperties: true }, { type: "null" }]
AuditPage:
type: object
required: [items, total, page]
properties:
items: { type: array, items: { $ref: "#/components/schemas/AuditEntry" } }
total: { type: integer }
page: { type: integer }
WebhookEvent:
type: string
enum: ["*", page.created, page.updated, page.moved, page.trashed, page.restored, page.deleted, page.archived, page.unarchived, comment.created, comment.resolved, space.created, space.deleted]
Webhook:
type: object
required: [id, name, url, events, active, created]
properties:
id: { type: string }
name: { type: string }
url: { type: string }
events: { type: array, items: { $ref: "#/components/schemas/WebhookEvent" } }
active: { type: boolean }
secret: { type: string, description: Only when just created }
created: { type: string }
WebhookInput:
type: object
properties:
name: { type: string, maxLength: 100 }
url: { type: string }
events: { type: array, items: { $ref: "#/components/schemas/WebhookEvent" }, description: Defaults to all ("*") }
active: { type: boolean }
WebhookDelivery:
type: object
required: [id, event, deliveryId, status, attempts, responseCode, error, durationMs, created]
properties:
id: { type: string }
event: { type: string }
deliveryId: { type: string, description: The payload's id (X-Docwell-Delivery) }
status: { type: string, enum: [pending, success, failed] }
attempts: { type: integer }
responseCode: { type: integer }
error: { type: string }
durationMs: { type: integer }
created: { type: string }
OAuthProviderSettings:
type: object
required: [name, clientId, displayName, authUrl, tokenUrl, userInfoUrl]
properties:
name: { type: string, enum: [google, github, microsoft, oidc] }
clientId: { type: string }
clientSecret: { type: string, description: Write-only; leave out to keep the stored one }
displayName: { type: string }
authUrl: { type: string, description: OpenID Connect only }
tokenUrl: { type: string, description: OpenID Connect only }
userInfoUrl: { type: string, description: OpenID Connect only }
AuthSettings:
type: object
required: [magicLink, oauth2]
properties:
magicLink: { type: boolean, description: Email a one-time sign-in link and code }
oauth2:
type: array
items: { $ref: "#/components/schemas/OAuthProviderSettings" }
description: Sign-in providers; saving replaces the list (leave it out to keep it)
callbackUrl: { type: string, description: "Read-only: the address to register with each provider" }
Invite:
type: object
required: [id, email, organization, organizationName, role, workspace, workspaceName, workspaceRole, invitedBy, expires, created, status, mailed]
properties:
id: { type: string, description: Empty when status is added }
email: { type: string }
organization: { type: string }
organizationName: { type: string }
role: { $ref: "#/components/schemas/Role" }
workspace: { type: string }
workspaceName: { type: string }
workspaceRole: { type: string, description: A workspace role, or empty for organization invites }
invitedBy: { type: string, description: Inviter's name }
expires: { type: string }
created: { type: string }
status: { type: string, enum: [pending, expired, added] }
link: { type: string, description: Only when just created or resent }
mailed: { type: boolean, description: The email was handed to the mail server }
CreateInviteRequest:
type: object
required: [email]
properties:
email: { type: string, format: email }
role: { $ref: "#/components/schemas/Role" }
organization: { type: string, description: Superadmins only; admins always invite into their own }
workspace: { type: string, description: Makes this a workspace invite }
workspaceRole: { $ref: "#/components/schemas/WorkspaceRole" }
InviteInfo:
type: object
required: [email, organizationName, workspaceName, invitedBy, expires, hasAccount]
properties:
email: { type: string }
organizationName: { type: string }
workspaceName: { type: string }
invitedBy: { type: string }
expires: { type: string }
hasAccount: { type: boolean, description: Sign in to accept instead of signing up }
MemberUser:
type: object
required: [id, email, name]
properties:
id: { type: string }
email: { type: string }
name: { type: string }
Group:
type: object
required: [id, workspace, name, description, members, created]
properties:
id: { type: string }
workspace: { type: string }
name: { type: string }
description: { type: string }
members: { type: integer }
created: { type: string }
GroupRequest:
type: object
properties:
name: { type: string, maxLength: 120 }
description: { type: string, maxLength: 500 }
SpaceGroup:
type: object
required: [group, role]
properties:
group:
type: object
required: [id, name]
properties:
id: { type: string }
name: { type: string }
role: { $ref: "#/components/schemas/SpaceRole" }
PageItem:
type: object
required: [id, title, icon, space, spaceName, at]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
space: { type: string }
spaceName: { type: string }
at: { type: string, description: When it was favorited, or last visited }
Attachment:
type: object
required: [id, page, name, mime, size, url, created]
properties:
id: { type: string }
page: { type: string }
name: { type: string }
mime: { type: string, description: Detected from the content }
size: { type: integer, description: Bytes }
url: { type: string, description: "API path, e.g. /api/v1/files/abc" }
created: { type: string }
InviteLink:
type: object
required: [token, url, role, approval, expires, created, pending]
properties:
token: { type: string }
url: { type: string, description: "The link on docwell-web (DOCWELL_WEB_URL/join?token=...)" }
role: { type: string, enum: [member, guest] }
approval: { type: boolean, description: Joining needs an admin's approval }
expires: { type: string, description: Empty when the link does not expire }
created: { type: string }
pending: { type: integer, description: Requests waiting for a decision }
JoinRequest:
type: object
required: [id, user, role, created]
properties:
id: { type: string }
user: { $ref: "#/components/schemas/MemberUser" }
role: { type: string, enum: [member, guest] }
created: { type: string }
JoinInfo:
type: object
required: [workspace, workspaceName, organizationName, role, approval, status]
properties:
workspace: { type: string }
workspaceName: { type: string }
organizationName: { type: string }
role: { type: string, enum: [member, guest] }
approval: { type: boolean }
status:
type: string
enum: ["", member, pending, declined]
description: The caller's standing; empty when signed out or not asked yet
JoinResult:
type: object
required: [status, workspace]
properties:
status: { type: string, enum: [member, pending] }
workspace: { type: string }
PageAnalytics:
type: object
required: [days, views, viewers, linkViews, daily, recent]
properties:
days: { type: integer }
views: { type: integer, description: Opens in the period (repeat opens within 30 minutes count once) }
viewers: { type: integer, description: Different signed-in people }
linkViews: { type: integer, description: Opens through a share link }
daily:
type: array
description: One entry per day (UTC), oldest first
items: { $ref: "#/components/schemas/AnalyticsDay" }
recent:
type: array
description: Who opened the page, most recent first (at most 20)
items: { $ref: "#/components/schemas/PageViewer" }
AnalyticsDay:
type: object
required: [date, views, viewers]
properties:
date: { type: string, description: "YYYY-MM-DD (UTC)" }
views: { type: integer }
viewers: { type: integer }
PageViewer:
type: object
required: [user, views, lastViewed]
properties:
user: { $ref: "#/components/schemas/MemberUser" }
views: { type: integer }
lastViewed: { type: string }
UnusedFile:
type: object
required: [id, page, name, mime, size, url, created, pageTitle]
properties:
id: { type: string }
page: { type: string }
name: { type: string }
mime: { type: string }
size: { type: integer, description: Bytes }
url: { type: string }
created: { type: string }
pageTitle: { type: string, description: The page it was uploaded to; empty when the caller cannot open it }
UnusedFiles:
type: object
required: [files, size]
properties:
files: { type: array, items: { $ref: "#/components/schemas/UnusedFile" } }
size: { type: integer, description: Total bytes }
PagePreview:
type: object
required: [title, description, site]
properties:
title: { type: string }
description: { type: string }
site: { type: string, description: The workspace's name }
SearchHit:
type: object
required: [id, title, icon, space, spaceName, snippet, highlights, updated]
properties:
id: { type: string, description: "The page (also for a record: the page that holds it)" }
title: { type: string, description: The page's title }
record:
type: object
description: Set when the hit is a database record; open it with the page link plus "#r-<database>-<row>"
required: [database, row, title]
properties:
database: { type: string }
row: { type: string }
title: { type: string }
file:
type: object
description: >-
Set when the match is in a file attached to the page (the text of PDFs, Word, HTML and text files is
searchable); snippet is from the file
required: [id, name]
properties:
id: { type: string, description: "The attachment (its address is /api/v1/files/<id>)" }
name: { type: string }
icon: { type: string }
space: { type: string }
spaceName: { type: string }
snippet: { type: string, description: Plain text around the first match }
highlights:
type: array
description: "[start, end) character offsets of matches in snippet"
items: { type: array, items: { type: integer }, minItems: 2, maxItems: 2 }
updated: { type: string }
SearchResult:
type: object
required: [items, total]
properties:
items: { type: array, items: { $ref: "#/components/schemas/SearchHit" } }
total: { type: integer }
ShareLink:
type: object
required: [token, url, includeSubpages, created]
properties:
token: { type: string }
url: { type: string, description: The link on docwell-web (DOCWELL_WEB_URL/share/<token>) }
includeSubpages: { type: boolean }
created: { type: string }
SharedPage:
type: object
required: [id, title, icon, updated, content, mode, root, pages]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
updated: { type: string }
content:
oneOf: [{ type: object, additionalProperties: true }, { type: "null" }]
description: Tiptap JSON (with "surface", the edgeless canvas, when it has one); files load from /api/v1/share/{token}/files/{fileId}
mode: { $ref: "#/components/schemas/PageMode" }
root: { $ref: "#/components/schemas/PageRef" }
pages: { type: array, items: { $ref: "#/components/schemas/PageNode" }, description: Pages under the shared page, in tree order (only when the link includes subpages) }
Comment:
type: object
required:
[id, parent, page, author, body, quote, anchor, created, editedAt, resolvedAt, resolvedBy, reactions, canEdit, canDelete, canResolve]
properties:
id: { type: string }
parent: { type: string, description: The thread's first comment for a reply; empty for a thread }
page: { type: string }
author: { $ref: "#/components/schemas/MemberUser" }
body: { type: string }
quote: { type: string }
anchor:
oneOf: [{ type: object, additionalProperties: true }, { type: "null" }]
description: As sent when the comment was created; null when there was none
created: { type: string }
editedAt: { type: string, description: Empty when never edited }
resolvedAt: { type: string, description: Empty unless the thread is resolved }
resolvedBy:
oneOf: [{ $ref: "#/components/schemas/MemberUser" }, { type: "null" }]
reactions: { type: array, items: { $ref: "#/components/schemas/Reaction" }, description: Most used first }
canEdit: { type: boolean }
canDelete: { type: boolean }
canResolve: { type: boolean, description: A thread the caller may resolve or reopen }
Reaction:
type: object
required: [emoji, count, mine, people]
properties:
emoji: { type: string }
count: { type: integer }
mine: { type: boolean }
people: { type: array, items: { type: string }, description: Names of the people who reacted }
Template:
type: object
required: [id, title, icon, space, spaceName]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
space: { type: string }
spaceName: { type: string }
WatchState:
type: object
required: [watching]
properties:
watching: { type: boolean }
NotificationType:
type: string
enum: [comment, reply, mention, share, resolved, reminder, join_request, join_approved, join_declined, verify_expired]
description: The join_* types are about a workspace and have no page; verify_expired tells the person who verified a page that it ran out
Notification:
type: object
required: [id, type, workspace, page, comment, actor, excerpt, created, read]
properties:
id: { type: string }
type: { $ref: "#/components/schemas/NotificationType" }
workspace: { type: string }
page:
oneOf: [{ $ref: "#/components/schemas/PageRef" }, { type: "null" }]
description: Null when the page is gone or the caller lost access to it
comment: { type: string, description: The comment it is about, if any }
actor:
oneOf: [{ $ref: "#/components/schemas/MemberUser" }, { type: "null" }]
excerpt: { type: string }
created: { type: string }
read: { type: boolean }
NotificationList:
type: object
required: [items, unread]
properties:
items: { type: array, items: { $ref: "#/components/schemas/Notification" } }
unread: { type: integer }
NotificationSettings:
type: object
required: [email]
properties:
email: { type: string, enum: [digest, "off"], description: Unread notifications by email every few minutes, or no emails }
emailTypes:
type: array
items: { $ref: "#/components/schemas/NotificationType" }
description: >-
The notification types the email digest includes (the others only reach the inbox).
Always sent back; leave it out when saving to keep it as it is.
AdminStats:
type: object
required: [scope, users, organizations, workspaces, spaces, pages, attachments, storageBytes, rooms, editors, indexed]
properties:
scope: { type: string, enum: [instance, organization] }
users: { type: integer }
organizations: { type: integer }
workspaces: { type: integer }
spaces: { type: integer }
pages: { type: integer, description: Pages outside the trash }
attachments: { type: integer }
storageBytes: { type: integer, description: Total size of attachments }
rooms: { type: integer, description: Pages open for editing now (instance scope only) }
editors: { type: integer, description: People connected to those pages (instance scope only) }
indexed: { type: integer, description: Pages in the search index (instance scope only) }
AdminHealth:
type: object
required: [version, goVersion, started, uptimeSeconds, database, goroutines, memoryMb]
properties:
version: { type: string }
goVersion: { type: string }
started: { type: string, format: date-time }
uptimeSeconds: { type: integer }
database:
type: object
required: [ok, latencyMs]
properties:
ok: { type: boolean }
latencyMs: { type: integer }
error: { type: string }
goroutines: { type: integer }
memoryMb: { type: integer }
Job:
type: object
required: [name, description, every, runnable, running, runs, failures, lastStarted, lastDurationMs, lastError]
properties:
name: { type: string }
description: { type: string }
every: { type: string, description: How often it runs on its own (Go duration); empty when only on demand }
runnable: { type: boolean, description: Can be started by hand }
running: { type: boolean }
runs: { type: integer, description: Runs since the server started }
failures: { type: integer }
lastStarted: { type: string, description: RFC 3339; empty before the first run }
lastDurationMs: { type: integer }
lastError: { type: string }
Backup:
type: object
required: [key, size, modified]
properties:
key: { type: string }
size: { type: integer }
modified: { type: string }
PropertyType:
type: string
enum: [text, number, checkbox, date, select, multi_select, member, link]
description: >-
What a value looks like: text and link a string, number a number, checkbox a
boolean, date "YYYY-MM-DD", select an option id, multi_select a list of option
ids, member a list of user ids.
Integrations:
type: object
required: [google, microsoft, readwise]
properties:
google: { type: boolean, description: People can connect Google Calendar }
microsoft: { type: boolean, description: People can import OneNote notebooks }
readwise: { type: boolean }
ConnectURL:
type: object
required: [url]
properties:
url: { type: string, description: Where to send the browser }
OneNoteNotebook:
type: object
required: [id, name, modified]
properties:
id: { type: string }
name: { type: string }
modified: { type: string }
OneNoteConnection:
type: object
required: [account, notebooks]
properties:
account: { type: string, description: The Microsoft account signed in }
notebooks: { type: array, items: { $ref: "#/components/schemas/OneNoteNotebook" } }
OneNoteJob:
type: object
required: [id, notebook, status, pages, error, created]
properties:
id: { type: string }
notebook: { type: string }
status: { type: string, enum: [running, done, failed] }
pages: { type: integer, description: OneNote pages read so far }
error: { type: string }
created: { type: array, items: { $ref: "#/components/schemas/Page" }, description: The pages made at the top }
ReadwiseConnection:
type: object
required: [connected, workspace, space, parent, enabled, lastSync, lastError, highlights, books]
properties:
connected: { type: boolean }
workspace: { type: string }
space: { type: string }
parent: { type: string, description: The "Readwise" page books go under }
enabled: { type: boolean }
lastSync: { type: string }
lastError: { type: string }
highlights: { type: integer }
books: { type: integer }
ReadwiseInput:
type: object
properties:
token: { type: string, maxLength: 200, description: Empty keeps the stored one }
space: { type: string }
enabled: { type: boolean }
CalendarAccount:
type: object
required: [id, name, kind, url, username, hasPassword, color, enabled, lastSync, lastError, events, created]
properties:
id: { type: string }
name: { type: string }
kind: { type: string, enum: [ics, caldav, google], description: "google accounts are connected with /calendars/google/connect" }
url: { type: string }
username: { type: string }
hasPassword: { type: boolean }
color: { $ref: "#/components/schemas/LabelColor" }
enabled: { type: boolean, description: Whether its events show on journal pages }
lastSync: { type: string, description: When the source was last read }
lastError: { type: string, description: Why the last read failed; empty when it worked }
events: { type: integer, description: Events the source held then (repeating ones once) }
created: { type: string }
CalendarAccountInput:
type: object
properties:
name: { type: string, maxLength: 80 }
kind: { type: string, enum: [ics, caldav] }
url: { type: string, maxLength: 2000, description: "http, https or webcal address" }
username: { type: string, maxLength: 200 }
password: { type: string, maxLength: 1000, description: Empty keeps the stored one }
clearPassword: { type: boolean }
color: { $ref: "#/components/schemas/LabelColor" }
enabled: { type: boolean }
CalendarEvent:
type: object
required: [id, calendar, title, location, url, start, end, allDay, color]
properties:
id: { type: string }
calendar: { type: string, description: The calendar account's id }
title: { type: string }
location: { type: string }
url: { type: string }
start: { type: string, description: "RFC 3339 time, or a date (YYYY-MM-DD) for all-day events" }
end: { type: string, description: "Exclusive; a date for all-day events" }
allDay: { type: boolean }
color: { $ref: "#/components/schemas/LabelColor" }
LabelColor:
type: string
enum: ["", gray, red, orange, yellow, green, teal, blue, purple, pink]
description: A colour of the editor palette, drawn from the theme; empty for none
PropertyOption:
type: object
required: [id, name, color]
properties:
id: { type: string, description: Empty when creating; the server picks one }
name: { type: string, maxLength: 60 }
color: { $ref: "#/components/schemas/LabelColor" }
PropertyVisibility:
type: string
enum: [always, hide_empty, never]
description: Whether the page's Info panel shows it always, only with a value, or never
Property:
type: object
required: [id, workspace, name, type, options, visibility, position]
properties:
id: { type: string }
workspace: { type: string }
name: { type: string }
type: { $ref: "#/components/schemas/PropertyType" }
options: { type: array, items: { $ref: "#/components/schemas/PropertyOption" } }
visibility: { $ref: "#/components/schemas/PropertyVisibility" }
position: { type: number }
PropertyInput:
type: object
description: Creating needs name and type; updating changes the fields that are set
properties:
name: { type: string, maxLength: 80 }
type: { $ref: "#/components/schemas/PropertyType" }
options: { type: array, items: { $ref: "#/components/schemas/PropertyOption" } }
visibility: { $ref: "#/components/schemas/PropertyVisibility" }
position: { type: number }
Tag:
type: object
required: [id, name, color, pages]
properties:
id: { type: string }
name: { type: string }
color: { $ref: "#/components/schemas/LabelColor" }
pages: { type: integer, description: Live pages with the tag, including ones the caller cannot open }
TagInput:
type: object
properties:
name: { type: string, maxLength: 60 }
color: { $ref: "#/components/schemas/LabelColor" }
DocRule:
type: object
required: [field, op]
properties:
field:
type: string
description: >-
title, space, tags, created, updated, createdBy, lastEditedBy, template, journal,
or "prop:" followed by a property id
op:
type: string
enum: [is, isNot, contains, notContains, before, after, withinDays, gt, lt, empty, notEmpty]
value:
description: A string, a list of strings (any of them), a number or a boolean, as the op needs
DocFilter:
type: object
required: [match, rules]
properties:
match: { type: string, enum: [all, any] }
rules: { type: array, items: { $ref: "#/components/schemas/DocRule" }, maxItems: 50 }
DocItem:
type: object
required: [id, title, icon, space, spaceName, parent, created, updated, createdBy, lastEditedBy, isTemplate, journalDate, fullWidth, tags, properties, role]
properties:
id: { type: string }
title: { type: string }
icon: { type: string }
space: { type: string }
spaceName: { type: string }
parent: { type: string }
created: { type: string }
updated: { type: string }
createdBy: { type: string, description: User id }
lastEditedBy: { type: string, description: User id }
isTemplate: { type: boolean }
journalDate: { type: string }
fullWidth: { type: boolean }
tags: { type: array, items: { type: string } }
properties: { type: object, additionalProperties: true }
role: { $ref: "#/components/schemas/SpaceRole", description: The caller's role on the page }
DocList:
type: object
required: [items, people]
properties:
items: { type: array, items: { $ref: "#/components/schemas/DocItem" } }
people:
type: object
additionalProperties: { type: string }
description: Names of the people the items mention, by user id
Collection:
type: object
required: [id, workspace, name, icon, filter, include, exclude, shared, creator, canEdit, updated]
properties:
id: { type: string }
workspace: { type: string }
name: { type: string }
icon: { type: string }
filter: { $ref: "#/components/schemas/DocFilter" }
include: { type: array, items: { type: string }, description: Pages added by hand }
exclude: { type: array, items: { type: string }, description: Pages taken out by hand }
shared: { type: boolean, description: Seen by everyone in the workspace, not only its creator }
creator: { type: string }
canEdit: { type: boolean }
updated: { type: string }
CollectionInput:
type: object
description: Creating needs name; updating changes the fields that are set
properties:
name: { type: string, maxLength: 120 }
icon: { type: string, maxLength: 32 }
filter: { $ref: "#/components/schemas/DocFilter" }
include: { type: array, items: { type: string }, maxItems: 2000 }
exclude: { type: array, items: { type: string }, maxItems: 2000 }
shared: { type: boolean }
JournalDay:
type: object
required: [date, page, title]
properties:
date: { type: string, format: date }
page: { type: string }
title: { type: string }
JournalInfo:
type: object
required: [space, template, days]
properties:
space: { type: string, description: The caller's journal space; empty until the first journal page }
template: { type: string, description: The page new journal pages are filled from; empty for none }
days: { type: array, items: { $ref: "#/components/schemas/JournalDay" } }
PageUser:
type: object
required: [id, name]
properties:
id: { type: string }
name: { type: string, description: Empty when the account is gone }
IdList:
type: object
required: [ids]
properties:
ids: { type: array, items: { type: string }, maxItems: 200 }
AiAvailability:
type: object
required: [chat, embeddings, transcribe, canManage]
properties:
chat: { type: boolean, description: A profile with a chat model is set up and AI is on }
embeddings: { type: boolean, description: The workspace is indexed for retrieval }
transcribe: { type: boolean, description: A profile can turn audio attachments into text }
canManage: { type: boolean, description: The caller may change the workspace's AI settings }
AiSettings:
type: object
required: [enabled, useInstanceProfiles, index, ignored, monthlyTokenLimit, readScans]
properties:
enabled: { type: boolean }
useInstanceProfiles: { type: boolean, description: After its own profiles, the workspace uses the instance's }
index: { type: boolean, description: Embed pages for retrieval (sends every page to the embedding provider) }
ignored: { type: array, items: { type: string }, description: Pages (with their subpages) that are neither indexed nor retrieved }
monthlyTokenLimit: { type: integer, minimum: 0, description: Tokens the workspace may use per month; 0 is no cap }
readScans: { type: boolean, description: Have a document-reading model write out scanned PDFs attached to pages, once each, so search finds their text (uses tokens) }
AiProviderKind:
type: string
enum: [openai, anthropic, ollama]
description: openai is any OpenAI-compatible API
AiProfile:
type: object
required: [id, workspace, name, kind, baseUrl, keySet, chatModel, embedModel, transcribeModel, effort, enabled, position, usage, lastUsed, lastError, created]
properties:
id: { type: string }
workspace: { type: string, description: Empty for an instance default }
name: { type: string }
kind: { $ref: "#/components/schemas/AiProviderKind" }
baseUrl: { type: string, description: Empty for the kind's default address }
keySet: { type: boolean, description: An API key is stored (keys are never returned) }
chatModel: { type: string }
embedModel: { type: string, description: Empty when the profile is not used for embeddings }
transcribeModel: { type: string, description: Speech-to-text model (OpenAI-compatible); empty when unused }
effort: { type: string, description: Anthropic effort level, empty for the model's default }
enabled: { type: boolean }
position: { type: integer }
usage:
type: object
required: [requests, inputTokens, outputTokens]
properties:
requests: { type: integer }
inputTokens: { type: integer }
outputTokens: { type: integer }
lastUsed: { type: string }
lastError: { type: string }
created: { type: string }
AiProfileInput:
type: object
description: Creating needs name and kind; updating changes the fields that are set
properties:
name: { type: string, maxLength: 80 }
kind: { $ref: "#/components/schemas/AiProviderKind" }
baseUrl: { type: string }
apiKey: { type: string, description: "Write-only; an empty string removes the key" }
chatModel: { type: string }
embedModel: { type: string }
transcribeModel: { type: string }
effort: { type: string, enum: ["", low, medium, high, xhigh, max] }
enabled: { type: boolean }
AiTestResult:
type: object
required: [ok, chat, embeddings, dimensions, latencyMs, error]
properties:
ok: { type: boolean }
chat: { type: string, description: The model's reply }
embeddings: { type: string }
dimensions: { type: integer }
latencyMs: { type: integer }
error: { type: string }
AiIndexStatus:
type: object
required: [enabled, profile, model, pages, indexed, files, chunks, running, lastRun, lastError]
properties:
enabled: { type: boolean }
profile: { type: string, description: The profile vectors come from; empty when none has an embedding model }
model: { type: string }
pages: { type: integer, description: Pages that can be indexed }
indexed: { type: integer }
files: { type: integer }
chunks: { type: integer }
running: { type: boolean }
lastRun: { type: string }
lastError: { type: string }
AiFile:
type: object
required: [id, name, size, chars, indexed, created]
properties:
id: { type: string }
name: { type: string }
size: { type: integer }
chars: { type: integer }
indexed: { type: boolean }
created: { type: string }
AiScope:
type: string
enum: [workspace, space, page]
AiSessionSummary:
type: object
required: [id, title, scope, scopeId, created, updated]
properties:
id: { type: string }
title: { type: string }
scope: { $ref: "#/components/schemas/AiScope" }
scopeId: { type: string, description: The space or page; empty for the workspace }
created: { type: string }
updated: { type: string }
AiCitation:
type: object
required: [n, title, snippet]
properties:
n: { type: integer, description: "The number the answer cites as [n]" }
page: { type: string }
block: { type: string, description: "The cited block (link with #b-<block>)" }
file: { type: string, description: An extra file instead of a page }
title: { type: string }
snippet: { type: string }
AiMessage:
type: object
required: [id, role, content, created]
properties:
id: { type: string }
role: { type: string, enum: [user, assistant] }
content: { type: string, description: Markdown }
citations: { type: array, items: { $ref: "#/components/schemas/AiCitation" } }
error: { type: string, description: Why the answer stopped }
created: { type: string }
AiSession:
allOf:
- { $ref: "#/components/schemas/AiSessionSummary" }
- type: object
required: [workspace, messages]
properties:
workspace: { type: string }
messages: { type: array, items: { $ref: "#/components/schemas/AiMessage" } }
AiSessionInput:
type: object
properties:
title: { type: string, maxLength: 200 }
scope: { $ref: "#/components/schemas/AiScope" }
scopeId: { type: string }
AiForkInput:
type: object
properties:
message: { type: string, description: The last message to copy; empty copies all }
AiWriteAction:
type: string
enum: [rewrite, summarize, translate, continue, shorter, longer, fix, custom]
AiWriteInput:
type: object
required: [action, text]
properties:
action: { $ref: "#/components/schemas/AiWriteAction" }
text: { type: string, maxLength: 20000, description: The selection }
before: { type: string, description: Text in front of the selection (continue) }
language: { type: string, description: Target language (translate) }
instruction: { type: string, maxLength: 2000, description: What to do (custom) }
AiUsage:
type: object
required: [workspace, month, requests, inputTokens, outputTokens, instanceTokens, limit, instanceLimit]
properties:
workspace: { type: string }
name: { type: string, description: The workspace's name (admin listing) }
month: { type: string, description: "Calendar month in UTC, e.g. 2026-11" }
requests: { type: integer }
inputTokens: { type: integer }
outputTokens: { type: integer }
instanceTokens: { type: integer, description: Tokens used through the server's own profiles }
limit: { type: integer, description: The workspace's monthly token cap; 0 is none }
instanceLimit: { type: integer, description: The server's cap on instanceTokens; 0 is none }
AiInstanceSettings:
type: object
required: [workspaceTokenLimit]
properties:
workspaceTokenLimit:
type: integer
minimum: 0
description: Tokens one workspace may use through the server's profiles per month; 0 is no cap
AiTranscript:
type: object
required: [name, text, summary]
properties:
name: { type: string }
text: { type: string }
summary: { type: string, description: Markdown; empty when not asked for or when it failed }
summaryError: { type: string }