---
title: "Restore a file version"
description: "Makes an earlier version current again, at the same link."
canonical_url: https://docs.markdrop.in/api/files/restore-a-file-version
last_updated: 2026-10-30
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Restore a file version

`POST https://api.markdrop.in/api/v1/files/{slug}/versions/{version}/restore`

Makes an earlier version current again, at the same link. Versions start at 1.

- **Authentication:** API token required: `Authorization: Bearer mdk_…`.
- **Rate limit:** 30 per minute per IP address.
- **CLI:** `markdrop restore k3x9q2m 1`
- **MCP tool:** `restore_file_version` ([tools](https://docs.markdrop.in/ai/tools))
- **Guide:** [Replace and versions](https://docs.markdrop.in/files/replace-and-versions)

## Path parameters

- `slug` (string, required): The document's address: the part after `markdrop.in/`.
- `version` (integer, required)

## Responses

- `200`: OK.
  - `slug` (string)
  - `url` (string)
  - `markdrop_url` (string | null)
  - `workspace_url` (string | null)
  - `title` (string | null): Shown on the page and in link previews.
  - `content_type` (string)
  - `size_bytes` (integer)
  - `sha256` (string | null)
  - `version` (integer)
  - `updated_at` (string (date-time)): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `created_at` (string (date-time)): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `media` (object | null)
    - `duration_s` (number | null)
    - `width` (integer | null)
    - `height` (integer | null)
    - `video_codec` (string | null)
    - `audio_codec` (string | null)
  - `poster_url` (string | null)
  - `download_url` (string | null)
  - `access` (string)
- `401`: No token, or the token is revoked or mistyped.
- `422`: The request didn't validate. `detail` lists each problem, with where it is (`loc`) and why (`msg`).
- `429`: Too many requests from your IP address. Wait the seconds in `Retry-After`.

## Examples

**curl**

```bash
curl -X POST https://api.markdrop.in/api/v1/files/k3x9q2m/versions/1/restore \
  -H "Authorization: Bearer $MARKDROP_TOKEN"
```

**JavaScript**

```javascript
const res = await fetch("https://api.markdrop.in/api/v1/files/k3x9q2m/versions/1/restore", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
  },
});
const data = await res.json();
```

**Python**

```python
import os

import requests

r = requests.post(
    "https://api.markdrop.in/api/v1/files/k3x9q2m/versions/1/restore",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
)
r.raise_for_status()
print(r.json())
```

**CLI**

```bash
markdrop restore k3x9q2m 1
```
