Knowledge review
This topic describes RDS ContextDB knowledge review APIs for review records, manual decisions, rewrite templates, and review policies.
Common information
Endpoint
https://context-database.aliyuncs.comAuthentication
All Data API operations are authenticated by a workspace-level API key. Use one of the following methods:
Method | Header format |
X-API-Key |
|
Token |
|
Bearer |
|
Response envelope
All operations return a unified envelope, with business data in data.
Name | Type | Description | Example |
errorCode | integer | The error code. |
|
errorMessage | string | The error message, or null on success. |
|
requestId | string | The request trace ID. |
|
data | object/array/null | The business data, defined in each operation's response parameters. | See the operation examples. |
Common error behavior
HTTP status code | errorCode | Trigger |
400 |
| Missing or invalid parameters, missing resources, invalid operation states, or insufficient permissions ( |
401 |
| No API key provided. |
500 |
| Internal server error. |
Knowledge review permission failures do not return HTTP 403. They return HTTP 400 with errorCode=1001 and an errorMessage such as forbidden: kb_write, knowledge base permission denied: kb-001.
Data API overview
The following table lists the operations covered in this topic.
API | Description |
ListReviews | Lists ingestion review records with pagination and decision/review_status filters. |
GetReviewDetail | Retrieves review details, including quality scores, contradictions, conflicts, and rewritten content, in a unified envelope. |
ReviewAction | Performs a manual review action and returns a unified envelope. |
DeleteReview | Deletes one review record whose stored status is reviewed or rejected. |
ResolveConflicts | Records decisions for individual conflicts in a unified envelope. |
BatchReviewAction | Runs |
BatchDeleteReviews | Permanently deletes up to 50 reviews with stored status reviewed or rejected. |
ListKnowledgeReviewTemplates | Lists all active review rewrite templates in a knowledge base, sorted by name ascending. |
CreateKnowledgeReviewTemplate | Creates a review rewrite template. |
GetKnowledgeReviewTemplate | Retrieves template details. |
UpdateKnowledgeReviewTemplate | Updates a template by template_id. |
DeleteKnowledgeReviewTemplate | Soft-deletes the template: sets status=deleted, clears content, and renames it to avoid uniqueness conflicts. |
SetDefaultKnowledgeReviewTemplate | Sets the KB's default rewrite template and clears other defaults in the same transaction. |
ClearDefaultKnowledgeReviewTemplate | Clears all template is_default flags in the KB, restoring no-template runtime behavior. |
GetReviewSettings | Retrieves workspace review settings in a unified envelope. |
UpdateReviewSettings | Partially updates workspace review settings in a unified envelope. |
Knowledge Review API
ListReviews
Description
Lists ingestion review records with pagination and decision/review_status filters. Query parameters sort_by and sort_order control sorting. Only confidence_score is supported; sort_order accepts asc/desc and defaults to desc when sort_by is specified. Null scores always sort last. Ties use created_at descending, then review ID ascending. Invalid values or sort_order without sort_by return HTTP 400. Without sort_by, records sort by created_at descending.
Request syntax
GET /v1/knowledge/reviewsRequest parameters
Name | Type | Required | Description | Example |
decision | string | No | The filter by decision type. Valid values: |
|
review_status | string | No | The filter by status. Valid values: |
|
page | integer | No | The page number. Default value: |
|
page_size | integer | No | The number of entries per page. Default value: |
|
sort_by | string | No | The sort field. Currently only |
|
sort_order | string | No | Sort direction: |
|
Response parameters (in the data field)
Name | Type | Description | Example |
reviews | array | The list of review records. For the fields of each element, see the following table | See the example |
total | integer | The total number of entries |
|
page | integer | The effective page number after clamping. |
|
page_size | integer | The effective page size after clamping. |
|
Elements of the reviews array:
Name | Type | Description | Example |
review_id | string | The review record ID |
|
document_id | string | The document ID |
|
document_name | string | The document name. If absent in the review record, retrieved from the document record; null if the document was deleted. |
|
knowledge_base_id | string | The knowledge base ID |
|
confidence_score | float | The overall confidence score, or null if unscored. |
|
decision | string | The system decision. Valid values: |
|
review_status | string | The derived review status: |
|
has_conflicts | boolean | Indicates whether knowledge conflicts exist |
|
has_contradictions | boolean | Whether unresolvable internal contradictions exist. |
|
rewrite_needed | boolean | Indicates whether a rewrite is required |
|
human_action | string | The manual action type. If no action has been taken, the value is null |
|
created_at | string | The creation time |
|
Deriving review_status
review_status is derived for each response rather than stored as a database column. Rules apply in this order:
Priority | Condition | Derived result |
1 |
| Use the stored |
2 |
|
|
3 | Other cases, including |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"reviews": [
{
"review_id": "rev-001",
"document_id": "doc-001",
"document_name": "troubleshooting-guide.md",
"knowledge_base_id": "kb-001",
"confidence_score": 0.85,
"decision": "pending_review",
"review_status": "pending",
"has_conflicts": false,
"has_contradictions": false,
"rewrite_needed": true,
"human_action": null,
"created_at": "2026-06-01T10:00:00Z"
}
],
"total": 42,
"page": 1,
"page_size": 20
}
}GetReviewDetail
Description
Retrieves review details, including quality scores, contradictions, conflicts, and rewritten content, in a unified envelope. Original content is paginated into 3,000-character pages selected by content_page.
Request syntax
GET /v1/knowledge/reviews/detailRequest parameters
Name | Type | Required | Description | Example |
review_id | string | Yes | The review record ID |
|
content_page | integer | No | The original-content page number. Default: |
|
Validation and out-of-range behavior
Parameter | Invalid or out-of-range input | Behavior |
review_id | Missing | Returns 400 for a missing required parameter. |
review_id | Does not exist in the current workspace. | Returns 400 with |
content_page |
| Silently clamped to |
content_page | Exceeds the actual page count. | No error. |
Response parameters (in the data field)
Name | Type | Description | Example |
review_id | string | The review record ID |
|
document_id | string | The document ID |
|
document_name | string | The document name, retrieved from the document record if absent in the review record. |
|
knowledge_base_id | string | The knowledge base ID |
|
member_id | string | The member ID that triggered ingestion. |
|
logic_score | float | The logical coherence score; higher is better. Null if unscored. |
|
noise_score | float | The noise ratio score; lower is better. |
|
contradiction_score | float | The internal contradiction score; lower is better. |
|
confidence_score | float | The overall confidence |
|
source_type | string | The source type: |
|
decision | string | The system decision. Valid values: |
|
decision_reason | string | The explanation of the decision. |
|
review_status | string | The derived review status: |
|
has_contradictions | boolean | Whether unresolvable internal contradictions exist. |
|
contradictions | string | Contradiction details as a JSON string, not an object. See the structure below. |
|
conflicts | string | Conflicts with the knowledge base as a JSON string. See the structure below. |
|
quality_details | string | Quality details as a JSON string, such as |
|
original_content | object | The paginated original content. See the subfields below. Null if the original content is empty. | See the following table |
original_logic_score | float | The logical coherence score before rewriting. |
|
original_noise_score | float | The noise score before rewriting. |
|
original_contradiction_score | float | The contradiction score before rewriting. |
|
original_contradictions | string | Contradiction details before rewriting, as a JSON string. | Empty array |
rewrite_needed | boolean | Indicates whether a rewrite is required |
|
rewrite_reason | string | The reason rewriting was triggered. |
|
rewrite_strategy | string | The rewrite strategy. See the values below. |
|
rewritten_content | string | The full AI-rewritten content, without pagination. |
|
rewrite_info_check | string | The rewrite information-preservation check as a JSON string, such as |
|
human_action | string | The manual action type, or null before an action. |
|
human_edited_content | string | The manually edited content, or null if not edited. |
|
human_conflict_resolutions | string | Manual conflict resolutions as a JSON string. |
|
human_action_by | string | The member ID that performed the manual action. |
|
human_action_at | string | The manual action time. |
|
loop_iterations | integer | The number of completed review/rewrite iterations. |
|
max_iterations | integer | The maximum iteration count. |
|
created_at | string | The creation time |
|
updated_at | string | The update time |
|
original_content object:
Name | Type | Description | Example |
text | string | The current page's original text, with 3,000 characters per page. Empty when the page is out of range. |
|
page | integer | The current page number, echoing content_page after clamping. |
|
total_pages | integer | The page count, calculated as |
|
total_chars | integer | The original content's total character count. |
|
rewrite_strategy values:
Value | Description |
| Denoising, selected when noise is the weakest dimension. |
| Restructuring, selected when logical coherence is the weakest dimension. |
| Contradiction repair, selected for resolvable internal contradictions. |
| Hybrid strategy; defined as a code constant. |
| Hallucination removal; defined as a code constant. |
conflicts elements, after parsing the JSON string:
Name | Type | Description |
id | string | The conflict ID used as |
kb_document_id | string | The knowledge base document ID containing the conflicting fact. |
kb_document_name | string | The knowledge base document name containing the conflicting fact. |
kb_fact | string | The existing fact in the knowledge base. |
new_fact | string | The new fact in the content being ingested. |
conflict_type | string | The conflict type. |
severity_score | float | The conflict severity score. |
ai_recommendation | string | The AI-recommended resolution. |
human_resolution | string | The manual resolution. |
contradictions elements, after parsing the JSON string:
Name | Type | Description |
snippet1 | string | The first contradictory excerpt. |
snippet2 | string | The second contradictory excerpt. |
type | string | The contradiction type. |
resolvable | boolean | Whether automatic resolution is possible. Unresolvable items set |
confidence | float | The confidence in the contradiction assessment. |
contradictions, conflicts, quality_details, original_contradictions, rewrite_info_check, and human_conflict_resolutions are JSON strings in the envelope. Parse them separately on the client. The table describes their decoded structure; actual fields follow the JSON saved during ingestion.
ReviewAction
Description
Performs a manual review action and returns a unified envelope. A record can be actioned only once: calls after human_action is written return HTTP 400. The workspace must be active.
Request syntax
POST /v1/knowledge/reviews/actionRequest parameters
Name | Type | Required | Description | Example |
review_id | string | Yes | The review record ID |
|
action | string | Yes | The action type. Valid values: |
|
edited_content | string | No | The manually edited content. It is used only for |
|
conflict_resolutions | array | No | The list of conflict resolutions |
|
Elements of the conflict_resolutions array:
Name | Type | Required | Description | Example |
conflict_id | string | Yes | The conflict ID from |
|
resolution | string | Yes | The resolution. Valid values: |
|
conflict_resolutions is serialized only into the human_conflict_resolutions audit field. The server does not validate whether conflict_id belongs to this review's conflicts or whether resolution is a defined value.
Action behavior
action | Meaning | Document processing | Stored review status |
| Confirm and ingest the original content. | Dispatches KNOWLEDGE_REVIEW_APPROVE with chunk and graph extraction enabled; sets the document review_status to |
|
| Force ingestion of the original content despite contradictions. | Same as |
|
| Accept the rewritten content. | Reingests |
|
| Reject ingestion. | Sets the document to |
|
| Reject and request reupload. | The same cleanup process as |
|
Validation and error behavior
Condition | HTTP | errorMessage |
| 400 |
|
| 400 |
|
| 400 |
|
The workspace does not exist. | 400 |
|
The workspace is not active, such as during downtime. | 400 |
|
| 400 |
|
The review already has a manual action. | 400 |
|
| 400 |
|
Response parameters (in the data field)
Returns the updated review details with the same fields as GetReviewDetail. original_content always contains page 1:
Name | Type | Description | Example |
review_id | string | The review record ID |
|
document_id | string | The document ID |
|
document_name | string | The document name |
|
knowledge_base_id | string | The knowledge base ID |
|
member_id | string | The member ID that triggered ingestion. |
|
logic_score | float | The logical coherence score. |
|
noise_score | float | The noise ratio score. |
|
contradiction_score | float | The internal contradiction score. |
|
confidence_score | float | The overall confidence |
|
source_type | string | The source type |
|
decision | string | The system decision. |
|
decision_reason | string | The explanation of the decision. |
|
review_status | string | The resulting review status: |
|
has_contradictions | boolean | Whether unresolvable internal contradictions exist. |
|
contradictions | string | Contradiction details as a JSON string. | Empty array |
conflicts | string | Conflict details as a JSON string. | Empty array |
quality_details | string | Quality details as a JSON string. |
|
original_content | object | Page 1 of the original content, with the same subfields as GetReviewDetail. | See GetReviewDetail. |
original_logic_score | float | The logical coherence score before rewriting. |
|
original_noise_score | float | The noise score before rewriting. |
|
original_contradiction_score | float | The contradiction score before rewriting. |
|
original_contradictions | string | Contradiction details before rewriting, as a JSON string. | Empty array |
rewrite_needed | boolean | Indicates whether a rewrite is required |
|
rewrite_reason | string | The reason rewriting was triggered. |
|
rewrite_strategy | string | The rewrite strategy |
|
rewritten_content | string | The full AI-rewritten content. |
|
rewrite_info_check | string | The rewrite information-preservation check as a JSON string. |
|
human_action | string | The manual action type saved by this call. |
|
human_edited_content | string | The manually edited content saved by this call. |
|
human_conflict_resolutions | string | The conflict resolutions saved by this call, as a JSON string. |
|
human_action_by | string | The acting member ID, supplied by the server. |
|
human_action_at | string | The manual action time. |
|
loop_iterations | integer | The number of completed review/rewrite iterations. |
|
max_iterations | integer | The maximum iteration count. |
|
created_at | string | The creation time |
|
updated_at | string | The update time |
|
Examples
Request body:
{
"review_id": "rev-001",
"action": "accept_rewrite",
"edited_content": "Modified document content..."
}DeleteReview
Description
Deletes one review record whose stored status is reviewed or rejected. Deletion is permanent and cannot be undone. Only the review record is removed; ingested documents are unaffected.
Request syntax
DELETE /v1/knowledge/reviewsRequest parameters
Name | Type | Required | Description | Example |
review_id | string | Yes | The review record ID |
|
Deletion eligibility
Eligibility uses the stored status, not the derived response field review_status:
Stored status | When assigned | Deletable |
| After | Yes |
| After | Yes |
| The initial value for records without a manual action, including | No; returns HTTP 400. |
For decision=auto_accept, the derived review_status is reviewed, but stored status remains active. Such records cannot be deleted and return only reviewed or rejected review can be deleted, current status: active. This is the current behavior.
Error behavior
Condition | HTTP | errorMessage |
| 400 | Missing required parameter. |
| 400 |
|
The record does not exist in the current workspace. | 400 |
|
The stored status is neither | 400 |
|
Response parameters (in the data field)
Name | Type | Description | Example |
review_id | string | The deleted review record ID. |
|
deleted | boolean | Whether deletion succeeded. Fixed to |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"review_id": "rev-001",
"deleted": true
}
}ResolveConflicts
Description
Records decisions for individual conflicts in a unified envelope. Only audit fields are written: human_conflict_resolutions, human_action_by, and human_action_at. It does not write human_action, change stored status, or trigger ingestion or deletion. review_status remains pending; call ReviewAction to apply the review decision.
Request syntax
POST /v1/knowledge/reviews/resolve-conflictsRequest parameters
Name | Type | Required | Description | Example |
review_id | string | Yes | The review record ID |
|
resolutions | array | Yes | A nonempty conflict resolution list. See the element fields below. |
|
resolutions elements:
Name | Type | Required | Description | Example |
conflict_id | string | Yes | The conflict ID from |
|
resolution | string | Yes | The resolution. Valid values: |
|
As with ReviewAction, the server serializes and stores the entire list. It does not validate whether conflict_id belongs to the review or whether resolution is defined. Repeated calls replace the previous list.
Error behavior
Condition | HTTP | errorMessage |
| 400 |
|
| 400 |
|
The record does not exist in the current workspace. | 400 |
|
Response parameters (in the data field)
Returns the updated review details with the same fields as GetReviewDetail. original_content always contains page 1:
Name | Type | Description | Example |
review_id | string | The review record ID |
|
document_id | string | The document ID |
|
document_name | string | The document name |
|
knowledge_base_id | string | The knowledge base ID |
|
member_id | string | The member ID that triggered ingestion. |
|
logic_score | float | The logical coherence score. |
|
noise_score | float | The noise ratio score. |
|
contradiction_score | float | The internal contradiction score. |
|
confidence_score | float | The overall confidence |
|
source_type | string | The source type |
|
decision | string | The system decision. |
|
decision_reason | string | The explanation of the decision. |
|
review_status | string | The review status, unchanged by this operation and usually still |
|
has_contradictions | boolean | Whether unresolvable internal contradictions exist. |
|
contradictions | string | Contradiction details as a JSON string. | Empty array |
conflicts | string | Conflict details as a JSON string. |
|
quality_details | string | Quality details as a JSON string. |
|
original_content | object | Page 1 of the original content. | See GetReviewDetail. |
original_logic_score | float | The logical coherence score before rewriting. |
|
original_noise_score | float | The noise score before rewriting. |
|
original_contradiction_score | float | The contradiction score before rewriting. |
|
original_contradictions | string | Contradiction details before rewriting, as a JSON string. | Empty array |
rewrite_needed | boolean | Indicates whether a rewrite is required |
|
rewrite_reason | string | The reason rewriting was triggered. |
|
rewrite_strategy | string | The rewrite strategy |
|
rewritten_content | string | The full AI-rewritten content. |
|
rewrite_info_check | string | The rewrite information-preservation check as a JSON string. |
|
human_action | string | The manual action type. Not written by this operation and remains null. |
|
human_edited_content | string | The manually edited content |
|
human_conflict_resolutions | string | The conflict resolutions saved by this call, as a JSON string. |
|
human_action_by | string | The acting member ID, supplied by the server. |
|
human_action_at | string | The time of this operation. |
|
loop_iterations | integer | The number of completed review/rewrite iterations. |
|
max_iterations | integer | The maximum iteration count. |
|
created_at | string | The creation time |
|
updated_at | string | The update time |
|
Examples
Request body:
{
"review_id": "rev-001",
"resolutions": [
{
"conflict_id": "c1",
"resolution": "use_new"
}
]
}BatchReviewAction
Description
Runs confirm or reject for up to 50 reviews. Items execute sequentially using single-item action logic. Individual failures do not stop the batch; each failed item includes an error in results.
Request syntax
POST /v1/knowledge/reviews/batchRequest parameters
Name | Type | Required | Description | Example |
action | string | Yes | The batch action: |
|
ids | array | Yes | A nonempty list of up to 50 review IDs. |
|
Validation and out-of-range behavior
Condition | HTTP | errorMessage |
| 400 |
|
| 400 |
|
| 400 |
|
| 400; not truncated. |
|
| 400 |
|
The workspace is not active. | 400 |
|
ids values are trimmed and processed in input order. Duplicates are not removed; the second occurrence fails because the review was already actioned.
Response parameters (in the data field)
Name | Type | Description | Example |
total | integer | The submitted item count. |
|
succeeded | integer | The number of successful records |
|
failed | integer | The number of failed records |
|
results | array | The per-item results. See the fields below. | See the example |
Elements of the results array:
Name | Type | Description | Example |
id | string | The review ID, echoing the original untrimmed input. |
|
success | boolean | Whether this item succeeded. |
|
error | string | The failure reason. Omitted from JSON on success. |
|
Examples
Request body:
{
"action": "confirm",
"ids": [
"rev-001",
"rev-002"
]
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"total": 2,
"succeeded": 1,
"failed": 1,
"results": [
{
"id": "rev-001",
"success": true
},
{
"id": "rev-002",
"success": false,
"error": "review not found: rev-002"
}
]
}
}BatchDeleteReviews
Description
Permanently deletes up to 50 reviews with stored status reviewed or rejected. Items are prevalidated, then eligible records are deleted in a batch. Individual failures do not stop the batch.
Request syntax
DELETE /v1/knowledge/reviews/batchRequest parameters
Name | Type | Required | Description | Example |
ids | array | Yes | A nonempty list of up to 50 review IDs. |
|
Validation and out-of-range behavior
Condition | HTTP | errorMessage |
| 400 |
|
| 400; not truncated. |
|
| 400 |
|
Per-item failures
Condition | Item error |
The record does not exist in the current workspace. |
|
The stored status is neither |
|
Response parameters (in the data field)
Name | Type | Description | Example |
total | integer | The submitted item count. |
|
succeeded | integer | The number of successful records |
|
failed | integer | The number of failed records |
|
results | array | The per-item results. See the fields below. | See the example |
Elements of the results array:
Name | Type | Description | Example |
id | string | The review record ID |
|
success | boolean | Whether this item succeeded. |
|
error | string | The failure reason. Omitted from JSON on success. |
|
Examples
Request body:
{
"ids": [
"rev-001",
"rev-002"
]
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"total": 2,
"succeeded": 1,
"failed": 1,
"results": [
{
"id": "rev-001",
"success": true
},
{
"id": "rev-002",
"success": false,
"error": "review is not deletable, current status: active"
}
]
}
}KnowledgeReviewTemplates
Knowledge review rewrite templates belong to individual knowledge bases and control rewrite prompts. Reads require KB_READ; writes require KB_WRITE. Each knowledge base supports up to five active templates.
Isolation and limits:
Item | Value | Basis |
Isolation scope | Knowledge base (KB) | The unique key is |
Active templates per KB | 5 | Application validation returns HTTP 400 if exceeded. |
Maximum template name length | 128 characters | Measured after trimming. |
Section count range | 1-15 | Empty arrays and more than 15 sections return HTTP 400. |
Heading level range | 1 to 3, corresponding to | Out-of-range values return HTTP 400. |
Maximum rendered Markdown length | 65,536 characters | Exceeding the limit returns HTTP 400. |
Insufficient permissions | HTTP 400, with | Not 403. |
Template object:
Name | Type | Description | Example |
id | string | The template ID |
|
knowledge_base_id | string | The knowledge base ID |
|
name | string | The template name |
|
is_default | boolean | Whether this is the KB's default template. |
|
sections | array | The structured section array. See the fields below. | See the example |
content | string | The Markdown template rendered by the server. |
|
created_by | string | The creator's member ID. |
|
created_at | string | The creation time in UTC with a Z suffix. |
|
updated_at | string | The update time in UTC with a Z suffix. |
|
Elements of the sections array:
Name | Type | Description | Example |
level | integer | The heading level, 1 to 3. Defaults to 1 if omitted. |
|
title | string | The required, nonempty, single-line section title. |
|
guidance | string | Required, nonempty writing guidance. Multiple lines are allowed. |
|
ListKnowledgeReviewTemplates
Description
Lists all active review rewrite templates in a knowledge base, sorted by name ascending. Requires KB_READ permission.
Request syntax
GET /v1/knowledge/review_templates?knowledge_base_id={knowledge_base_id}Request parameters
Name | Type | Required | Description | Example |
knowledge_base_id | string | Yes | The knowledge base ID as a query parameter. |
|
Response parameters (in the data field)
Name | Type | Description | Example |
data | array | Template objects sorted by name ascending. Empty if no active templates exist. See the fields below. | See the example |
data elements (template objects):
Name | Type | Description | Example |
id | string | The template ID |
|
knowledge_base_id | string | The knowledge base ID |
|
name | string | The template name |
|
is_default | boolean | Whether this is the KB's default template. |
|
sections | array | The structured section array, using the sections element fields above. | See the example |
content | string | The Markdown template rendered by the server. |
|
created_by | string | The creator's member ID. |
|
created_at | string | The creation time in UTC with a Z suffix. |
|
updated_at | string | The update time in UTC with a Z suffix. |
|
Error behavior
Condition | HTTP | errorMessage |
| 400 | Missing required parameter. |
The KB does not exist or belongs to another workspace. | 400 |
|
No KB_READ permission. | 400 |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": [
{
"id": "tpl-001",
"knowledge_base_id": "kb-001",
"name": "Customer service review template",
"is_default": true,
"sections": [
{
"level": 1,
"title": "Issue summary",
"guidance": "Summarize the core issues in the original content that require rewriting"
}
],
"content": "# Issue summary\nSummarize the core issues in the original content that require rewriting",
"created_by": "member-001",
"created_at": "2026-06-01T10:00:00Z",
"updated_at": "2026-06-01T10:00:00Z"
}
]
}CreateKnowledgeReviewTemplate
Description
Creates a review rewrite template. name is required, unique within the KB, and at most 128 characters. sections requires 1 to 15 entries. Each title must be nonempty and single-line; guidance must be nonempty and may span lines, but not blank lines. level defaults to 1 and must be 1 to 3. Each KB allows five active templates. Limit, duplicate-name, or section-validation failures return HTTP 400. is_default=true clears other KB defaults. Requires KB_WRITE.
Request syntax
POST /v1/knowledge/review_templates?knowledge_base_id={knowledge_base_id}Request parameters
Name | Type | Required | Description | Example |
knowledge_base_id | string | Yes | The knowledge base ID as a query parameter. |
|
name | string | Yes | The template name, unique within the KB and at most 128 characters. |
|
is_default | boolean | No | Whether to make this the KB default. Default: false. True clears other default templates in the KB. |
|
sections | array | Yes | The ordered section list, with 1 to 15 entries. | See the following table |
Elements of the sections array:
Name | Type | Required | Description | Example |
level | integer | No | The heading level, 1 to 3. Default: 1. |
|
title | string | Yes | The section title, nonempty after trimming and single-line. |
|
guidance | string | Yes | Writing guidance, nonempty after trimming. Multiple lines are allowed, but blank lines are prohibited. |
|
Validation rules and errors
Condition | HTTP | errorMessage |
The KB does not exist or belongs to another workspace. | 400 |
|
No KB_WRITE permission. | 400 |
|
| 400 |
|
| 400 |
|
| 400 |
|
| 400 |
|
Trimmed | 400 |
|
The KB already has five active templates. | 400 |
|
An active template with this | 400 |
|
| 400 |
|
| 400 |
|
| 400 |
|
| 400 |
|
| 400 |
|
Rendered Markdown exceeds 65,536 characters. | 400 |
|
Rendering and parsing do not round-trip consistently. | 400 |
|
Each line of title and guidance is trimmed before normalization and storage. Responses contain the normalized values.
Response parameters (in the data field)
Name | Type | Description | Example |
id | string | The new template ID. |
|
knowledge_base_id | string | The knowledge base ID |
|
name | string | The trimmed template name. |
|
is_default | boolean | Whether this is the KB's default template. |
|
sections | array | The structured section array, using the sections element fields above. | See the example |
content | string | The Markdown template rendered by the server. |
|
created_by | string | The creator's member ID, supplied by the server. |
|
created_at | string | The creation time in UTC with a Z suffix. |
|
updated_at | string | The update time in UTC with a Z suffix. |
|
Examples
Request body:
{
"name": "Customer service review template",
"is_default": true,
"sections": [
{
"level": 1,
"title": "Issue summary",
"guidance": "Summarize the core issues in the original content that require rewriting"
},
{
"level": 2,
"title": "Suggested rewrite",
"guidance": "Produce rewritten content ready for ingestion"
}
]
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"id": "tpl-001",
"knowledge_base_id": "kb-001",
"name": "Customer service review template",
"is_default": true,
"sections": [
{
"level": 1,
"title": "Issue summary",
"guidance": "Summarize the core issues in the original content that require rewriting"
},
{
"level": 2,
"title": "Suggested rewrite",
"guidance": "Produce rewritten content ready for ingestion"
}
],
"content": "# Issue summary\nSummarize the core issues in the original content that require rewriting\n\n## Suggested rewrite\nProduce rewritten content ready for ingestion",
"created_by": "member-001",
"created_at": "2026-06-01T10:00:00Z",
"updated_at": "2026-06-01T10:00:00Z"
}
}GetKnowledgeReviewTemplate
Description
Retrieves template details. Returns HTTP 200 with data=null if absent. Requires KB_READ permission.
Request syntax
GET /v1/knowledge/review_templates/detail?knowledge_base_id={knowledge_base_id}&template_id={template_id}Request parameters
Name | Type | Required | Description | Example |
knowledge_base_id | string | Yes | The knowledge base ID |
|
template_id | string | Yes | The template ID |
|
Response parameters (in the data field)
If the template is missing, belongs to another KB, or is soft-deleted, data is null, HTTP remains 200, and errorCode remains 0. Otherwise, returns:
Name | Type | Description | Example |
id | string | The template ID |
|
knowledge_base_id | string | The knowledge base ID |
|
name | string | The template name |
|
is_default | boolean | Whether this is the KB's default template. |
|
sections | array | The structured section array, using the sections element fields above. | See the example |
content | string | The Markdown template rendered by the server. |
|
created_by | string | The creator's member ID. |
|
created_at | string | The creation time in UTC with a Z suffix. |
|
updated_at | string | The update time in UTC with a Z suffix. |
|
Error behavior
Condition | HTTP | errorMessage |
| 400 | Missing required parameter. |
The KB does not exist or belongs to another workspace. | 400 |
|
No KB_READ permission. | 400 |
|
The template does not exist. | 200 |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"id": "tpl-001",
"knowledge_base_id": "kb-001",
"name": "Customer service review template",
"is_default": true,
"sections": [
{
"level": 1,
"title": "Issue summary",
"guidance": "Summarize the core issues in the original content that require rewriting"
}
],
"content": "# Issue summary\nSummarize the core issues in the original content that require rewriting",
"created_by": "member-001",
"created_at": "2026-06-01T10:00:00Z",
"updated_at": "2026-06-01T10:00:00Z"
}
}Template not found:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": null
}UpdateKnowledgeReviewTemplate
Description
Updates a template by template_id. All three body fields are optional and support partial updates. Omitted or blank name preserves the name; renaming must remain unique in the KB. A nonempty sections array replaces all sections and rebuilds content; omission or an empty array preserves them. is_default=true clears other defaults and selects this template; false clears its default flag; omission preserves it. The body must not be null. Missing templates return HTTP 400. Requires KB_WRITE.
Request syntax
PUT /v1/knowledge/review_templates?knowledge_base_id={knowledge_base_id}&template_id={template_id}Request parameters
Name | Type | Required | Description | Example |
knowledge_base_id | string | Yes | The knowledge base ID as a query parameter. |
|
template_id | string | Yes | The template ID as a query parameter. |
|
name | string | No | The template name, unique within the KB and at most 128 characters. Omission or blank input preserves the current name. |
|
is_default | boolean | No | True selects this default and clears other KB defaults; false clears this template's flag; omission preserves it. |
|
sections | array | No | An ordered list of 1 to 15 sections. A nonempty array replaces sections and rebuilds content; omission or an empty array preserves them. | See the following table |
Elements of the sections array:
Name | Type | Required | Description | Example |
level | integer | No | The heading level, 1 to 3. Default: 1. |
|
title | string | Yes | The section title, nonempty after trimming and single-line. |
|
guidance | string | Yes | Writing guidance, nonempty after trimming. Multiple lines are allowed, but blank lines are prohibited. |
|
Validation rules and errors
Condition | HTTP | errorMessage |
The request body is missing. | 400 |
|
The KB does not exist or belongs to another workspace. | 400 |
|
No KB_WRITE permission. | 400 |
|
The template is missing, belongs to another KB, or is soft-deleted. | 400 |
|
Trimmed | 400 |
|
The new | 400 |
|
| 400 | The corresponding error from CreateKnowledgeReviewTemplate. |
Response parameters (in the data field)
Name | Type | Description | Example |
id | string | The template ID |
|
knowledge_base_id | string | The knowledge base ID |
|
name | string | The updated template name. |
|
is_default | boolean | The updated default flag. |
|
sections | array | The updated structured sections, using the fields above. | See the example |
content | string | The rebuilt Markdown template. |
|
created_by | string | The creator's member ID, unchanged by updates. |
|
created_at | string | The creation time in UTC with a Z suffix. |
|
updated_at | string | The update time in UTC with a Z suffix. |
|
Examples
Request body:
{
"name": "Customer service review template v2",
"sections": [
{
"level": 1,
"title": "Issue summary",
"guidance": "Summarize the issue"
}
]
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"id": "tpl-001",
"knowledge_base_id": "kb-001",
"name": "Customer service review template v2",
"is_default": true,
"sections": [
{
"level": 1,
"title": "Issue summary",
"guidance": "Summarize the issue"
}
],
"content": "# Issue summary\nSummarize the issue",
"created_by": "member-001",
"created_at": "2026-06-01T10:00:00Z",
"updated_at": "2026-06-01T10:10:00Z"
}
}DeleteKnowledgeReviewTemplate
Description
Soft-deletes the template: sets status=deleted, clears content, and renames it to avoid uniqueness conflicts. Repeated deletion is idempotent. Requires KB_WRITE.
Request syntax
DELETE /v1/knowledge/review_templates?knowledge_base_id={knowledge_base_id}&template_id={template_id}Request parameters
Name | Type | Required | Description | Example |
knowledge_base_id | string | Yes | The knowledge base ID |
|
template_id | string | Yes | The template ID |
|
Deletion behavior
Item | Behavior |
Deletion method | Soft deletion: sets |
Tombstone name | Rewrites |
Idempotency | For missing or soft-deleted templates, returns |
Default flag | Soft deletion does not explicitly clear |
Difference from review record deletion | Review records (DeleteReview and BatchDeleteReviews) are permanently deleted; templates are soft-deleted. |
Error behavior
Condition | HTTP | errorMessage |
| 400 | Missing required parameter. |
The KB does not exist or belongs to another workspace. | 400 |
|
No KB_WRITE permission. | 400 |
|
Response parameters (in the data field)
Name | Type | Description | Example |
deleted | boolean | Whether deletion succeeded. Fixed to |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"deleted": true
}
}SetDefaultKnowledgeReviewTemplate
Description
Sets the KB's default rewrite template and clears other defaults in the same transaction. Requires KB_WRITE.
Request syntax
POST /v1/knowledge/review_templates/set_default?knowledge_base_id={knowledge_base_id}&template_id={template_id}Request parameters
Name | Type | Required | Description | Example |
knowledge_base_id | string | Yes | The knowledge base ID |
|
template_id | string | Yes | The template ID |
|
Error behavior
Condition | HTTP | errorMessage |
| 400 | Missing required parameter. |
The KB does not exist or belongs to another workspace. | 400 |
|
No KB_WRITE permission. | 400 |
|
The template is missing, belongs to another KB, or is soft-deleted. | 400 |
|
Response parameters (in the data field)
Name | Type | Description | Example |
id | string | The template ID |
|
knowledge_base_id | string | The knowledge base ID |
|
name | string | The template name |
|
is_default | boolean | Fixed to |
|
sections | array | The structured section array, using the sections element fields above. | See the example |
content | string | The Markdown template rendered by the server. |
|
created_by | string | The creator's member ID. |
|
created_at | string | The creation time in UTC with a Z suffix. |
|
updated_at | string | The update time in UTC with a Z suffix. |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"id": "tpl-001",
"knowledge_base_id": "kb-001",
"name": "Customer service review template",
"is_default": true,
"sections": [
{
"level": 1,
"title": "Issue summary",
"guidance": "Summarize the core issues in the original content that require rewriting"
}
],
"content": "# Issue summary\nSummarize the core issues in the original content that require rewriting",
"created_by": "member-001",
"created_at": "2026-06-01T10:00:00Z",
"updated_at": "2026-06-01T10:00:00Z"
}
}ClearDefaultKnowledgeReviewTemplate
Description
Clears all template is_default flags in the KB, restoring no-template runtime behavior. Succeeds idempotently if there is no default. Requires KB_WRITE.
Request syntax
DELETE /v1/knowledge/review_templates/default?knowledge_base_id={knowledge_base_id}Request parameters
Name | Type | Required | Description | Example |
knowledge_base_id | string | Yes | The knowledge base ID |
|
Error behavior
Condition | HTTP | errorMessage |
| 400 | Missing required parameter. |
The KB does not exist or belongs to another workspace. | 400 |
|
No KB_WRITE permission. | 400 |
|
Response parameters (in the data field)
Name | Type | Description | Example |
cleared | boolean | Whether default flags were cleared. Fixed to |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"cleared": true
}
}ReviewSettings
Review settings have one workspace-scoped record keyed by knowledge_review_settings.workspace_id. The API key supplies the workspace. Neither reading nor writing requires an administrator role.
GetReviewSettings
Description
Retrieves workspace review settings in a unified envelope. If unconfigured, returns defaults without creating a stored record; created_at and updated_at are null.
Request syntax
GET /v1/knowledge/reviewSettingsRequest parameters
None.
Response parameters (in the data field)
Name | Type | Description | Example |
workspace_id | string | The workspace ID |
|
high_threshold | float | The automatic acceptance threshold. A document whose confidence is higher than this score is automatically ingested. If the confidence is lower than this score and rewriting is enabled, a document rewrite is triggered |
|
rewrite_enabled | boolean | Specifies whether document rewriting is enabled |
|
conflict_detection_enabled | boolean | Specifies whether conflict detection is enabled |
|
rewrite_auto_ingest_enabled | boolean | Specifies whether rewritten documents are automatically ingested |
|
logic_rewrite_threshold | float | The logic-based rewrite trigger threshold. Deprecated: a rewrite is now triggered when the confidence is lower than |
|
noise_rewrite_threshold | float | The noise-based rewrite trigger threshold. Deprecated: same as above |
|
max_rewrite_iterations | integer | The maximum number of rewrite iterations |
|
created_at | string | The creation time, or |
|
updated_at | string | The update time, or |
|
Defaults for unconfigured workspaces
Field | Default | Source |
high_threshold |
| System default |
rewrite_enabled |
| Assigned when the service constructs default settings. |
conflict_detection_enabled |
| Assigned when the service constructs default settings. |
rewrite_auto_ingest_enabled |
| The entity field default. |
logic_rewrite_threshold |
| System default |
noise_rewrite_threshold |
| System default |
max_rewrite_iterations |
| System default |
Decision and rewrite rules
Rule | Behavior |
| Sets |
| Sets |
Unresolvable internal contradictions exist. | Forces |
High-severity hallucinations exist. | Forces |
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": {
"workspace_id": "ws-001",
"high_threshold": 0.8,
"rewrite_enabled": true,
"conflict_detection_enabled": true,
"rewrite_auto_ingest_enabled": false,
"logic_rewrite_threshold": 0.5,
"noise_rewrite_threshold": 0.3,
"max_rewrite_iterations": 3,
"created_at": "2026-06-01T00:00:00Z",
"updated_at": "2026-06-01T10:00:00Z"
}
}UpdateReviewSettings
Description
Partially updates workspace review settings in a unified envelope. Only supplied fields change. If no settings record exists, the first call creates one and assigns defaults to omitted fields.
Request syntax
PUT /v1/knowledge/reviewSettingsRequest parameters
Name | Type | Required | Description | Example |
high_threshold | float | No | The automatic acceptance threshold, which also serves as the trigger line for document rewriting: a rewrite is triggered when the confidence is lower than this value and rewriting is enabled |
|
rewrite_enabled | boolean | No | Specifies whether document rewriting is enabled |
|
conflict_detection_enabled | boolean | No | Specifies whether conflict detection is enabled |
|
rewrite_auto_ingest_enabled | boolean | No | Specifies whether rewritten documents are automatically ingested |
|
logic_rewrite_threshold | float | No | The logic-based rewrite trigger threshold. Deprecated: it no longer participates in triggering |
|
noise_rewrite_threshold | float | No | The noise-based rewrite trigger threshold. Deprecated: it no longer participates in triggering |
|
max_rewrite_iterations | integer | No | The maximum number of rewrite iterations |
|
Response parameters
data is always null. The envelope's errorCode: 0 indicates success. Call GetReviewSettings again to retrieve the complete updated configuration.
Examples
Request body:
{
"high_threshold": 0.85,
"rewrite_auto_ingest_enabled": true
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-xxx",
"data": null
}