> For the complete documentation index, see [llms.txt](https://docs.ibexa.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ibexa.ai/developers/rest-api/knowledge-base/restore-document-version-as-draft.md).

# Restore Document Version As Draft

Start a new editable draft from a previously-archived version.

Unlike rollback (which re-publishes the archived snapshot unchanged), this mints a fresh draft (the next version number) whose content is copied from the archived version, leaving the archived row intact in history — so an old version can be revised and then published through the normal draft flow. Returns the new draft immediately; nothing is live until it is published. 400 if the target is not an archived version; 404 if the node or version does not exist in the caller's organisation.

```json
{"openapi":"3.1.0","info":{"title":"Ibexa Agentic Marketing Platform","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"/api/v1/login/access-token"}}}},"schemas":{"KnowledgeDocumentVersionResponseSchema":{"properties":{"id":{"type":"integer","title":"Id"},"version_number":{"type":"integer","title":"Version Number"},"status":{"$ref":"#/components/schemas/VersionStatus"},"name":{"type":"string","title":"Name"},"source_file_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Source File Id"},"parse_status":{"$ref":"#/components/schemas/DocumentParseStatus"},"embedding_status":{"$ref":"#/components/schemas/EmbeddingStatus"},"published_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Published At"},"publish_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Publish Error"},"created_by":{"anyOf":[{"$ref":"#/components/schemas/KnowledgeNodeUserSchema"},{"type":"null"}]},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"document_id":{"type":"integer","title":"Document Id"},"node_id":{"type":"integer","title":"Node Id"},"markdown":{"type":"string","title":"Markdown"},"parse_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parse Error"},"updated_by":{"anyOf":[{"$ref":"#/components/schemas/KnowledgeNodeUserSchema"},{"type":"null"}]}},"type":"object","required":["id","version_number","status","name","source_file_id","parse_status","embedding_status","published_at","publish_error","created_by","created_at","updated_at","document_id","node_id","markdown","parse_error","updated_by"],"title":"KnowledgeDocumentVersionResponseSchema","description":"A single version's full view — the history-row metadata plus the body."},"VersionStatus":{"type":"string","enum":["draft","publishing","published","archived"],"title":"VersionStatus","description":"Publication state of a single knowledge-document version.\n\nA version is created `DRAFT` (editable, not live). Requesting publication\nmoves it to `PUBLISHING` (edit-locked) while its chunks are embedded; once\nthe embeddings are ready the pointer flip marks it `PUBLISHED` and the\npreviously published version becomes `ARCHIVED`. A rollback re-publishes an\n`ARCHIVED` version through the same `PUBLISHING` state. A failed go-live\nreturns the version to its pre-attempt state: a failed publish reverts to\n`DRAFT`, a failed rollback reverts to `ARCHIVED` (see `PublishOrigin`).\n\nLegal transitions are enforced by the `KnowledgeDocumentVersion` entity (its\nstatus setter is a state machine); this enum only names the states. Only\n`knowledge_document.published_version_id` decides what retrieval serves —\nthe status is descriptive history metadata for the UI."},"DocumentParseStatus":{"type":"string","enum":["pending","processing","completed","failed"],"title":"DocumentParseStatus","description":"Lifecycle of a file-uploaded document's Markdown conversion.\n\nInline-authored documents are `COMPLETED` on creation (nothing to parse).\nA file upload starts `PENDING`, moves to `PROCESSING` when the background\ntask picks it up, then to a terminal `COMPLETED` or `FAILED`."},"EmbeddingStatus":{"type":"string","enum":["pending","ready","failed"],"title":"EmbeddingStatus","description":"Progress of embedding a version's chunks under the org's current model.\n\nInformational only: retrieval never depends on it (search joins the actual\nembedding rows, so an unembedded version simply yields no hits). `PENDING`\nuntil a publish embeds the version, `READY` once every chunk is embedded,\n`FAILED` if embedding gave up (the version then reverts to draft)."},"KnowledgeNodeUserSchema":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"email":{"type":"string","title":"Email"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"}},"type":"object","required":["id","email","full_name"],"title":"KnowledgeNodeUserSchema","description":"Basic info about a node's creator/updater."}}},"paths":{"/api/v1/knowledge-base/nodes/{node_id}/versions/{version_id}/restore":{"post":{"tags":["knowledge-base","public"],"summary":"Restore Document Version As Draft","description":"Start a new editable draft from a previously-archived version.\n\nUnlike rollback (which re-publishes the archived snapshot unchanged), this\nmints a fresh draft (the next version number) whose content is copied from the\narchived version, leaving the archived row intact in history — so an old\nversion can be revised and then published through the normal draft flow.\nReturns the new draft immediately; nothing is live until it is published.\n400 if the target is not an archived version; 404 if the node or version does\nnot exist in the caller's organisation.","operationId":"knowledge-base-restore_document_version_as_draft","parameters":[{"name":"node_id","in":"path","required":true,"schema":{"type":"integer","title":"Node Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"integer","title":"Version Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeDocumentVersionResponseSchema"}}}},"400":{"description":"Invalid request payload or parameters","content":{"application/json":{}}},"401":{"description":"User not authenticated","content":{"application/json":{}}},"403":{"description":"User lacks permission","content":{"application/json":{}}},"404":{"description":"Resource not found or user has no permission to access it","content":{"application/json":{}}}}}}}}
```
