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