Skip to main content

Documents

Manage documents within workspaces. Documents support hierarchical tree structures, full-text search, export, and public publishing.

Base Path: /api/v1/documents Authentication: Required (Bearer Token) Tag: Documents


List Documents

Retrieve documents in a workspace, optionally filtered by parent.

GET /documents?workspaceId={workspaceId}&parentId={parentId}

Query Parameters

ParameterTypeRequiredDescription
workspaceIdUUIDYesWorkspace to list documents from
parentIdUUIDNoFilter by parent document (root documents if omitted)

Response

{
"success": true,
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Getting Started",
"parentId": null,
"workspaceId": "660e8400-e29b-41d4-a716-446655440000",
"icon": "📚",
"hasChildren": true,
"childCount": 3,
"updatedAt": "2025-01-15T10:30:00Z"
}
]
}

Response Type: ApiResponse<List<DocumentListResponse>>


Get Document Tree

Retrieve the full document tree structure for a workspace.

GET /documents/tree?workspaceId={workspaceId}

Query Parameters

ParameterTypeRequiredDescription
workspaceIdUUIDYesWorkspace ID

Response

{
"success": true,
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Getting Started",
"parentId": null,
"workspaceId": "660e8400-e29b-41d4-a716-446655440000",
"icon": "📚",
"updatedAt": "2025-01-15T10:30:00Z",
"children": [
{
"id": "770e8400-e29b-41d4-a716-446655440000",
"title": "Installation",
"parentId": "550e8400-e29b-41d4-a716-446655440000",
"children": []
}
]
}
]
}

Response Type: ApiResponse<List<DocumentTreeResponse>>


Search Documents

Full-text search across documents in a workspace.

GET /documents/search?workspaceId={workspaceId}&query={query}

Query Parameters

ParameterTypeRequiredDescription
workspaceIdUUIDYesWorkspace to search in
queryStringYesSearch query string

Response

{
"success": true,
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Getting Started",
"icon": "📚",
"parentId": null,
"snippet": "...matching text with <mark>highlighted</mark> terms...",
"matchField": "content"
}
]
}

Response Type: ApiResponse<List<SearchResultResponse>>


Get Document

Retrieve a single document by ID with full content.

GET /documents/{id}

Path Parameters

ParameterTypeDescription
idUUIDDocument ID

Response

{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Getting Started",
"content": "[{\"type\":\"paragraph\",\"content\":[...]}]",
"excerpt": "This guide helps you...",
"parentId": null,
"workspaceId": "660e8400-e29b-41d4-a716-446655440000",
"ownerId": "880e8400-e29b-41d4-a716-446655440000",
"icon": "📚",
"coverImageUrl": null,
"isTemplate": false,
"isArchived": false,
"wordCount": 150,
"hasChildren": true,
"childCount": 3,
"openCommentCount": 2,
"createdBy": "880e8400-e29b-41d4-a716-446655440000",
"lastEditedBy": "990e8400-e29b-41d4-a716-446655440000",
"createdByUser": {
"id": "880e8400-e29b-41d4-a716-446655440000",
"name": "John Doe",
"avatarUrl": "https://..."
},
"lastEditedByUser": {
"id": "990e8400-e29b-41d4-a716-446655440000",
"name": "Jane Smith",
"avatarUrl": "https://..."
},
"isPublished": false,
"createdAt": "2025-01-10T08:00:00Z",
"updatedAt": "2025-01-15T10:30:00Z"
}
}

Response Type: ApiResponse<DocumentResponse>


Get Children

Retrieve direct child documents of a document.

GET /documents/{id}/children

Path Parameters

ParameterTypeDescription
idUUIDParent document ID

Response Type: ApiResponse<List<DocumentListResponse>>


Get Ancestors (Breadcrumb)

Retrieve the ancestor chain from root to the specified document (for breadcrumb navigation).

GET /documents/{id}/ancestors

Path Parameters

ParameterTypeDescription
idUUIDDocument ID

Response

{
"success": true,
"data": [
{ "id": "...", "title": "Root Doc" },
{ "id": "...", "title": "Parent Doc" },
{ "id": "...", "title": "Current Doc" }
]
}

Response Type: ApiResponse<List<DocumentBreadcrumb>>


Create Document

Create a new document in a workspace.

POST /documents

Request Body

{
"title": "New Document",
"workspaceId": "660e8400-e29b-41d4-a716-446655440000",
"parentId": null,
"content": [{"type": "paragraph", "content": []}],
"icon": "📄",
"coverImageUrl": null
}
FieldTypeRequiredValidationDescription
titleStringNoMax 500 charsDocument title
workspaceIdUUIDYesNot nullTarget workspace
parentIdUUIDNo-Parent document (null = root)
contentObjectNo-BlockNote JSON content
iconStringNoMax 50 charsDocument icon/emoji
coverImageUrlStringNo-Cover image URL

Response

Status: 201 Created Response Type: ApiResponse<DocumentResponse>


Update Document

Update an existing document.

PUT /documents/{id}

Path Parameters

ParameterTypeDescription
idUUIDDocument ID

Request Body

{
"title": "Updated Title",
"content": [{"type": "paragraph", "content": []}],
"icon": "📝",
"coverImageUrl": "https://...",
"isArchived": false
}
FieldTypeRequiredValidationDescription
titleStringNoMax 500 charsNew title
contentObjectNo-BlockNote JSON content
iconStringNoMax 50 charsDocument icon
coverImageUrlStringNo-Cover image URL
isArchivedBooleanNo-Archive status

Response Type: ApiResponse<DocumentResponse>


Move Document

Move a document to a different parent or to root level.

PUT /documents/{id}/move

Request Body

{
"parentId": "770e8400-e29b-41d4-a716-446655440000"
}
FieldTypeRequiredDescription
parentIdUUIDNoNew parent document ID (null = move to root)

Response Type: ApiResponse<DocumentResponse>


Delete Document

Delete a document. Children become root-level documents.

DELETE /documents/{id}

Response Type: ApiResponse<Void>


Delete Document (Cascade)

Delete a document and all its children recursively.

DELETE /documents/{id}/cascade
danger

This action is irreversible. All child documents will be permanently deleted.

Response Type: ApiResponse<Void>


Export Document

Export a document to PDF, DOCX, or Markdown format.

GET /documents/{id}/export?format={format}

Query Parameters

ParameterTypeRequiredValuesDescription
formatStringYespdf, docx, markdownExport format

Response

Returns the file as a binary stream with appropriate Content-Type and Content-Disposition headers.

FormatContent-TypeExtension
pdfapplication/pdf.pdf
docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document.docx
markdowntext/markdown.md

Publish Document

Make a document publicly accessible (no authentication required).

POST /documents/{id}/publish

Response Type: ApiResponse<Void>


Unpublish Document

Remove public access from a published document.

POST /documents/{id}/unpublish

Response Type: ApiResponse<Void>