---
title: "Upload a page image"
description: "Uploads a PNG, JPEG, GIF or WebP image of up to 10 MB to a page, as multipart/form-data."
canonical_url: https://docs.markdrop.in/api/pages/upload-a-page-image
last_updated: 2026-11-04
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Upload a page image

`POST https://api.markdrop.in/api/v1/documents/{slug}/assets`

Uploads a PNG, JPEG, GIF or WebP image of up to 10 MB to a page, as `multipart/form-data`. Use the `id` it returns in the page as `![alt](asset:<id>)`. The image shows to exactly the page's readers.

- **Authentication:** Token optional: send `Authorization: Bearer mdk_…` to act as your account, or the document's edit secret in `X-Edit-Secret`.
- **Rate limit:** 60 per minute per IP address.
- **MCP tool:** `upload_page_image` ([tools](https://docs.markdrop.in/ai/tools))
- **Guide:** [Images in pages](https://docs.markdrop.in/pages/images)

## 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

`multipart/form-data`, required.

- `file` (file, required)

## Responses

- `201`: Created.
- `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/assets \
  -H "Authorization: Bearer $MARKDROP_TOKEN" \
  -F 'file=@logo.png'
```

**JavaScript**

```javascript
import { readFile } from "node:fs/promises";

const form = new FormData();
form.append("file", new Blob([await readFile("logo.png")]), "logo.png");

const res = await fetch("https://api.markdrop.in/api/v1/documents/k3x9q2m/assets", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
  },
  body: form,
});
const data = await res.json();
```

**Python**

```python
import os

import requests

r = requests.post(
    "https://api.markdrop.in/api/v1/documents/k3x9q2m/assets",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
    files={"file": open("logo.png", "rb")},
)
r.raise_for_status()
print(r.json())
```
