---
title: "恢复分块历史版本"
method: POST
path: "/chunks/{knowledge_id}/{id}/revert"
tags: ["分块管理"]
---

# 恢复分块历史版本

`POST /chunks/{knowledge_id}/{id}/revert`

## Request

- Base URL: `/api/v1` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/chunks/{knowledge_id}/{id}/revert`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `X-API-Key`

## Path parameters

- `knowledge_id` string, required
- `id` string, required

## Request body

- InternalHandlerRevertChunkRequest
  - `expected_revision` integer: Current content_revision from chunk.get; a stale value fails with HTTP 409.
  - `revision` integer, required: Historical revision number from chunk.list_revisions to restore.

## Response `200`

OK

- object
  - `data` GithubComTencentWeKnoraInternalTypesChunk
    - `chunk_index` integer: Index position of the chunk in the original document
    - `chunk_type` 'text' | 'parent_text' | 'image_ocr' | 'image_caption' | 'image_vector' | 'entity' | 'relationship' | 'faq' | 'web_search' | 'table_summary' | 'table_column' | 'wiki_page'
    - `content` string: Actual text content of the chunk
    - `content_hash` string: ContentHash 存储内容的 hash 值，用于快速匹配（主要用于 FAQ）
    - `content_revision` integer: ContentRevision is incremented for every user edit or rollback.
    - `created_at` string: Chunk creation time
    - `deleted_at` GormDeletedAt
      - `time` string
      - `valid` boolean: Valid is true if Time is not NULL
    - `end_at` integer: Ending character position in the original text
    - `flags` 1
    - `id` string: Unique identifier of the chunk, using UUID format
    - `image_info` string: 图片信息，存储为 JSON
    - `index_status` string: IndexStatus reports whether the current content is reflected in the retrieval stores: ready | processing | failed.
    - `indirect_relation_chunks` string[]: 间接关系 Chunk ID，用于关联间接关系 Chunk 和原始文本 Chunk
    - `is_enabled` boolean: Whether the chunk is enabled, can be used to temporarily disable certain chunks
    - `knowledge_base_id` string: ID of the knowledge base, for quick location
    - `knowledge_id` string: ID of the parent knowledge, associated with the Knowledge model
    - `last_editor_id` string: LastEditorID records the actor that produced the current revision.
    - `metadata` object: Metadata 存储 chunk 级别的扩展信息，例如 FAQ 元数据
    - `next_chunk_id` string: Next chunk ID
    - `parent_chunk_id` string: 父 Chunk ID，用于关联图片 Chunk 和原始文本 Chunk
    - `pre_chunk_id` string: Previous chunk ID
    - `relation_chunks` string[]: 关系 Chunk ID，用于关联关系 Chunk 和原始文本 Chunk
    - `seq_id` integer: SeqID is an auto-increment integer ID for external API usage (FAQ entries)
    - `source_locators` GithubComTencentWeKnoraInternalTypesSourceLocator[]: SourceLocators point back into the original file (page and region, slide, sheet rows, ...) so citations can open the file at this chunk. Empty when the parser reported no positions.
      - `bbox` number[]: BBox is [x0, y0, x1, y1] as fractions of the page width and height, origin at the top-left corner of the rendered page.
      - `block` integer: Block is the 1-based index among a Word file's body paragraphs and tables.
      - `end` integer
      - `end_ms` integer
      - `mapping` string: Mapping records verified text-to-source alignment. Empty means legacy.
      - `page` integer: Page is the 1-based PDF page.
      - `partial` boolean: Partial means some of the chunk has no source mapping.
      - `quote` string: Quote is the complete cited overlap as parsed. Viewers match it inside the rendered original and against the answer sentence that cites the chunk.
      - `row_end` integer
      - `row_start` integer
      - `section` integer: Section is the 1-based EPUB spine index.
      - `sheet` string: Sheet is the spreadsheet sheet name; RowStart/RowEnd are its 1-based row numbers as shown by spreadsheet applications.
      - `slide` integer: Slide is the 1-based slide number in presentation order.
      - `source_hash` string: SourceHash binds the locator to the knowledge record’s source revision hash.
      - `source_id` string: SourceID identifies a block within the parser result, not a rendered item.
      - `start` integer: Start/End are rune offsets into the original text file.
      - `start_ms` integer: StartMs/EndMs bound an audio segment.
      - `title` string: Title names the section or slide when the source has one.
      - `type` string
    - `start_at` integer: Starting character position in the original text
    - `status` integer: Status of the chunk
    - `tag_id` string: Optional tag ID for categorization within a knowledge base (used for FAQ)
    - `tenant_id` integer: Tenant ID, used for multi-tenant isolation
    - `updated_at` string: Chunk last update time
  - `success` boolean

## Changes

- **2026-10-17** `de9fb40c7476`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/chunks/:knowledge_id/:id/revert/post.md)

---

[API](https://skmtc.dev/tencentblueking/apis/weknora-api.md) - [All operations](https://skmtc.dev/tencentblueking/apis/weknora-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tencentblueking/apis/weknora-api/revisions/685d1f9fce30?raw)
