---
title: "Save as a template"
description: "Saves a copy of a page, with its images, as a template: the workspace's (members and up) or your own (scope: \"personal\")."
canonical_url: https://docs.markdrop.in/api/templates/save-as-a-template
last_updated: 2026-11-04
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Save as a template

`POST https://api.markdrop.in/api/v1/documents/{slug}/save-as-template`

Saves a copy of a page, with its images, as a template: the workspace's (members and up) or your own (`scope: "personal"`). `include_subpages` copies the sub-pages you can open too.

- **Authentication:** API token required: `Authorization: Bearer mdk_…`.
- **Rate limit:** 10 per minute per IP address.
- **MCP tool:** `save_page_as_template` ([tools](https://docs.markdrop.in/ai/tools))
- **Guide:** [Templates](https://docs.markdrop.in/pages/templates)

## Path parameters

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

## Headers

- `X-Edit-Secret` (string): The document's edit secret (`sk_…`), for a document published without an account. See [Edit key](https://docs.markdrop.in/documents/edit-key).

## Request body

`application/json`, required.

- `name` (string): The template's name. Defaults to the page's title. Up to 200 characters.
- `description` (string): Up to 600 characters.
- `icon` (string): Up to 32 characters.
- `include_subpages` (boolean): Copy the sub-pages you can open too. Default `false`.
- `scope` ("workspace" | "personal"): `workspace` (the default for a page in a workspace) or `personal`.
- `workspace` (string): Save it to this workspace instead of the page's own (members and up). 1–64 characters.

## Responses

- `201`: Created.
- `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/documents/k3x9q2m/save-as-template \
  -H "Authorization: Bearer $MARKDROP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Weekly sync","scope":"workspace"}'
```

**JavaScript**

```javascript
const res = await fetch("https://api.markdrop.in/api/v1/documents/k3x9q2m/save-as-template", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "Weekly sync",
    "scope": "workspace"
  }),
});
const data = await res.json();
```

**Python**

```python
import os

import requests

r = requests.post(
    "https://api.markdrop.in/api/v1/documents/k3x9q2m/save-as-template",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
    json={"name": "Weekly sync", "scope": "workspace"},
)
r.raise_for_status()
print(r.json())
```
