---
title: "Get a single upload URL"
description: "The one-request upload markdrop.in uses for smaller files: returns a presigned URL to PUT the whole file to, then publish it."
canonical_url: https://docs.markdrop.in/api/files/get-a-single-upload-url
last_updated: 2026-10-30
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Get a single upload URL

`POST https://api.markdrop.in/api/v1/artifacts/upload-url`

The one-request upload markdrop.in uses for smaller files: returns a presigned URL to `PUT` the whole file to, then [publish it](https://docs.markdrop.in/api/files/publish-an-uploaded-file). For anything large, or to resume, use [Start a file upload](https://docs.markdrop.in/api/files/start-a-file-upload).

- **Authentication:** API token required: `Authorization: Bearer mdk_…`.
- **Rate limit:** 20 per minute per IP address.

## Request body

`application/json`, required.

- `filename` (string, required): 1–255 characters.
- `content_type` (string, required): Up to 255 characters.
- `size_bytes` (integer, required): At least 1.
- `target_slug` (string): Matches `^[A-Za-z0-9_-]{1,64}$`.

## Responses

- `200`: OK.
  - `upload_url` (string)
  - `blob_key` (string)
  - `mime` (string)
  - `required_content_type` (string)
  - `expires_in` (integer): When the document is deleted. `custom` needs `custom_expires_at`.
- `401`: No token, or the token is revoked or mistyped.
- `413`: The file is over the size limit for its type.
- `415`: That file type isn't supported.
- `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/artifacts/upload-url \
  -H "Authorization: Bearer $MARKDROP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
       "filename": "deck.pdf",
       "content_type": "application/pdf",
       "size_bytes": 1048576
     }'
```

**JavaScript**

```javascript
const res = await fetch("https://api.markdrop.in/api/v1/artifacts/upload-url", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "filename": "deck.pdf",
    "content_type": "application/pdf",
    "size_bytes": 1048576
  }),
});
const data = await res.json();
```

**Python**

```python
import os

import requests

r = requests.post(
    "https://api.markdrop.in/api/v1/artifacts/upload-url",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
    json={
        "filename": "deck.pdf",
        "content_type": "application/pdf",
        "size_bytes": 1048576,
    },
)
r.raise_for_status()
print(r.json())
```
