---
title: "Restore a context document revision"
method: POST
path: "/api/v1/context/{slug}/revisions/{revision}/restore"
tags: ["Context"]
---

# Restore a context document revision

`POST /api/v1/context/{slug}/revisions/{revision}/restore`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/context/{slug}/revisions/{revision}/restore`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Restores the document to the given revision by creating a new forward revision whose title and content match that snapshot. Prior revisions are retained. Unknown slugs or uncaptured revisions respond 404; a concurrent write responds 409 revision_conflict.

## Path parameters

- `slug` string, required
- `revision` integer, required

## Response `200`

The document at its new, restored revision.

- object
  - `slug` string, required
  - `title` string, required
  - `description` string, nullable, required: One-line purpose statement for selection without fetching.
  - `kind` 'instructions' | 'knowledge' | 'record', required
  - `tags` string[], required
  - `revision` integer, required
  - `contentSize` integer, required: Raw markdown size in bytes.
  - `folderId` string, nullable, required: Folder placement; null at the organization root.
  - `path` string, nullable, required: Human-readable folder path; null at the organization root.
  - `updatedAt` string, required
  - `staffOnly` boolean, required: Visible only to the operator's team. The organization's own members and keys never see it.
  - `content` string, required: The canonical raw markdown.
  - `properties` object, required: Structured facts beside the markdown: any JSON object.
  - `links` object[], required: Projects and resources this document links to.
    - `type` 'project' | 'deployment' | 'pipeline' | 'postgres' | 'redis' | 'turso' | 'r2', required: The kind of project or resource the document links to.
    - `id` string, required: The linked project or resource id.
    - `name` string, required: The target's current name, or "Deleted" when it no longer exists.
    - `removed` boolean, required: True when the target was deleted. Replace or remove the link.
  - `createdAt` string, required
  - `createdByType` 'agent' | 'api' | 'user', required
  - `updatedByType` 'agent' | 'api' | 'user', required

## Other responses

- `401`: Authentication is missing or invalid.
- `404`: The resource was not found.
- `409`: Response.
- `429`: Too many requests; retry after the indicated delay.

---

[API](https://skmtc.dev/khotan/apis/khotan-api.md) - [All operations](https://skmtc.dev/khotan/apis/khotan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/khotan/apis/khotan-api/revisions/90b512a53e42?raw)
