Knowledge Base Wiki and Index Governance API
Management and data plane for knowledge base enhanced indexes: LLM Wiki (canonical pages / immutable versions / compilation conflicts and proposals / page link knowledge graph / export to Memory / reset), GraphRAG knowledge graph browsing (node-link graph / community reports / entity neighborhoods), and pluggable index capabilities (graphrag / raptor / wiki) configuration, build/repair operations, and cleanup.
Service and resource boundaries
The Knowledge Base Wiki and Index Governance API (/v1/knowledgebases/...) carries the high-order structured knowledge derivative layer above knowledge bases (e.g. kb_enterprise_support in a showcase project):
Three pluggable derived index capabilities (
index-capabilities): supports per-library independent enabling, configuration, and asynchronous building ofgraphrag(knowledge graph entity relations and community reports),raptor(hierarchical clustering summary tree), andwiki(LLM-auto-compiled Canonical Wiki page set, e.g. the 10 technical support Wiki pages compiled for the showcase library).Human-in-the-loop Wiki governance with Memory integration: supports manual CAS editing of auto-compiled Wiki pages, historical version rollback, adjudication of compilation Conflicts and Proposals, detection of bidirectional link graphs (including red links), and one-click export of approved Wiki pages to the project's Memory service.
Resources and Base Paths
Base URL:
https://<your-endpoint>/v1, path prefix/knowledgebases.Project-level Wiki surface (without
{knowledgeBaseId}):/knowledgebases/wiki/overview|query|search— retrieval across knowledge bases visible within the project.Library-level resources: knowledge base
{knowledgeBaseId}→ GraphRAG knowledge graph (graph, entity{entityId}), index capabilities{capability}(graphrag/raptor/wiki), index operations{operationId}, Wiki pages{slug}→ versions{revisionId}/ conflicts / proposals{proposalId}.Index building is an asynchronous operation:
POST index-operationsandclear/resetreturn202+ an operation object; pollGET index-operations/{operationId}until terminal state.
Authentication and Permissions
For authentication and header conventions, see General conventions. Scopes in this domain: knowledgebases.read (overview/query/search, knowledge graph browsing, capability and operation reads, Wiki page/version/conflict/proposal reads, recommended-limits), knowledgebases.write (capability configuration and cleanup, operation creation and cancellation, Wiki page write/delete/restore/export, conflict resolution, proposal acceptance, reset). Wiki/GraphRAG building and retrieval are executed via the LLM Gateway; export-to-memory additionally requires the current project to have AppBase Memory enabled and activated (see memory).
Endpoint overview
This module contains 28 endpoints in total, divided into four groups: project-level cross-library Wiki overview and search (3), library-level GraphRAG node-edge graph and community report browsing (3), index capability configuration and asynchronous build/repair/cleanup operation management (6), and library-level Wiki pages, historical revisions, conflict resolution, proposal acceptance, and knowledge graph management (16).
Endpoint List
| Method + path | Purpose |
|---|---|
GET /knowledgebases/wiki/overview | Project-level Wiki status cards (filtered by permissions) |
POST /knowledgebases/wiki/query | Query the Wiki index across explicitly selected knowledge bases |
POST /knowledgebases/wiki/search | Search the Wiki index across all visible knowledge bases |
GET /knowledgebases/{knowledgeBaseId}/graph | Browse the active GraphRAG node-link graph |
GET .../graph/community-reports | List active GraphRAG community reports |
GET .../graph/entities/{entityId}/neighbors | Expand an entity neighborhood |
GET /knowledgebases/{knowledgeBaseId}/index-capabilities | List index capabilities and statuses |
PATCH .../index-capabilities/{capability} | Configure an index capability |
POST .../index-capabilities/{capability}/clear | Queue cleanup of a capability's derived indexes |
GET|POST /knowledgebases/{knowledgeBaseId}/index-operations | Index operation list / initiate build or repair |
GET .../index-operations/{operationId} | Index operation details |
POST .../index-operations/{operationId}/cancel | Request cancellation of an index operation |
GET /knowledgebases/{knowledgeBaseId}/wiki/pages | Wiki page list |
POST .../wiki/pages | Create a manually-owned Wiki page |
GET|PATCH|DELETE .../wiki/pages/{slug} (compatibility identifier: .../wiki/pages/{pageId}) | Wiki page read/CAS update/delete |
GET .../wiki/pages/{slug}/revisions | Page version list |
GET .../wiki/pages/{slug}/revisions/{revisionId} | Single version details |
POST .../wiki/pages/{slug}/restore | Restore a historical version (new CAS version) |
POST .../wiki/pages/{slug}/export-to-memory | Export pages to the memory service |
GET .../wiki/conflicts | List of pages with unresolved compilation conflicts |
GET .../wiki/conflicts/{slug}/proposal | Latest compilation proposal for a conflict page |
POST .../wiki/conflicts/{slug}/resolve (compatibility: POST /v1/knowledgebases/{kbId}/wiki/conflicts) | Resolve conflict (CAS) |
GET .../wiki/proposals | List of latest compilation proposals for conflict pages |
POST .../wiki/proposals/{proposalId}/accept (compatibility: POST /v1/knowledgebases/{kbId}/wiki/proposals) | Accept an entire compilation proposal (CAS) |
GET .../wiki/graph | Link graph of canonical Wiki pages (including red links) |
GET .../wiki/recommended-limits | Recommended Wiki compilation limit |
POST .../wiki/reset (action route alias: POST /v1/knowledgebases/{kbId}/reset:wiki) | Delete the entire canonical Wiki and queue a cleanup of the compilation index |
Endpoint details
Index asynchronous operation state machine (
index-operations): triggering a build or repair (POST /knowledgebases/{knowledgeBaseId}/index-operations) returns202 Acceptedand an operation ID; the client polls progress viaGET .../index-operations/{operationId}until it reaches acompleted,failed, orcancelledterminal state.Wiki page optimistic concurrency (
contentRevision): all update, delete, version restore, and conflict resolution requests must carry the page's currentcontentRevisioninteger version number; on version mismatch the server returns409 Conflictto protect manual edits from being overwritten by background automated compilation.
Requests and Responses
The following sections provide, endpoint by endpoint across resource domains, inputs, outputs, and copyable call/response examples. General conventions:
Authentication: all requests carry
X-Appwrite-Project: <YOUR_PROJECT_ID>andX-Appwrite-Key: <YOUR_API_KEY>.Wiki page write operations (update/delete/restore/conflict resolution/proposal acceptance) must always carry
contentRevisionfor optimistic concurrency (CAS): a request is rejected if it does not match the current version.Replace the resource IDs in the examples (
kb_product_docs,refund-policy,ent_0123,op_0001,rev_0007) with actual values.
Common Response Models
The following models are reused across multiple endpoints; complete field tables are given here, while each endpoint's "Output" section only lists key fields and refers back to this section.
Models.KnowledgeBaseWikiPage (Wiki page):
| Field | Type | Description |
|---|---|---|
$id* | string | Wiki page ID. |
$createdAt* / $updatedAt* | string | Creation/last update time (ISO 8601). |
knowledgeBaseId* | string | Owning knowledge base ID. |
slug* | string | Wiki slug, unique within the knowledge base. |
title* | string | Page title. |
pageType* | string | Page type: entity / topic / survey / agent_practice / category_index. |
contentMd* | string | Canonical Markdown content. |
summary | string | Page summary. |
status* | string | Page status: draft / published / conflict / archived. |
pendingConflicts* | object | Structured unresolved conflict metadata. |
conflicts* | object[] | Caller-facing conflict details (see KnowledgeBaseWikiConflict below). |
sourceChunks* / sourceGraph* / sourceMemory* | object | Provenance from three source types: chunk / knowledge graph / memory. |
compiledBy | string | Compiler identifier; null for manually held pages. |
pinned* | boolean | Whether the page is manually pinned. |
viewCount* | integer | Page view count. |
contentRevision* | integer | CAS version number required for write operations. |
embeddingModel | string | Model used by the current projection. |
projectionResultGeneration | string | Derived-result generation containing this page version. |
embeddingUpdatedAt | string | Projection publish time. |
links* | object | Outbound links, including unresolved red links. |
backlinks* | object | Inbound links from other Wiki pages. |
aliases* | object | Aliases pointing to this page. |
conflictEvidence* | object | Hydrated evidence referenced by conflicting content. |
divergenceRecommendations* | object | Recommendation among disputed content options. |
conflictBlocks* | object | Conflict blocks for rendering. |
internalContradictions* / ruleBasedContradictions* | object | Contradictions detected by rules. |
generalKnowledgeConflicts* | object | Conflicts with general knowledge. |
Models.KnowledgeBaseWikiConflict (conflicts[] element):
| Field | Type | Description |
|---|---|---|
id* | string | Stable conflict ID. |
type* | string | Conflict detector classification. |
reason* | string | Human-readable reason for the conflict. |
claim | string | The claim being evaluated (if any). |
conflictingContents* | string[] | Mutually competing original statements. |
sources* | object[] | Source documents/chunks that the competing statements belong to (see below). |
readOnly* | boolean | Whether this conflict requires manual content merging. |
confidence | number | Detector confidence (if any). |
scope | string | Conflict scope (if any). |
recommendedOptionIndex | integer | Index of the recommended option; null when there is no safe recommendation. |
KnowledgeBaseWikiConflictSource (sources[] element): documentId (source document ID), documentName (display name), documentTag (caller-defined locator tag, from metadata.documentTag), chunkId, conflictingContent (conflicting statements attributed to this source), context (bounded context excerpt), locator (object, location metadata such as page/section).
Models.KnowledgeBaseWikiRevision (immutable version/proposal):
| Field | Type | Description |
|---|---|---|
$id* | string | Version ID. |
$createdAt* | string | Version creation time. |
knowledgeBaseId* | string | Knowledge base ID. |
pageId* | string | Wiki page ID. |
pageSlug / pageTitle | string | Page slug / title (carried in proposal list responses). |
actorId | string | Principal that created the version. |
revisionType* | string | Version type. |
titleBefore / titleAfter | string | Previous/new title. |
contentBefore / contentAfter | string | Previous/new Markdown. |
reason | string | Reason for the version. |
Models.KnowledgeBaseIndexOperation (index operation):
| Field | Type | Description |
|---|---|---|
$id* | string | Operation ID. |
$createdAt* / $updatedAt* | string | Creation/last update time. |
knowledgeBaseId* | string | Knowledge base ID. |
capability* | string | Capability identifier: graphrag / raptor / wiki. |
kind* | string | Operation kind (e.g., build / repair). |
scope* | string | Operation scope (knowledgebase / document). |
documentIds* | string[] | Document ID for document-scoped operations. |
status* | string | Lifecycle status: queued / running / succeeded / failed / cancelling / cancelled / clearing / cleared. |
stage | string | Current processing stage. |
progress* | integer | Completion percentage. |
message | string | Current sanitized status message. |
effectiveConfig* | object | Frozen effective configuration. |
configHash* / sourceHash* | string | Effective configuration / frozen source snapshot hash. |
resultGeneration | string | Staged result generation. |
resultVersion | string | Indexer implementation version. |
retryOf | string | Original operation ID when this operation is a retry. |
stats* | object | Operation statistics. |
error* | object | Sanitized operation error. |
logTail | string | Bounded sanitized log tail. |
startedAt / heartbeatAt / finishedAt | string | Processing start / last worker heartbeat / terminal-state completion time. |
Models.KnowledgeBaseIndexCapability (index capability status): capability* (string), available* (boolean, whether the deployment provides this capability), configured* (boolean, whether a configuration has been saved), enabled* (boolean), state* (string, current status), activeResultGeneration (string, active immutable result generation), sourceHash / configHash (string), resultVersion (string), lastOperationId (string), staleReason (string, nullable, reason the result generation expired), stats* (object), error* (object, sanitized last error), config* (object, saved configuration), limits* (object, server-enforced limits).
Models.KnowledgeBaseWikiMutation (delete/reset result): pagesDeleted*, linksDeleted*, linksNulled* (number of inbound links converted to red links), revisionsDeleted*, aliasesDeleted* (all integer), clearOperationId (string, queued Wiki index cleanup operation, if applicable).
Project-Level Wiki Overview and Retrieval
GET /v1/knowledgebases/wiki/overview
SDK:KnowledgeBases.getWikiOverview · scope:knowledgebases.read
Returns permission-filtered Wiki status cards for the current project: it only aggregates visible knowledge bases, and separately distinguishes deployment availability, saved enablement state, index status, page counts, and conflict counts.
Input: no path/query/body parameters.
Output:
200, returns model Models.KnowledgeBaseWikiOverview.
| Field | Type | Description |
|---|---|---|
cards* | object | Permission-filtered per-knowledge-base Wiki status cards (generalized object; card fields are subject to the actual response). |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/wiki/overview" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example (cards is a generalized object for illustration only—fields are subject to the actual response):
{
"cards": []
}POST /v1/knowledgebases/wiki/query
SDK:KnowledgeBases.createWikiQuery · scope:knowledgebases.read
Query the Wiki index across explicitly selected visible knowledge bases: you may specify a routing tier (mode) or leave auto, and use linkOptions for bounded link expansion. Inaccessible knowledge bases are not exposed; capability failures are reported in degradedKnowledgeBases.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseIds | body | string[] | Yes | 1–20 | Knowledge base IDs to query. |
query | body | string | Yes | Wiki query text. | |
mode | body | string | No | Enum: auto / wiki_direct / wiki_retrieved / rag_first | Wiki routing tier override. |
topK | body | integer | No | Number of results returned per knowledge base. | |
useVector | body | boolean | No | Whether to include vector retrieval. | |
vectorWeight | body | number | No | Vector weight before RRF. | |
linkOptions | body | object | No | Bounded Wiki link expansion options (generalized object). |
Output:
200, returns model Models.KnowledgeBaseWikiProjectSearch.
| Field | Type | Description |
|---|---|---|
results* | object | Wiki results grouped by knowledge base and filtered by permissions (generalized object; result fields are subject to the actual response). |
degradedKnowledgeBases* | object | Visible knowledge bases where Wiki is unavailable or not ready (generalized object). |
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/wiki/query" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"knowledgeBaseIds": ["kb_product_docs"],
"query": "退款政策是什么?",
"mode": "auto",
"topK": 5,
"useVector": true,
"vectorWeight": 0.7
}'Response example (results / degradedKnowledgeBases are generalized objects, illustrative—fields are subject to the actual response):
{
"results": [],
"degradedKnowledgeBases": []
}POST /v1/knowledgebases/wiki/search
SDK:KnowledgeBases.createWikiProjectSearch · scope:knowledgebases.read
Search the Wiki index across all visible knowledge bases within the project: returns sorted, revision-fenced results along with explicit degraded knowledge bases. Use createWikiQuery instead when you need to explicitly select knowledge bases.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
query | body | string | Yes | Wiki query text. | |
mode | body | string | No | Enum: auto / wiki_direct / wiki_retrieved / rag_first | Wiki routing tier override. |
topK | body | integer | No | Number of results returned per knowledge base. | |
useVector | body | boolean | No | Whether to include vector retrieval. | |
vectorWeight | body | number | No | Vector weight before RRF. | |
linkOptions | body | object | No | Bounded Wiki link expansion options (generalized object). |
Output:
200, returning model Models.KnowledgeBaseWikiProjectSearch (fields as above: results*, degradedKnowledgeBases*).
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/wiki/search" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"query": "退款政策是什么?",
"mode": "auto",
"topK": 5
}'Response example (generalized object, illustrative—fields are subject to the actual response):
{
"results": [],
"degradedKnowledgeBases": []
}GraphRAG knowledge graph
GET /v1/knowledgebases/{knowledgeBaseId}/graph
SDK:KnowledgeBases.getGraph · scope:knowledgebases.read
Browse a bounded snapshot of the active GraphRAG result generation: filter entities by text/type/community, or give seed + hops for bounded graph exploration. When hasMore=true, follow nextCursor for pagination; truncated=true indicates the response is only a bounded subset of the graph.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
query | query | string | No | Default "" | Entity text filter. |
type | query | string | No | Default "" | Entity type filter. |
community | query | string | No | Default "" | Community filter. |
seed | query | string | No | Default "" | Entity seed for bounded N-hop expansion. |
hops | query | integer | No | Default 1 | Number of neighborhood hops when seed is provided. |
limit | query | integer | No | Default 100 | Maximum number of nodes returned. |
cursor | query | string | No | Default "" | Opaque cursor returned by the previous page. |
Output:
200, returns model Models.KnowledgeBaseGraph.
| Field | Type | Description |
|---|---|---|
resultGeneration* | string | Active GraphRAG result generation. |
graph* | object | Filtered node-link graph snapshot ({nodes, edges} structure; fields are subject to the actual response). |
totalNodes* | integer | Total number of nodes matching the current filters. |
hasMore* | boolean | Whether there is a next page. |
nextCursor | string | Opaque cursor for the next page. |
truncated* | boolean | Whether the returned graph is a bounded subset. |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/graph?query=退款&limit=100" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"resultGeneration": "gen_0007",
"graph": {
"nodes": [
{
"id": "ent_ob_paxos",
"name": "OceanBase Paxos 日志同步",
"type": "Component",
"communityId": "comm_ha_01",
"degree": 9,
"description": "OceanBase 多副本多数派强一致日志复制协议核心模块"
},
{
"id": "ent_clog_disk_full",
"name": "CLOG 盘满告警 (ERROR 4016)",
"type": "ErrorCode",
"communityId": "comm_ha_01",
"degree": 6,
"description": "日志盘使用率达到 log_disk_utilization_limit_threshold 触发写停止"
}
],
"edges": [
{
"source": "ent_clog_disk_full",
"target": "ent_ob_paxos",
"relation": "BLOCKS_REPLICATION",
"weight": 0.94,
"evidenceChunkIds": ["chk_0042"]
}
]
},
"totalNodes": 2,
"hasMore": false,
"nextCursor": "",
"truncated": false
}GET /v1/knowledgebases/{knowledgeBaseId}/graph/community-reports
SDK:KnowledgeBases.listGraphCommunityReports · scope:knowledgebases.read
List community reports for the active GraphRAG result generation: each contains the community identifier, title, entities, weight, and report payload.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
limit | query | integer | No | Default 100 | Maximum number of reports returned. |
offset | query | integer | No | Default 0 | Number of reports to skip. |
Output:
200, returns model Models.KnowledgeBaseGraphCommunityReportList.
| Field | Type | Description |
|---|---|---|
resultGeneration* | string | Active GraphRAG result generation. |
reports* | object[] | List of community reports (elements are Models.KnowledgeBaseGraphCommunityReport; subfields are listed below). |
id* | string | Community report record ID. |
communityId* | string | Community identifier. |
title* | string | Report title. |
entities* | string[] | Entities covered by the report. |
weight* | number | Report weight. |
content* | object | Structured report content and evidence (generalized object). |
hasMore* | boolean | Whether there are more reports. |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/graph/community-reports?limit=100&offset=0" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"resultGeneration": "gen_0007",
"reports": [
{
"id": "cr_0001",
"communityId": "community_3",
"title": "退款与售后",
"entities": ["ent_0123"],
"weight": 0.82,
"content": {}
}
],
"hasMore": false
}GET /v1/knowledgebases/{knowledgeBaseId}/graph/entities/{entityId}/neighbors
SDK:KnowledgeBases.getGraphEntityNeighbors · scope:knowledgebases.read
Expand the bounded neighborhood of a single entity within the active GraphRAG result generation. hops only affects graph exploration and does not change the GraphRAG retrieval algorithm.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
entityId | path | string | Yes | Graph entity ID. | |
hops | query | integer | No | Default 1 | Neighborhood hops. |
limit | query | integer | No | Default 100 | Maximum number of nodes returned. |
Output:
200, returns model Models.KnowledgeBaseGraphNeighbors.
| Field | Type | Description |
|---|---|---|
resultGeneration* | string | Active GraphRAG result generation. |
nodes* | object | Nodes reached from the seed (generalized object). |
edges* | object | Edges induced by the reached nodes (generalized object). |
truncated* | boolean | Whether the expansion hit the request limit. |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/graph/entities/ent_0123/neighbors?hops=1&limit=100" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example (nodes / edges are generalized objects, illustrative—fields are subject to the actual response):
{
"resultGeneration": "gen_0007",
"nodes": [
{
"id": "ent_0123",
"name": "OceanBase 向量索引 (HNSW)",
"type": "Component",
"communityId": "comm_vec_02"
},
{
"id": "ent_ob_mem",
"name": "ob_vector_memory_limit_percentage",
"type": "Parameter",
"communityId": "comm_vec_02"
}
],
"edges": [
{
"source": "ent_0123",
"target": "ent_ob_mem",
"relation": "DEPENDS_ON_PARAMETER",
"weight": 0.91
}
],
"truncated": false
}Index capabilities (index-capabilities)
GET /v1/knowledgebases/{knowledgeBaseId}/index-capabilities
SDK:KnowledgeBases.listIndexCapabilities · scope:knowledgebases.read
List deployment availability, saved configurations, lifecycle status, active result generations, limits, statistics, and sanitized errors for the three pluggable index capabilities: GraphRAG, RAPTOR, and LLM Wiki. available, enabled, and state are three independent signals: a temporarily unhealthy indexer does not erase the saved configuration or the active result generation.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. |
Output:
200, returns model Models.KnowledgeBaseIndexCapabilityList.
| Field | Type | Description |
|---|---|---|
capabilities* | object[] | List of capabilities, with elements of type Models.KnowledgeBaseIndexCapability (fields see "Common response models"). |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/index-capabilities" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"capabilities": [
{
"capability": "wiki",
"available": true,
"configured": true,
"enabled": true,
"state": "ready",
"activeResultGeneration": "gen_0007",
"sourceHash": "sha256:…",
"configHash": "sha256:…",
"resultVersion": "1.0.0",
"lastOperationId": "op_0001",
"staleReason": null,
"stats": {},
"error": {},
"config": {
"enabled": true
},
"limits": {}
}
]
}PATCH /v1/knowledgebases/{knowledgeBaseId}/index-capabilities/{capability}
SDK:KnowledgeBases.updateIndexCapability · scope:knowledgebases.write
Wholesale replacement of the saved configuration for a graphrag / raptor / wiki capability. For capabilities that call a Chat LLM, first configure the knowledge base's indexingDefaults. Enabling a capability unavailable in the deployment returns knowledge_index_capability_unavailable; disabling preserves existing result generations and history.
All three capabilities accept config.language to control the generation language: auto (default, detected from source content) / zh / en / ja; an explicit value overrides source language detection.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID (e.g., kb_enterprise_support). | |
capability | path | string | Yes | Enum: graphrag / raptor / wiki | Index capability identifier. |
config | body | object | Yes | Full capability configuration object (specific subfields vary by capability; see the table below). | |
versionId | body | string | No | DRAFT version ID is required for writes when versioning is active. | |
config.enabled | body | boolean | No | Default false | Enables the index capability. |
config.language | body | string | No | auto / zh / en / ja; default auto | Controls output language. |
config.entityTypes (graphrag) | body | string[] | No | System defaults when omitted | GraphRAG entity types. |
config.lexiconEnabled (graphrag) | body | boolean | No | Default false | Uses bound lexicons during graph construction. |
config.graphragEmbedBatchSize (graphrag) | body | integer | No | 1–256; Worker setting when omitted | Embedding batch size; out-of-range values are clamped. |
config.scope (raptor) | body | string | No | document / knowledgeBase; default document | Summary index build scope. |
config.maxToken (raptor) | body | integer | No | Default 256, range 1–2048 | Summary token limit. |
config.maxCluster (raptor) | body | integer | No | Default 64, range 1–1024 | Maximum cluster count. |
config.threshold (raptor) | body | number | No | Default 0.1, range 0–1 | Cluster threshold. |
config.autoCompileWaitForGraphRag (wiki) | body | boolean | No | Default true | Whether automatic compilation waits for GraphRAG. |
config.wikiPageMaxConcurrent (wiki) | body | integer | No | 1–16; Worker setting when omitted | Page generation concurrency; out-of-range values are clamped. |
config.autoCompileSources (wiki) | body | string[] | No | rag / graphrag / memory | Automatic compilation sources. |
config.sources (wiki) | body | string[] | No | rag / graphrag / memory | Manual compilation sources. |
Output:
200, returning model Models.KnowledgeBaseIndexCapability (fields see "Common response models").
Call examples (configuring the three major capabilities graphrag, raptor, and wiki respectively):
Set APPBASE_ENDPOINT to the target API endpoint (including /v1), and confirm the project and credentials belong to that environment. Run each operation separately as needed. These examples omit versionId and apply to unversioned knowledge bases; when versioning is enabled, supply a DRAFT version ID in the request body. PATCH replaces the entire config; read and preserve needed fields before updating.
Configure GraphRAG capabilities (specify entity types, enable lexicon canonical term alignment and vector batch size)
(
set +x
set -o pipefail
: "${APPBASE_API_KEY:?Set APPBASE_API_KEY}"
: "${APPBASE_ENDPOINT:?Set APPBASE_ENDPOINT to the target API endpoint including /v1}"
APPBASE_ENDPOINT="${APPBASE_ENDPOINT%/}"
builtin printf 'X-Appwrite-Key: %s\n' "$APPBASE_API_KEY" | curl --disable -X PATCH "${APPBASE_ENDPOINT}/knowledgebases/kb_enterprise_support/index-capabilities/graphrag" \
-H "X-Appwrite-Project: enterprise-ai-hub-210" \
--header @- \
-H "Content-Type: application/json" \
-d '{
"config": {
"enabled": true,
"language": "zh",
"entityTypes": ["Product", "Component", "ErrorCode", "Parameter", "SOP"],
"lexiconEnabled": true,
"graphragEmbedBatchSize": 32
}
}'
)Configure RAPTOR summaries (knowledgeBase or document scope)
(
set +x
set -o pipefail
: "${APPBASE_API_KEY:?Set APPBASE_API_KEY}"
: "${APPBASE_ENDPOINT:?Set APPBASE_ENDPOINT to the target API endpoint including /v1}"
APPBASE_ENDPOINT="${APPBASE_ENDPOINT%/}"
builtin printf 'X-Appwrite-Key: %s\n' "$APPBASE_API_KEY" | curl --disable -X PATCH "${APPBASE_ENDPOINT}/knowledgebases/kb_enterprise_support/index-capabilities/raptor" \
-H "X-Appwrite-Project: enterprise-ai-hub-210" \
--header @- \
-H "Content-Type: application/json" \
-d '{
"config": {
"enabled": true,
"language": "zh",
"scope": "knowledgeBase",
"maxToken": 256,
"maxCluster": 64,
"threshold": 0.1
}
}'
)Configure Wiki automatic compilation sources and concurrency
(
set +x
set -o pipefail
: "${APPBASE_API_KEY:?Set APPBASE_API_KEY}"
: "${APPBASE_ENDPOINT:?Set APPBASE_ENDPOINT to the target API endpoint including /v1}"
APPBASE_ENDPOINT="${APPBASE_ENDPOINT%/}"
builtin printf 'X-Appwrite-Key: %s\n' "$APPBASE_API_KEY" | curl --disable -X PATCH "${APPBASE_ENDPOINT}/knowledgebases/kb_enterprise_support/index-capabilities/wiki" \
-H "X-Appwrite-Project: enterprise-ai-hub-210" \
--header @- \
-H "Content-Type: application/json" \
-d '{
"config": {
"enabled": true,
"language": "zh",
"autoCompileWaitForGraphRag": true,
"wikiPageMaxConcurrent": 4,
"autoCompileSources": ["rag", "graphrag"]
}
}'
)Response example:
{
"capability": "wiki",
"available": true,
"configured": true,
"enabled": true,
"state": "ready",
"activeResultGeneration": "gen_0007",
"sourceHash": "sha256:…",
"configHash": "sha256:…",
"resultVersion": "1.0.0",
"lastOperationId": "op_0001",
"staleReason": null,
"stats": {},
"error": {},
"config": {
"enabled": true,
"language": "auto"
},
"limits": {}
}POST /v1/knowledgebases/{knowledgeBaseId}/index-capabilities/{capability}/clear
SDK:KnowledgeBases.clearIndexCapability · scope:knowledgebases.write
Queue a cleanup of a capability's derived indexes. confirmation must be clear:<capability>; idempotencyKey makes retries safe. Source documents, chunks, other capabilities, and canonical Wiki pages/versions are all preserved—to delete canonical Wiki content, use resetWiki.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
capability | path | string | Yes | Enum: graphrag / raptor / wiki | Capability identifier. |
confirmation | body | string | Yes | In the form of clear:<capability> | Explicit confirmation. |
idempotencyKey | body | string | Yes | Stable key for idempotent retries. |
Output:
202, returns model Models.KnowledgeBaseIndexOperation (cleanup operation; see fields in "Common Response Models"); poll GET index-operations/{operationId} until terminal state.
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/index-capabilities/wiki/clear" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"confirmation": "clear:wiki",
"idempotencyKey": "clear-wiki-20260918-0001"
}'Response example:
{
"$id": "op_0002",
"$createdAt": "2026-09-18T03:00:00.000+00:00",
"$updatedAt": "2026-09-18T03:00:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"capability": "wiki",
"kind": "build",
"scope": "knowledgebase",
"documentIds": [],
"status": "queued",
"stage": "",
"progress": 0,
"message": "",
"effectiveConfig": {},
"configHash": "sha256:…",
"sourceHash": "sha256:…",
"stats": {},
"error": {}
}Index Operations (index-operations)
GET /v1/knowledgebases/{knowledgeBaseId}/index-operations
SDK:KnowledgeBases.listIndexOperations · scope:knowledgebases.read
List the index operations of a knowledge base: filter by capability and lifecycle state, with pagination. Operation history remains visible even when a capability is disabled or unavailable.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
capability | query | string | No | Enum: graphrag / raptor / wiki | Capability filter. |
status | query | string | No | Enum: queued / running / succeeded / failed / cancelling / cancelled / clearing / cleared | Operation status filter. |
limit | query | integer | No | Default 25 | Maximum number of operations to return. |
offset | query | integer | No | Default 0 | Number of operations to skip. |
Output:
200, returns model Models.KnowledgeBaseIndexOperationList.
| Field | Type | Description |
|---|---|---|
total* | integer | Total number of operations matching the query. |
operations* | object[] | List of operations, with elements of Models.KnowledgeBaseIndexOperation (see fields in "Common Response Models"). |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/index-operations?capability=wiki&status=running&limit=25" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"total": 1,
"operations": [
{
"$id": "op_0001",
"$createdAt": "2026-09-18T02:40:00.000+00:00",
"$updatedAt": "2026-09-18T02:41:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"capability": "wiki",
"kind": "build",
"scope": "knowledgebase",
"documentIds": [],
"status": "running",
"stage": "compile",
"progress": 40,
"message": "",
"effectiveConfig": {},
"configHash": "sha256:…",
"sourceHash": "sha256:…",
"stats": {},
"error": {}
}
]
}POST /v1/knowledgebases/{knowledgeBaseId}/index-operations
SDK:KnowledgeBases.createIndexOperation · scope:knowledgebases.write
Queue a build or repair operation for a pluggable index capability. Key points:
When the effective RAPTOR configuration is document-scoped, use
scope=documentand pass thedocumentIdsof existing indexable chunks—the scope of the configuration and the operation must match.Wiki
sourcesacceptsrag,graphrag, andmemory; RAPTOR summaries automatically enhanceragand are not a separate source value.Both the Server SDK value
knowledgebaseand the HTTP defaultknowledgeBaserepresent knowledge base scope.Use a new, unique
idempotencyKeyfor each independent build or repair; reuse the original key only when retrying the same request, or an old job may be returned.force=truefirst requests cancellation of an active conflicting operation before queueing a new one.For GraphRAG, pass
config.forceRebuildastrueto skip the incremental seed and re-extract for this job; this differs fromforce, which cancels a conflicting operation.Poll the returned operation until it reaches a terminal state.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
versionId | body | string | No | Required to target a DRAFT when versioning is enabled. | |
capability | body | string | Yes | Enum: graphrag / raptor / wiki | Capability identifier. |
kind | body | string | No | Enum: build / repair | Operation kind. |
scope | body | string | No | Enum: knowledgebase / document | Operation scope. |
documentIds | body | string[] | No | Document ID for document-scoped operations. | |
config | body | object | No | Operation-level configuration overrides (generalized object). | |
force | body | boolean | No | Cancel another active operation before queueing. | |
idempotencyKey | body | string | Yes | Stable key for idempotent retries. | |
retryOf | body | string | No | ID of a failed or cancelled operation in the same capability and version. The service reuses its scope and document list; check the original target first. Omit this field to start a repair with a new scope. |
Output:
202, returning model Models.KnowledgeBaseIndexOperation (fields see "Common response models").
Call example:
Set APPBASE_ENDPOINT to the target API endpoint (including /v1), and confirm the project and credentials belong to that environment. Run each operation separately as needed. These examples omit versionId and apply to unversioned knowledge bases; when versioning is enabled, supply a DRAFT version ID in the request body.
Trigger a full knowledge base GraphRAG build (kind=build)
(
set +x
set -o pipefail
: "${APPBASE_API_KEY:?Set APPBASE_API_KEY}"
: "${APPBASE_ENDPOINT:?Set APPBASE_ENDPOINT to the target API endpoint including /v1}"
APPBASE_ENDPOINT="${APPBASE_ENDPOINT%/}"
builtin printf 'X-Appwrite-Key: %s\n' "$APPBASE_API_KEY" | curl --disable -X POST "${APPBASE_ENDPOINT}/knowledgebases/kb_enterprise_support/index-operations" \
-H "X-Appwrite-Project: enterprise-ai-hub-210" \
--header @- \
-H "Content-Type: application/json" \
-d '{
"capability": "graphrag",
"kind": "build",
"scope": "knowledgebase",
"idempotencyKey": "<NEW_GRAPHRAG_BUILD_KEY>"
}'
)Start a new single-document RAPTOR repair operation (kind=repair, scope=document; not a retry of an earlier job)
(
set +x
set -o pipefail
: "${APPBASE_API_KEY:?Set APPBASE_API_KEY}"
: "${APPBASE_ENDPOINT:?Set APPBASE_ENDPOINT to the target API endpoint including /v1}"
APPBASE_ENDPOINT="${APPBASE_ENDPOINT%/}"
builtin printf 'X-Appwrite-Key: %s\n' "$APPBASE_API_KEY" | curl --disable -X POST "${APPBASE_ENDPOINT}/knowledgebases/kb_enterprise_support/index-operations" \
-H "X-Appwrite-Project: enterprise-ai-hub-210" \
--header @- \
-H "Content-Type: application/json" \
-d '{
"capability": "raptor",
"kind": "repair",
"scope": "document",
"documentIds": ["doc_manual_v2"],
"idempotencyKey": "<NEW_RAPTOR_REPAIR_KEY>"
}'
)Trigger LLM Wiki building (kind=build)
(
set +x
set -o pipefail
: "${APPBASE_API_KEY:?Set APPBASE_API_KEY}"
: "${APPBASE_ENDPOINT:?Set APPBASE_ENDPOINT to the target API endpoint including /v1}"
APPBASE_ENDPOINT="${APPBASE_ENDPOINT%/}"
builtin printf 'X-Appwrite-Key: %s\n' "$APPBASE_API_KEY" | curl --disable -X POST "${APPBASE_ENDPOINT}/knowledgebases/kb_product_docs/index-operations" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
--header @- \
-H "Content-Type: application/json" \
-d '{
"capability": "wiki",
"kind": "build",
"scope": "knowledgebase",
"idempotencyKey": "<NEW_WIKI_BUILD_KEY>"
}'
)Response example:
{
"$id": "op_0001",
"$createdAt": "2026-09-18T02:40:00.000+00:00",
"$updatedAt": "2026-09-18T02:40:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"capability": "wiki",
"kind": "build",
"scope": "knowledgebase",
"documentIds": [],
"status": "queued",
"stage": "",
"progress": 0,
"message": "",
"effectiveConfig": {},
"configHash": "sha256:…",
"sourceHash": "sha256:…",
"stats": {},
"error": {}
}GET /v1/knowledgebases/{knowledgeBaseId}/index-operations/{operationId}
SDK:KnowledgeBases.getIndexOperation · scope:knowledgebases.read
Read a single index operation: frozen effective configuration, source/config hashes, progress, bounded log tail, result generation, statistics, redacted errors, and timestamps.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
operationId | path | string | Yes | Index operation ID. |
Output:
200, returning model Models.KnowledgeBaseIndexOperation (fields see "Common response models").
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/index-operations/op_0001" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"$id": "op_0001",
"$createdAt": "2026-09-18T02:40:00.000+00:00",
"$updatedAt": "2026-09-18T02:44:30.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"capability": "wiki",
"kind": "build",
"scope": "knowledgebase",
"documentIds": [],
"status": "succeeded",
"stage": "publish",
"progress": 100,
"message": "",
"effectiveConfig": {},
"configHash": "sha256:…",
"sourceHash": "sha256:…",
"resultGeneration": "gen_0007",
"resultVersion": "1.0.0",
"stats": {},
"error": {},
"logTail": "",
"startedAt": "2026-09-18T02:40:05.000+00:00",
"heartbeatAt": "2026-09-18T02:44:25.000+00:00",
"finishedAt": "2026-09-18T02:44:30.000+00:00"
}POST /v1/knowledgebases/{knowledgeBaseId}/index-operations/{operationId}/cancel
SDK:KnowledgeBases.cancelIndexOperation · scope:knowledgebases.write
Request cancellation of a queued or running index operation. Cancellation is fenced by attempt: once a newer attempt takes over, a stale worker can no longer publish results. Poll the operation until it becomes cancelled or another terminal state.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
operationId | path | string | Yes | Index operation ID. |
No request body.
Output:
202, returning model Models.KnowledgeBaseIndexOperation (fields see "Common response models").
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/index-operations/op_0001/cancel" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"$id": "op_0001",
"$createdAt": "2026-09-18T02:40:00.000+00:00",
"$updatedAt": "2026-09-18T02:41:10.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"capability": "wiki",
"kind": "build",
"scope": "knowledgebase",
"documentIds": [],
"status": "cancelling",
"stage": "compile",
"progress": 40,
"message": "",
"effectiveConfig": {},
"configHash": "sha256:…",
"sourceHash": "sha256:…",
"stats": {},
"error": {}
}Wiki Pages
GET /v1/knowledgebases/{knowledgeBaseId}/wiki/pages
SDK:KnowledgeBases.listWikiPages · scope:knowledgebases.read
List canonical Wiki pages in a knowledge base: filter by page type or publication status, with pagination. The list returns canonical page records; call getWikiPage when the latest details are needed.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
pageType | query | string | No | Enum: entity / topic / survey / agent_practice / category_index | Page type filter. |
status | query | string | No | Enum: draft / published / conflict / archived | Page status filter. |
limit | query | integer | No | Default 50 | Maximum number of pages to return. |
offset | query | integer | No | Default 0 | Number of pages to skip. |
Output:
200, returns model Models.KnowledgeBaseWikiPageList.
| Field | Type | Description |
|---|---|---|
total* | integer | Total number of pages matching the query. |
pages* | object[] | List of pages, with elements of Models.KnowledgeBaseWikiPage (see fields in "Common Response Models"). |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages?pageType=entity&status=published&limit=50" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"total": 1,
"pages": [
{
"$id": "wp_0001",
"$createdAt": "2026-09-10T08:00:00.000+00:00",
"$updatedAt": "2026-09-17T09:30:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "refund-policy",
"title": "退款政策",
"pageType": "entity",
"contentMd": "# 退款政策\n…",
"summary": "退款条件与时效",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": null,
"pinned": false,
"viewCount": 12,
"contentRevision": 3,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}
]
}POST /v1/knowledgebases/{knowledgeBaseId}/wiki/pages
SDK:KnowledgeBases.createWikiPage · scope:knowledgebases.write
Create a human-authored canonical Wiki page: may include Markdown, aliases, and explicit outgoing links; [[slug]] links in the Markdown are also extracted server-side, and unresolved targets are kept as red links. This operation creates the first immutable version.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | body | string | Yes | Wiki page slug, unique within the knowledge base. | |
title | body | string | Yes | Page title. | |
pageType | body | string | No | Enum: entity / topic / survey / agent_practice / category_index | Page type. |
contentMd | body | string | No | Canonical Markdown content. | |
summary | body | string | No | Page summary. | |
status | body | string | No | Enum: draft / published / conflict / archived | Page status. |
pinned | body | boolean | No | Whether manually pinned. | |
links | body | object | No | Explicit outgoing links (generalized object). | |
aliases | body | object | No | Manual aliases (generalized object). | |
reason | body | string | No | Reason for the version. |
Output:
201, returning model Models.KnowledgeBaseWikiPage (fields see "Common response models").
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"slug": "refund-policy",
"title": "退款政策",
"pageType": "entity",
"contentMd": "# 退款政策\n\n签收后 7 日内可申请退款,详见 [[after-sale-flow]]。",
"summary": "退款条件与时效",
"status": "published",
"reason": "人工整理退款政策"
}'Response example:
{
"$id": "wp_0001",
"$createdAt": "2026-09-18T03:10:00.000+00:00",
"$updatedAt": "2026-09-18T03:10:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "refund-policy",
"title": "退款政策",
"pageType": "entity",
"contentMd": "# 退款政策\n\n签收后 7 日内可申请退款,详见 [[after-sale-flow]]。",
"summary": "退款条件与时效",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": null,
"pinned": false,
"viewCount": 0,
"contentRevision": 1,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}GET /v1/knowledgebases/{knowledgeBaseId}/wiki/pages/{slug} (compatibility identifiers: GET /v1/knowledgebases/{kbId}/wiki/pages/{pageId})
SDK:KnowledgeBases.getWikiPage · scope:knowledgebases.read
Read a canonical Wiki page by its slug (or page $id / pageId): outgoing links, backlinks, aliases, source provenance, projected result generation, unresolved conflicts, and hydration conflict evidence.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. |
Output:
200, returns model Models.KnowledgeBaseWikiPage (see fields in "Common Response Models"). Key fields: contentRevision* (CAS version number for subsequent write operations), conflicts*, links* / backlinks* / aliases*.
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages/refund-policy" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"$id": "wp_0001",
"$createdAt": "2026-09-18T03:10:00.000+00:00",
"$updatedAt": "2026-09-18T03:10:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "refund-policy",
"title": "退款政策",
"pageType": "entity",
"contentMd": "# 退款政策\n…",
"summary": "退款条件与时效",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": null,
"pinned": false,
"viewCount": 12,
"contentRevision": 1,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}PATCH /v1/knowledgebases/{knowledgeBaseId}/wiki/pages/{slug} (compatibility identifiers: PATCH /v1/knowledgebases/{kbId}/wiki/pages/{pageId})
SDK:KnowledgeBases.updateWikiPage · scope:knowledgebases.write
Update a canonical Wiki page with optimistic concurrency (the path accepts a page slug or pageId): contentRevision must match the current page version. The page object carries the fields to change; omitting links / aliases means they are preserved. A successful write creates an immutable version and refreshes retrieval projections.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Current Wiki page slug. | |
contentRevision | body | integer | Yes | Expected current content version number. | |
page | body | object | Yes | Fields to update: slug, title, pageType, contentMd, summary, status, or pinned. | |
links | body | object | No | Replaces outgoing links; if omitted, they are preserved. | |
aliases | body | object | No | Replaces manual aliases; if omitted, they are preserved. | |
reason | body | string | No | Reason for the version. |
Output:
200, returning model Models.KnowledgeBaseWikiPage (fields see "Common response models").
Call example:
curl -X PATCH "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages/refund-policy" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contentRevision": 1,
"page": {
"contentMd": "# 退款政策\n\n签收后 7 日内可申请退款(定制商品除外),详见 [[after-sale-flow]]。"
},
"reason": "补充定制商品例外"
}'Response example:
{
"$id": "wp_0001",
"$createdAt": "2026-09-18T03:10:00.000+00:00",
"$updatedAt": "2026-09-18T03:25:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "refund-policy",
"title": "退款政策",
"pageType": "entity",
"contentMd": "# 退款政策\n\n签收后 7 日内可申请退款(定制商品除外),详见 [[after-sale-flow]]。",
"summary": "退款条件与时效",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": null,
"pinned": false,
"viewCount": 12,
"contentRevision": 2,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}DELETE /v1/knowledgebases/{knowledgeBaseId}/wiki/pages/{slug}
SDK:KnowledgeBases.deleteWikiPage · scope:knowledgebases.write
Delete a canonical Wiki page: confirmation must be delete:<slug>, and contentRevision must match the current version. This is a destructive operation that deletes the canonical page; version/audit records are retained as defined by the server (DELETE carries a JSON request body).
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. | |
contentRevision | body | integer | Yes | Expected current page version number. | |
confirmation | body | string | Yes | In the form of delete:<slug> | Explicit confirmation. |
Output:
200, returning model Models.KnowledgeBaseWikiMutation (fields see "Common response models").
Call example:
curl -X DELETE "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages/refund-policy" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contentRevision": 2,
"confirmation": "delete:refund-policy"
}'Response example:
{
"pagesDeleted": 1,
"linksDeleted": 1,
"linksNulled": 0,
"revisionsDeleted": 2,
"aliasesDeleted": 0,
"clearOperationId": "op_0003"
}GET /v1/knowledgebases/{knowledgeBaseId}/wiki/pages/{slug}/revisions
SDK:KnowledgeBases.listWikiPageRevisions · scope:knowledgebases.read
List the immutable versions of a canonical Wiki page: including body, version type, before/after content, reason, and creation time; can be used together with restoreWikiPage.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. | |
limit | query | integer | No | Default 50 | Maximum number of versions to return. |
Output:
200, returns model Models.KnowledgeBaseWikiRevisionList.
| Field | Type | Description |
|---|---|---|
total* | integer | Total number of versions matching the query. |
revisions* | object[] | List of versions, with elements of Models.KnowledgeBaseWikiRevision (see fields in "Common Response Models"). |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages/refund-policy/revisions?limit=50" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"total": 1,
"revisions": [
{
"$id": "rev_0007",
"$createdAt": "2026-09-18T03:10:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"pageId": "wp_0001",
"revisionType": "create",
"titleAfter": "退款政策",
"contentAfter": "# 退款政策\n…",
"reason": "人工整理退款政策"
}
]
}GET /v1/knowledgebases/{knowledgeBaseId}/wiki/pages/{slug}/revisions/{revisionId}
SDK:KnowledgeBases.getWikiPageRevision · scope:knowledgebases.read
Read a single immutable version of a canonical Wiki page.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. | |
revisionId | path | string | Yes | Wiki version ID. |
Output:
200, returning model Models.KnowledgeBaseWikiRevision (fields see "Common response models").
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages/refund-policy/revisions/rev_0007" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"$id": "rev_0007",
"$createdAt": "2026-09-18T03:10:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"pageId": "wp_0001",
"revisionType": "create",
"titleAfter": "退款政策",
"contentAfter": "# 退款政策\n…",
"reason": "人工整理退款政策"
}POST /v1/knowledgebases/{knowledgeBaseId}/wiki/pages/{slug}/restore
SDK:KnowledgeBases.restoreWikiPage · scope:knowledgebases.write
Restore a historical version as a new version: contentRevision provides an optimistic concurrency fence; the historical version itself is never rewritten. Omitting links means the current outgoing links are preserved.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. | |
revisionId | body | string | Yes | Version ID to restore. | |
contentRevision | body | integer | Yes | Expected current content version number. | |
links | body | object | No | Replaces outgoing links; if omitted, they are preserved. | |
reason | body | string | No | Reason for the restore. |
Output:
200, returning model Models.KnowledgeBaseWikiPage (fields see "Common response models").
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages/refund-policy/restore" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"revisionId": "rev_0007",
"contentRevision": 2,
"reason": "回退到人工整理版"
}'Response example:
{
"$id": "wp_0001",
"$createdAt": "2026-09-18T03:10:00.000+00:00",
"$updatedAt": "2026-09-18T03:40:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "refund-policy",
"title": "退款政策",
"pageType": "entity",
"contentMd": "# 退款政策\n…",
"summary": "退款条件与时效",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": null,
"pinned": false,
"viewCount": 12,
"contentRevision": 3,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}POST /v1/knowledgebases/{knowledgeBaseId}/wiki/pages/{slug}/export-to-memory
SDK:KnowledgeBases.createWikiPageMemoryExport · scope:knowledgebases.write
Export a canonical Wiki page as facts to the existing AppBase Memory service. Prerequisites: the current project must already have an active AppBase Memory project (enabling the knowledge base does not automatically create one); returns 503 memory_service_unavailable if the Memory service is disabled, initializing, missing, or unavailable. The caller must be able to write to the knowledge base and the target Memory scope; the response never exposes any model or provider credentials.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. | |
agentId | body | string | No | Memory agent identity for the exported facts. |
Output:
201, returns model Models.KnowledgeBaseWikiMemoryExport.
| Field | Type | Description |
|---|---|---|
memory* | object | The Memory service's response for the exported page (generalized object; fields depend on the actual response). |
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/pages/refund-policy/export-to-memory" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"agentId": "agent_support_bot"
}'Response example (memory is a generalized object for illustration only—fields are subject to the actual response):
{
"memory": {}
}Wiki Conflicts and Proposals
GET /v1/knowledgebases/{knowledgeBaseId}/wiki/conflicts
SDK:KnowledgeBases.listWikiConflicts · scope:knowledgebases.read
List canonical Wiki pages that still contain unresolved compile conflicts: each page includes the current contentRevision, original pendingConflicts metadata, and a caller-facing conflicts array. The response's total is the total number of pages with unresolved conflicts, not the number returned on the current page.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
limit | query | integer | No | Default 100 | Maximum number of conflict pages to return. |
offset | query | integer | No | Default 0 | Number of conflict pages to skip. |
Output:
200, returns model Models.KnowledgeBaseWikiPageList (total* + pages*[]; page fields see "Common Response Models"; conflicts[] contains the stable conflict id, detector type, human-readable reason, exact conflictingContents, and ownership sources).
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/conflicts?limit=100&offset=0" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"total": 1,
"pages": [
{
"$id": "wp_0002",
"$createdAt": "2026-09-12T08:00:00.000+00:00",
"$updatedAt": "2026-09-17T10:00:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "shipping-time",
"title": "发货时效",
"pageType": "topic",
"contentMd": "# 发货时效\n…",
"status": "conflict",
"pendingConflicts": [],
"conflicts": [
{
"id": "cf_0001",
"type": "contradiction",
"reason": "两处来源对发货时效表述不一致",
"conflictingContents": ["48 小时内发货", "72 小时内发货"],
"sources": [
{
"documentId": "doc_manual_v2",
"documentName": "售后手册 v2",
"chunkId": "chk_0042",
"conflictingContent": "48 小时内发货",
"context": "…工作日订单 48 小时内发货…",
"locator": {}
}
],
"readOnly": false,
"confidence": 0.91
}
],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": "wiki-compiler",
"pinned": false,
"viewCount": 3,
"contentRevision": 5,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}
]
}GET /v1/knowledgebases/{knowledgeBaseId}/wiki/conflicts/{slug}/proposal
SDK:KnowledgeBases.getWikiConflictProposal · scope:knowledgebases.read
Read the latest compiled proposal for a Wiki page with conflicts: the returned immutable version can be reviewed before resolving conflicts one by one or accepting the entire proposal.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. |
Output:
200, returning model Models.KnowledgeBaseWikiRevision (fields see "Common response models").
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/conflicts/shipping-time/proposal" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"$id": "rev_0009",
"$createdAt": "2026-09-17T10:05:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"pageId": "wp_0002",
"revisionType": "compile_proposal",
"titleBefore": "发货时效",
"titleAfter": "发货时效",
"contentBefore": "# 发货时效\n…",
"contentAfter": "# 发货时效\n\n工作日订单 48 小时内发货(以售后手册 v2 为准)。",
"reason": "编译器合并提案"
}POST /v1/knowledgebases/{knowledgeBaseId}/wiki/conflicts/{slug}/resolve
SDK:KnowledgeBases.resolveWikiConflict · scope:knowledgebases.write
Resolve Wiki conflicts with optimistic concurrency: either resolve one exact conflict option or submit a manually merged document. When resolving part of a proposal, pass proposalId together with the remaining proposal Markdown (proposalMd) to prevent unresolved parts from being silently discarded.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
slug | path | string | Yes | Wiki page slug. | |
contentRevision | body | integer | Yes | Expected current content version number. | |
contentMd | body | string | No | The manually merged Markdown. | |
resolvedConflictId | body | string | No | The exact pending conflict ID to resolve. | |
resolvedConflictOptionText | body | string | No | The selected option text for the conflict. | |
proposalId | body | string | No | The compiled proposal ID being partially resolved. | |
proposalMd | body | string | No | The updated unresolved proposal Markdown. | |
links | body | object | No | Replaces outgoing links; if omitted, they are preserved. | |
reason | body | string | No | The reason for the resolution. |
Output:
200, returning model Models.KnowledgeBaseWikiPage (fields see "Common response models").
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/conflicts/shipping-time/resolve" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contentRevision": 5,
"resolvedConflictId": "cf_0001",
"resolvedConflictOptionText": "48 小时内发货",
"reason": "以售后手册 v2 为准"
}'Response example:
{
"$id": "wp_0002",
"$createdAt": "2026-09-12T08:00:00.000+00:00",
"$updatedAt": "2026-09-18T04:00:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "shipping-time",
"title": "发货时效",
"pageType": "topic",
"contentMd": "# 发货时效\n\n工作日订单 48 小时内发货。",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": "wiki-compiler",
"pinned": false,
"viewCount": 3,
"contentRevision": 6,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}GET /v1/knowledgebases/{knowledgeBaseId}/wiki/proposals
SDK:KnowledgeBases.listWikiProposals · scope:knowledgebases.read
List the latest compiled proposals for Wiki pages with conflicts in the knowledge base: proposals are immutable versions and will not replace canonical content until explicitly accepted or resolved.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
limit | query | integer | No | Default 100 | Maximum number of proposals to return. |
Output:
200, returns model Models.KnowledgeBaseWikiRevisionList (total* + revisions*[]; version fields see "Common Response Models").
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/proposals?limit=100" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"total": 1,
"revisions": [
{
"$id": "rev_0009",
"$createdAt": "2026-09-17T10:05:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"pageId": "wp_0002",
"pageSlug": "shipping-time",
"pageTitle": "发货时效",
"revisionType": "compile_proposal",
"contentAfter": "# 发货时效\n\n工作日订单 48 小时内发货(以售后手册 v2 为准)。",
"reason": "编译器合并提案"
}
]
}POST /v1/knowledgebases/{knowledgeBaseId}/wiki/proposals/{proposalId}/accept
SDK:KnowledgeBases.acceptWikiProposal · scope:knowledgebases.write
Accept an exact compiled proposal as the canonical Wiki page: contentRevision must match the current page version, so a proposal cannot overwrite newer manual edits.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
proposalId | path | string | Yes | The exact compiled proposal version ID. | |
contentRevision | body | integer | Yes | Expected current page version number. |
Output:
200, returning model Models.KnowledgeBaseWikiPage (fields see "Common response models").
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/proposals/rev_0009/accept" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contentRevision": 5
}'Response example:
{
"$id": "wp_0002",
"$createdAt": "2026-09-12T08:00:00.000+00:00",
"$updatedAt": "2026-09-18T04:10:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "shipping-time",
"title": "发货时效",
"pageType": "topic",
"contentMd": "# 发货时效\n\n工作日订单 48 小时内发货(以售后手册 v2 为准)。",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": "wiki-compiler",
"pinned": false,
"viewCount": 3,
"contentRevision": 6,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}Wiki Knowledge Graph and Governance
GET /v1/knowledgebases/{knowledgeBaseId}/wiki/graph
SDK:KnowledgeBases.getWikiGraph · scope:knowledgebases.read
Read the canonical Wiki page link graph: includes canonical pages and resolved/unresolved links; a target page of null or redLink=true indicates a red link whose target page does not yet exist.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. |
Output:
200, returns model Models.KnowledgeBaseWikiGraph.
| Field | Type | Description |
|---|---|---|
pages* | object[] | Wiki graph pages, each element is Models.KnowledgeBaseWikiPage (fields see "Common Response Models"). |
links* | object | Resolved and red-link edges (generalized object; a target page of null or redLink=true indicates a red link). |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/graph" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example (links is a generalized object for illustration only—fields are subject to the actual response):
{
"pages": [
{
"$id": "wp_0001",
"$createdAt": "2026-09-18T03:10:00.000+00:00",
"$updatedAt": "2026-09-18T03:25:00.000+00:00",
"knowledgeBaseId": "kb_product_docs",
"slug": "refund-policy",
"title": "退款政策",
"pageType": "entity",
"contentMd": "# 退款政策\n…",
"status": "published",
"pendingConflicts": [],
"conflicts": [],
"sourceChunks": [],
"sourceGraph": {},
"sourceMemory": [],
"compiledBy": null,
"pinned": false,
"viewCount": 12,
"contentRevision": 2,
"links": [],
"backlinks": [],
"aliases": [],
"conflictEvidence": {},
"divergenceRecommendations": {},
"conflictBlocks": [],
"internalContradictions": [],
"ruleBasedContradictions": [],
"generalKnowledgeConflicts": []
}
],
"links": []
}GET /v1/knowledgebases/{knowledgeBaseId}/wiki/recommended-limits
SDK:KnowledgeBases.getWikiRecommendedLimits · scope:knowledgebases.read
Recommend a bounded Wiki compilation limit based on the current document, GraphRAG, and Memory source signals. When enableLlmRefine=false, only deterministic recommendations are given; otherwise the knowledge base's shared Chat model may participate in refining them.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
enableLlmRefine | query | boolean | No | Default true | Whether to allow the shared Knowledge chat model to refine the deterministic recommendation. |
Output:
200, returns model Models.KnowledgeBaseWikiLimits.
| Field | Type | Description |
|---|---|---|
max_entities* | integer | The recommended maximum number of entity pages. |
max_topics* | integer | The recommended maximum number of topic pages. |
max_surveys* | integer | The recommended maximum number of overview pages. |
rag_max_docs* | integer | The recommended RAG document budget. |
rag_max_chunks_per_doc* | integer | The recommended number of chunks per document. |
evidence_max_chunks_to_embed* | integer | The recommended evidence embedding budget. |
strategy* | string | heuristic or ai. |
signals* | object | The bounded Knowledge source signals recommended for use (generalized object). |
Call example:
curl -X GET "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/recommended-limits?enableLlmRefine=false" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>"Response example:
{
"max_entities": 200,
"max_topics": 60,
"max_surveys": 20,
"rag_max_docs": 500,
"rag_max_chunks_per_doc": 40,
"evidence_max_chunks_to_embed": 2000,
"strategy": "heuristic",
"signals": {}
}POST /v1/knowledgebases/{knowledgeBaseId}/wiki/reset (action routing alias: POST /v1/knowledgebases/{kbId}/reset:wiki)
SDK:KnowledgeBases.resetWiki · scope:knowledgebases.write
Delete the entire canonical Wiki and queue deletion of its compiled projections (supports calling POST /v1/knowledgebases/{knowledgeBaseId}/wiki/reset or the action routing alias POST /v1/knowledgebases/{kbId}/reset:wiki). confirmation must be reset:wiki; idempotencyKey makes the derived index cleanup request safe to retry. More destructive than clearIndexCapability—the latter preserves the canonical Wiki content.
Input:
| Parameter | Location | Type | Required | Default/enum | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | string | Yes | Knowledge base ID. | |
confirmation | body | string | Yes | Fixed reset:wiki | Explicit confirmation. |
idempotencyKey | body | string | Yes | Stable key for idempotent retries. |
Output:
202, returns model Models.KnowledgeBaseWikiMutation (fields see "Common Response Models"); clearOperationId points to the queued index cleanup operation.
Call example:
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/wiki/reset" \
-H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
-H "X-Appwrite-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"confirmation": "reset:wiki",
"idempotencyKey": "reset-wiki-20260918-0001"
}'Response example:
{
"pagesDeleted": 42,
"linksDeleted": 87,
"linksNulled": 3,
"revisionsDeleted": 120,
"aliasesDeleted": 15,
"clearOperationId": "op_0004"
}Errors and boundaries
Resource does not exist (knowledge base/page/version/proposal/operation):
404; Wiki page slugs are unique within a knowledge base, and duplicate creation is treated as a conflict.All Wiki write operations go through
contentRevisionCAS: a version mismatch is rejected—first callGETto get the latest version number and retry.Enabling a capability unavailable on the deployment:
knowledge_index_capability_unavailable; disabling a capability preserves existing result generations and operation history.export-to-memoryprerequisites not met (Memory disabled/initializing/missing/unavailable):503 memory_service_unavailable.All destructive operations require an explicit confirmation string: page deletion
delete:<slug>, capability cleanupclear:<capability>, Wiki resetreset:wiki; cleanup/reset additionally requiresidempotencyKeyto guarantee retry safety.Index operations are asynchronous:
202only means queued; terminal states (succeeded/failed/cancelled/cleared) require pollingGET index-operations/{operationId}; cancellation is fenced by attempt, so expired workers cannot publish results.Wiki
clearIndexCapabilityonly clears projections and preserves canonical pages/links/versions/aliases; onlyresetWikideletes the canonical Wiki.Compiled proposals are immutable and do not take effect automatically: canonical content remains unchanged until accepted (
accept) or resolved item by item (resolve).GraphRAG graph browsing is a bounded snapshot: paginate with
hasMore/nextCursor;truncated=trueindicates only a subset was retrieved.
Correspondence with the Server SDK
| service.method | Endpoint |
|---|---|
KnowledgeBases.getWikiOverview | GET /knowledgebases/wiki/overview |
KnowledgeBases.createWikiQuery | POST /knowledgebases/wiki/query |
KnowledgeBases.createWikiProjectSearch | POST /knowledgebases/wiki/search |
KnowledgeBases.getGraph | GET .../graph |
KnowledgeBases.listGraphCommunityReports | GET .../graph/community-reports |
KnowledgeBases.getGraphEntityNeighbors | GET .../graph/entities/{entityId}/neighbors |
KnowledgeBases.listIndexCapabilities | GET .../index-capabilities |
KnowledgeBases.updateIndexCapability / clearIndexCapability | PATCH .../index-capabilities/{capability}、POST .../clear |
KnowledgeBases.listIndexOperations / createIndexOperation | GET / POST .../index-operations |
KnowledgeBases.getIndexOperation / cancelIndexOperation | GET .../index-operations/{operationId}、POST .../cancel |
KnowledgeBases.listWikiPages / createWikiPage | GET / POST .../wiki/pages |
KnowledgeBases.getWikiPage / updateWikiPage / deleteWikiPage | GET / PATCH / DELETE .../wiki/pages/{slug} |
KnowledgeBases.listWikiPageRevisions / getWikiPageRevision | GET .../revisions、GET .../revisions/{revisionId} |
KnowledgeBases.restoreWikiPage | POST .../wiki/pages/{slug}/restore |
KnowledgeBases.createWikiPageMemoryExport | POST .../wiki/pages/{slug}/export-to-memory |
KnowledgeBases.listWikiConflicts / getWikiConflictProposal / resolveWikiConflict | GET .../wiki/conflicts、GET .../conflicts/{slug}/proposal、POST .../resolve |
KnowledgeBases.listWikiProposals / acceptWikiProposal | GET .../wiki/proposals、POST .../proposals/{proposalId}/accept |
KnowledgeBases.getWikiGraph | GET .../wiki/graph |
KnowledgeBases.getWikiRecommendedLimits | GET .../wiki/recommended-limits |
KnowledgeBases.resetWiki | POST .../wiki/reset |