POST
/v1/documents/:id/publishPublish Document
Publish an existing document to a public URL.
Publish an existing document, making it accessible via a public URL. If the document is already published, this endpoint updates the published version with the latest content and settings.
The published URL follows the pattern https://unmarkdown.com/u/{username}/{slug} when the user has a username set, or https://unmarkdown.com/d/{slug} otherwise.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The document UUID |
Request Body
All fields are optional.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
slug | string | auto-generated | Custom URL slug. Pro only. | |
description | string | Description for SEO metadata | ||
hide_badge | boolean | false | Hide the Unmarkdown™ badge. Pro only. | |
visibility | "link" | "public" | "link" | Access level. "public" is Pro only. | |
page_width | "standard" | "wide" | "full" | "standard" | Content width on the published page |
Response
Returns the published document with its public URL.
| Field | Type | Description |
|---|---|---|
id | string | Document UUID |
title | string | Document title |
published_url | string | Full public URL |
published_at | string | ISO 8601 timestamp |
template_id | string | Template applied to the published page |
word_count | number | Total word count |
reading_time_minutes | number | Estimated reading time |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Invalid slug format |
| 401 | unauthorized | Missing or invalid API key |
| 403 | forbidden | Feature requires Pro (custom slug, hide badge, public visibility) |
| 404 | not_found | Document not found |
| 409 | conflict | Slug is already taken |
| 500 | internal_error | Unexpected server error |
curl -X POST https://api.unmarkdown.com/v1/documents/doc_abc123/publish \
-H "Authorization: Bearer um_your_key" \
-H "Content-Type: application/json" \
-d '{
"visibility": "link",
"page_width": "standard"
}'
const res = await fetch(
'https://api.unmarkdown.com/v1/documents/doc_abc123/publish',
{
method: 'POST',
headers: {
'Authorization': 'Bearer um_your_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
visibility: 'link',
page_width: 'standard'
})
}
);
const data = await res.json();
console.log(data.published_url);
import requests
res = requests.post(
'https://api.unmarkdown.com/v1/documents/doc_abc123/publish',
headers={'Authorization': 'Bearer um_your_key'},
json={
'visibility': 'link',
'page_width': 'standard'
}
)
data = res.json()
print(data['published_url'])
Response
{
"id": "doc_abc123",
"title": "Quarterly Report",
"published_url": "https://unmarkdown.com/u/jane/quarterly-report",
"published_at": "2026-02-15T10:30:00.000Z",
"template_id": "executive",
"word_count": 1250,
"reading_time_minutes": 7
}
Pro-only: custom slug
curl -X POST https://api.unmarkdown.com/v1/documents/doc_abc123/publish \
-H "Authorization: Bearer um_your_key" \
-H "Content-Type: application/json" \
-d '{"slug": "q1-2026-report", "visibility": "public"}'