Docs
Contents

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):

Resources and Base Paths

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 + pathPurpose
GET /knowledgebases/wiki/overviewProject-level Wiki status cards (filtered by permissions)
POST /knowledgebases/wiki/queryQuery the Wiki index across explicitly selected knowledge bases
POST /knowledgebases/wiki/searchSearch the Wiki index across all visible knowledge bases
GET /knowledgebases/{knowledgeBaseId}/graphBrowse the active GraphRAG node-link graph
GET .../graph/community-reportsList active GraphRAG community reports
GET .../graph/entities/{entityId}/neighborsExpand an entity neighborhood
GET /knowledgebases/{knowledgeBaseId}/index-capabilitiesList index capabilities and statuses
PATCH .../index-capabilities/{capability}Configure an index capability
POST .../index-capabilities/{capability}/clearQueue cleanup of a capability's derived indexes
GET|POST /knowledgebases/{knowledgeBaseId}/index-operationsIndex operation list / initiate build or repair
GET .../index-operations/{operationId}Index operation details
POST .../index-operations/{operationId}/cancelRequest cancellation of an index operation
GET /knowledgebases/{knowledgeBaseId}/wiki/pagesWiki page list
POST .../wiki/pagesCreate 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}/revisionsPage version list
GET .../wiki/pages/{slug}/revisions/{revisionId}Single version details
POST .../wiki/pages/{slug}/restoreRestore a historical version (new CAS version)
POST .../wiki/pages/{slug}/export-to-memoryExport pages to the memory service
GET .../wiki/conflictsList of pages with unresolved compilation conflicts
GET .../wiki/conflicts/{slug}/proposalLatest compilation proposal for a conflict page
POST .../wiki/conflicts/{slug}/resolve (compatibility: POST /v1/knowledgebases/{kbId}/wiki/conflicts)Resolve conflict (CAS)
GET .../wiki/proposalsList 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/graphLink graph of canonical Wiki pages (including red links)
GET .../wiki/recommended-limitsRecommended 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

Requests and Responses

The following sections provide, endpoint by endpoint across resource domains, inputs, outputs, and copyable call/response examples. General conventions:

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):

FieldTypeDescription
$id*stringWiki page ID.
$createdAt* / $updatedAt*stringCreation/last update time (ISO 8601).
knowledgeBaseId*stringOwning knowledge base ID.
slug*stringWiki slug, unique within the knowledge base.
title*stringPage title.
pageType*stringPage type: entity / topic / survey / agent_practice / category_index.
contentMd*stringCanonical Markdown content.
summarystringPage summary.
status*stringPage status: draft / published / conflict / archived.
pendingConflicts*objectStructured unresolved conflict metadata.
conflicts*object[]Caller-facing conflict details (see KnowledgeBaseWikiConflict below).
sourceChunks* / sourceGraph* / sourceMemory*objectProvenance from three source types: chunk / knowledge graph / memory.
compiledBystringCompiler identifier; null for manually held pages.
pinned*booleanWhether the page is manually pinned.
viewCount*integerPage view count.
contentRevision*integerCAS version number required for write operations.
embeddingModelstringModel used by the current projection.
projectionResultGenerationstringDerived-result generation containing this page version.
embeddingUpdatedAtstringProjection publish time.
links*objectOutbound links, including unresolved red links.
backlinks*objectInbound links from other Wiki pages.
aliases*objectAliases pointing to this page.
conflictEvidence*objectHydrated evidence referenced by conflicting content.
divergenceRecommendations*objectRecommendation among disputed content options.
conflictBlocks*objectConflict blocks for rendering.
internalContradictions* / ruleBasedContradictions*objectContradictions detected by rules.
generalKnowledgeConflicts*objectConflicts with general knowledge.

Models.KnowledgeBaseWikiConflict (conflicts[] element):

FieldTypeDescription
id*stringStable conflict ID.
type*stringConflict detector classification.
reason*stringHuman-readable reason for the conflict.
claimstringThe 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*booleanWhether this conflict requires manual content merging.
confidencenumberDetector confidence (if any).
scopestringConflict scope (if any).
recommendedOptionIndexintegerIndex 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):

FieldTypeDescription
$id*stringVersion ID.
$createdAt*stringVersion creation time.
knowledgeBaseId*stringKnowledge base ID.
pageId*stringWiki page ID.
pageSlug / pageTitlestringPage slug / title (carried in proposal list responses).
actorIdstringPrincipal that created the version.
revisionType*stringVersion type.
titleBefore / titleAfterstringPrevious/new title.
contentBefore / contentAfterstringPrevious/new Markdown.
reasonstringReason for the version.

Models.KnowledgeBaseIndexOperation (index operation):

FieldTypeDescription
$id*stringOperation ID.
$createdAt* / $updatedAt*stringCreation/last update time.
knowledgeBaseId*stringKnowledge base ID.
capability*stringCapability identifier: graphrag / raptor / wiki.
kind*stringOperation kind (e.g., build / repair).
scope*stringOperation scope (knowledgebase / document).
documentIds*string[]Document ID for document-scoped operations.
status*stringLifecycle status: queued / running / succeeded / failed / cancelling / cancelled / clearing / cleared.
stagestringCurrent processing stage.
progress*integerCompletion percentage.
messagestringCurrent sanitized status message.
effectiveConfig*objectFrozen effective configuration.
configHash* / sourceHash*stringEffective configuration / frozen source snapshot hash.
resultGenerationstringStaged result generation.
resultVersionstringIndexer implementation version.
retryOfstringOriginal operation ID when this operation is a retry.
stats*objectOperation statistics.
error*objectSanitized operation error.
logTailstringBounded sanitized log tail.
startedAt / heartbeatAt / finishedAtstringProcessing 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.

FieldTypeDescription
cards*objectPermission-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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdsbodystring[]Yes1–20Knowledge base IDs to query.
querybodystringYesWiki query text.
modebodystringNoEnum: auto / wiki_direct / wiki_retrieved / rag_firstWiki routing tier override.
topKbodyintegerNoNumber of results returned per knowledge base.
useVectorbodybooleanNoWhether to include vector retrieval.
vectorWeightbodynumberNoVector weight before RRF.
linkOptionsbodyobjectNoBounded Wiki link expansion options (generalized object).

Output:

200, returns model Models.KnowledgeBaseWikiProjectSearch.

FieldTypeDescription
results*objectWiki results grouped by knowledge base and filtered by permissions (generalized object; result fields are subject to the actual response).
degradedKnowledgeBases*objectVisible 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:

ParameterLocationTypeRequiredDefault/enumDescription
querybodystringYesWiki query text.
modebodystringNoEnum: auto / wiki_direct / wiki_retrieved / rag_firstWiki routing tier override.
topKbodyintegerNoNumber of results returned per knowledge base.
useVectorbodybooleanNoWhether to include vector retrieval.
vectorWeightbodynumberNoVector weight before RRF.
linkOptionsbodyobjectNoBounded 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
queryquerystringNoDefault ""Entity text filter.
typequerystringNoDefault ""Entity type filter.
communityquerystringNoDefault ""Community filter.
seedquerystringNoDefault ""Entity seed for bounded N-hop expansion.
hopsqueryintegerNoDefault 1Number of neighborhood hops when seed is provided.
limitqueryintegerNoDefault 100Maximum number of nodes returned.
cursorquerystringNoDefault ""Opaque cursor returned by the previous page.

Output:

200, returns model Models.KnowledgeBaseGraph.

FieldTypeDescription
resultGeneration*stringActive GraphRAG result generation.
graph*objectFiltered node-link graph snapshot ({nodes, edges} structure; fields are subject to the actual response).
totalNodes*integerTotal number of nodes matching the current filters.
hasMore*booleanWhether there is a next page.
nextCursorstringOpaque cursor for the next page.
truncated*booleanWhether 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
limitqueryintegerNoDefault 100Maximum number of reports returned.
offsetqueryintegerNoDefault 0Number of reports to skip.

Output:

200, returns model Models.KnowledgeBaseGraphCommunityReportList.

FieldTypeDescription
resultGeneration*stringActive GraphRAG result generation.
reports*object[]List of community reports (elements are Models.KnowledgeBaseGraphCommunityReport; subfields are listed below).
id*stringCommunity report record ID.
communityId*stringCommunity identifier.
title*stringReport title.
entities*string[]Entities covered by the report.
weight*numberReport weight.
content*objectStructured report content and evidence (generalized object).
hasMore*booleanWhether 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
entityIdpathstringYesGraph entity ID.
hopsqueryintegerNoDefault 1Neighborhood hops.
limitqueryintegerNoDefault 100Maximum number of nodes returned.

Output:

200, returns model Models.KnowledgeBaseGraphNeighbors.

FieldTypeDescription
resultGeneration*stringActive GraphRAG result generation.
nodes*objectNodes reached from the seed (generalized object).
edges*objectEdges induced by the reached nodes (generalized object).
truncated*booleanWhether 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.

Output:

200, returns model Models.KnowledgeBaseIndexCapabilityList.

FieldTypeDescription
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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID (e.g., kb_enterprise_support).
capabilitypathstringYesEnum: graphrag / raptor / wikiIndex capability identifier.
configbodyobjectYesFull capability configuration object (specific subfields vary by capability; see the table below).
config.enabledbodybooleanYestrue / falseWhether to enable the current index capability.
config.languagebodystringNoEnum: auto / zh / en / ja (default auto)Target language for entity extraction, cluster summaries, and Wiki page generation.
config.entityTypes (graphrag)bodystring[]Noe.g., ["Product","Component","ErrorCode","Parameter","SOP"]Whitelist of ontology entity types that GraphRAG is allowed to extract.
config.lexiconEnabled (graphrag)bodybooleanNoDefault trueWhether to leverage the knowledge base's bound project lexicon (e.g., lex_enterprise_synonyms) for canonical name alignment during GraphRAG entity extraction and disambiguation.
config.graphragEmbedBatchSize (graphrag)bodyintegerNoDefault 32, range 1–128Batch size for vectorizing GraphRAG entity and relationship descriptions.
config.maxGleaningRounds (graphrag)bodyintegerNoDefault 1, range 0–3Number of gleaning iterations for missed-entity re-extraction.
config.communityLevel (graphrag)bodyintegerNoDefault 2, range 1–4Leiden community hierarchical clustering depth.
config.scope (raptor)bodystringNoEnum: "knowledgeBase" / "document"Scope for building the RAPTOR hierarchical clustering tree: "knowledgeBase" (build a unified semantic tree across the entire knowledge base) or "document" (build a semantic tree independently per document).
config.maxLevels (raptor)bodyintegerNoDefault 3, range 1–5Maximum number of recursive clustering levels in the RAPTOR tree.
config.clusterDimension (raptor)bodyintegerNoDefault 16, range 2–64Target dimension used for Gaussian Mixture Model (GMM) clustering after UMAP dimensionality reduction.
config.bicThreshold (raptor)bodynumberNoDefault 0.15, range 0.01–1.0Convergence threshold for the Bayesian Information Criterion (BIC) optimal cluster count.
config.summaryTokenBudget (raptor)bodyintegerNoDefault 512, range 128–2048Maximum token budget for generating cluster summaries per parent node.
config.await_graphrag (wiki)bodybooleanNoDefault trueWhether to wait for the active GraphRAG index build to complete and reference its community and entity structures before compiling the LLM Wiki.
config.pageMaxConcurrent (wiki)bodyintegerNoDefault 4, range 1–16Maximum concurrency for parallel Wiki page compilation.
config.sources (wiki)bodystring[]NoEnum combination: ["rag","graphrag","memory"]Input sources for Wiki compilation.

Output:

200, returning model Models.KnowledgeBaseIndexCapability (fields see "Common response models").

Call examples (configuring the three major capabilities graphrag, raptor, and wiki respectively):

# 1. Configure GraphRAG capabilities (specify entity types, enable lexicon canonical term alignment and vector batch size)
curl -X PATCH "https://appbuild-sit.oceanbase.com/v1/knowledgebases/kb_enterprise_support/index-capabilities/graphrag" \
  -H "X-Appwrite-Project: enterprise-ai-hub-210" \
  -H "X-Appwrite-Key: <APPBASE_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "enabled": true,
      "language": "zh",
      "entityTypes": ["Product", "Component", "ErrorCode", "Parameter", "SOP"],
      "lexiconEnabled": true,
      "graphragEmbedBatchSize": 32,
      "maxGleaningRounds": 1,
      "communityLevel": 2
    }
  }'

# 2. Configure the RAPTOR hierarchical clustering summarization capability (GMM + BIC clustering parameters; supports knowledgeBase or document granularity)
curl -X PATCH "https://appbuild-sit.oceanbase.com/v1/knowledgebases/kb_enterprise_support/index-capabilities/raptor" \
  -H "X-Appwrite-Project: enterprise-ai-hub-210" \
  -H "X-Appwrite-Key: <APPBASE_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "enabled": true,
      "language": "zh",
      "scope": "knowledgeBase",
      "maxLevels": 3,
      "clusterDimension": 16,
      "bicThreshold": 0.15,
      "summaryTokenBudget": 512
    }
  }'

# 3. Configure the LLM Wiki compilation capability (enable await_graphrag and concurrency control)
curl -X PATCH "https://appbuild-sit.oceanbase.com/v1/knowledgebases/kb_enterprise_support/index-capabilities/wiki" \
  -H "X-Appwrite-Project: enterprise-ai-hub-210" \
  -H "X-Appwrite-Key: <APPBASE_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "enabled": true,
      "language": "zh",
      "await_graphrag": true,
      "pageMaxConcurrent": 4,
      "sources": ["rag", "graphrag", "memory"]
    }
  }'

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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
capabilitypathstringYesEnum: graphrag / raptor / wikiCapability identifier.
confirmationbodystringYesIn the form of clear:<capability>Explicit confirmation.
idempotencyKeybodystringYesStable 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
capabilityquerystringNoEnum: graphrag / raptor / wikiCapability filter.
statusquerystringNoEnum: queued / running / succeeded / failed / cancelling / cancelled / clearing / clearedOperation status filter.
limitqueryintegerNoDefault 25Maximum number of operations to return.
offsetqueryintegerNoDefault 0Number of operations to skip.

Output:

200, returns model Models.KnowledgeBaseIndexOperationList.

FieldTypeDescription
total*integerTotal 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:

Input:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
capabilitybodystringYesEnum: graphrag / raptor / wikiCapability identifier.
kindbodystringNoEnum: build / repairOperation kind.
scopebodystringNoEnum: knowledgebase / documentOperation scope.
documentIdsbodystring[]NoDocument ID for document-scoped operations.
configbodyobjectNoOperation-level configuration overrides (generalized object).
forcebodybooleanNoCancel another active operation before queueing.
idempotencyKeybodystringYesStable key for idempotent retries.
retryOfbodystringNoThe previously failed/canceled operation to repair.

Output:

202, returning model Models.KnowledgeBaseIndexOperation (fields see "Common response models").

Call example:

# 1. Trigger a full knowledge base GraphRAG build (kind=build)
curl -X POST "https://appbuild-sit.oceanbase.com/v1/knowledgebases/kb_enterprise_support/index-operations" \
  -H "X-Appwrite-Project: enterprise-ai-hub-210" \
  -H "X-Appwrite-Key: <APPBASE_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "capability": "graphrag",
    "kind": "build",
    "scope": "knowledgebase",
    "idempotencyKey": "build-graphrag-20261022-01"
  }'

# 2. Trigger a single-document-scope RAPTOR repair operation (kind=repair, scope=document)
curl -X POST "https://appbuild-sit.oceanbase.com/v1/knowledgebases/kb_enterprise_support/index-operations" \
  -H "X-Appwrite-Project: enterprise-ai-hub-210" \
  -H "X-Appwrite-Key: <APPBASE_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "capability": "raptor",
    "kind": "repair",
    "scope": "document",
    "documentIds": ["doc_manual_v2"],
    "retryOf": "op_0000",
    "idempotencyKey": "repair-raptor-20261022-01"
  }'

# 3. Trigger LLM Wiki building (kind=build)
curl -X POST "https://<your-endpoint>/v1/knowledgebases/kb_product_docs/index-operations" \
  -H "X-Appwrite-Project: <YOUR_PROJECT_ID>" \
  -H "X-Appwrite-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "capability": "wiki",
    "kind": "build",
    "scope": "knowledgebase",
    "idempotencyKey": "build-wiki-20260918-0001"
  }'

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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
operationIdpathstringYesIndex 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
operationIdpathstringYesIndex 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
pageTypequerystringNoEnum: entity / topic / survey / agent_practice / category_indexPage type filter.
statusquerystringNoEnum: draft / published / conflict / archivedPage status filter.
limitqueryintegerNoDefault 50Maximum number of pages to return.
offsetqueryintegerNoDefault 0Number of pages to skip.

Output:

200, returns model Models.KnowledgeBaseWikiPageList.

FieldTypeDescription
total*integerTotal 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugbodystringYesWiki page slug, unique within the knowledge base.
titlebodystringYesPage title.
pageTypebodystringNoEnum: entity / topic / survey / agent_practice / category_indexPage type.
contentMdbodystringNoCanonical Markdown content.
summarybodystringNoPage summary.
statusbodystringNoEnum: draft / published / conflict / archivedPage status.
pinnedbodybooleanNoWhether manually pinned.
linksbodyobjectNoExplicit outgoing links (generalized object).
aliasesbodyobjectNoManual aliases (generalized object).
reasonbodystringNoReason 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesCurrent Wiki page slug.
contentRevisionbodyintegerYesExpected current content version number.
pagebodyobjectYesFields to update: slug, title, pageType, contentMd, summary, status, or pinned.
linksbodyobjectNoReplaces outgoing links; if omitted, they are preserved.
aliasesbodyobjectNoReplaces manual aliases; if omitted, they are preserved.
reasonbodystringNoReason 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki page slug.
contentRevisionbodyintegerYesExpected current page version number.
confirmationbodystringYesIn 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki page slug.
limitqueryintegerNoDefault 50Maximum number of versions to return.

Output:

200, returns model Models.KnowledgeBaseWikiRevisionList.

FieldTypeDescription
total*integerTotal 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki page slug.
revisionIdpathstringYesWiki 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki page slug.
revisionIdbodystringYesVersion ID to restore.
contentRevisionbodyintegerYesExpected current content version number.
linksbodyobjectNoReplaces outgoing links; if omitted, they are preserved.
reasonbodystringNoReason 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki page slug.
agentIdbodystringNoMemory agent identity for the exported facts.

Output:

201, returns model Models.KnowledgeBaseWikiMemoryExport.

FieldTypeDescription
memory*objectThe 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
limitqueryintegerNoDefault 100Maximum number of conflict pages to return.
offsetqueryintegerNoDefault 0Number 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
slugpathstringYesWiki page slug.
contentRevisionbodyintegerYesExpected current content version number.
contentMdbodystringNoThe manually merged Markdown.
resolvedConflictIdbodystringNoThe exact pending conflict ID to resolve.
resolvedConflictOptionTextbodystringNoThe selected option text for the conflict.
proposalIdbodystringNoThe compiled proposal ID being partially resolved.
proposalMdbodystringNoThe updated unresolved proposal Markdown.
linksbodyobjectNoReplaces outgoing links; if omitted, they are preserved.
reasonbodystringNoThe 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
limitqueryintegerNoDefault 100Maximum 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
proposalIdpathstringYesThe exact compiled proposal version ID.
contentRevisionbodyintegerYesExpected 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.

Output:

200, returns model Models.KnowledgeBaseWikiGraph.

FieldTypeDescription
pages*object[]Wiki graph pages, each element is Models.KnowledgeBaseWikiPage (fields see "Common Response Models").
links*objectResolved 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": []
}

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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
enableLlmRefinequerybooleanNoDefault trueWhether to allow the shared Knowledge chat model to refine the deterministic recommendation.

Output:

200, returns model Models.KnowledgeBaseWikiLimits.

FieldTypeDescription
max_entities*integerThe recommended maximum number of entity pages.
max_topics*integerThe recommended maximum number of topic pages.
max_surveys*integerThe recommended maximum number of overview pages.
rag_max_docs*integerThe recommended RAG document budget.
rag_max_chunks_per_doc*integerThe recommended number of chunks per document.
evidence_max_chunks_to_embed*integerThe recommended evidence embedding budget.
strategy*stringheuristic or ai.
signals*objectThe 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:

ParameterLocationTypeRequiredDefault/enumDescription
knowledgeBaseIdpathstringYesKnowledge base ID.
confirmationbodystringYesFixed reset:wikiExplicit confirmation.
idempotencyKeybodystringYesStable 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

Correspondence with the Server SDK

service.methodEndpoint
KnowledgeBases.getWikiOverviewGET /knowledgebases/wiki/overview
KnowledgeBases.createWikiQueryPOST /knowledgebases/wiki/query
KnowledgeBases.createWikiProjectSearchPOST /knowledgebases/wiki/search
KnowledgeBases.getGraphGET .../graph
KnowledgeBases.listGraphCommunityReportsGET .../graph/community-reports
KnowledgeBases.getGraphEntityNeighborsGET .../graph/entities/{entityId}/neighbors
KnowledgeBases.listIndexCapabilitiesGET .../index-capabilities
KnowledgeBases.updateIndexCapability / clearIndexCapabilityPATCH .../index-capabilities/{capability}、POST .../clear
KnowledgeBases.listIndexOperations / createIndexOperationGET / POST .../index-operations
KnowledgeBases.getIndexOperation / cancelIndexOperationGET .../index-operations/{operationId}、POST .../cancel
KnowledgeBases.listWikiPages / createWikiPageGET / POST .../wiki/pages
KnowledgeBases.getWikiPage / updateWikiPage / deleteWikiPageGET / PATCH / DELETE .../wiki/pages/{slug}
KnowledgeBases.listWikiPageRevisions / getWikiPageRevisionGET .../revisions、GET .../revisions/{revisionId}
KnowledgeBases.restoreWikiPagePOST .../wiki/pages/{slug}/restore
KnowledgeBases.createWikiPageMemoryExportPOST .../wiki/pages/{slug}/export-to-memory
KnowledgeBases.listWikiConflicts / getWikiConflictProposal / resolveWikiConflictGET .../wiki/conflicts、GET .../conflicts/{slug}/proposal、POST .../resolve
KnowledgeBases.listWikiProposals / acceptWikiProposalGET .../wiki/proposals、POST .../proposals/{proposalId}/accept
KnowledgeBases.getWikiGraphGET .../wiki/graph
KnowledgeBases.getWikiRecommendedLimitsGET .../wiki/recommended-limits
KnowledgeBases.resetWikiPOST .../wiki/reset