POST/v1/documents/:id/publish

Publish 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

ParameterTypeRequiredDescription
idstringYesThe document UUID

Request Body

All fields are optional.

ParameterTypeRequiredDefaultDescription
slugstringauto-generatedCustom URL slug. Pro only.
descriptionstringDescription for SEO metadata
hide_badgebooleanfalseHide 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.

FieldTypeDescription
idstringDocument UUID
titlestringDocument title
published_urlstringFull public URL
published_atstringISO 8601 timestamp
template_idstringTemplate applied to the published page
word_countnumberTotal word count
reading_time_minutesnumberEstimated reading time

Errors

StatusCodeDescription
400validation_errorInvalid slug format
401unauthorizedMissing or invalid API key
403forbiddenFeature requires Pro (custom slug, hide badge, public visibility)
404not_foundDocument not found
409conflictSlug is already taken
500internal_errorUnexpected 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"}'