POST/v1/documents/publish

Create and Publish

Create a document and publish it in a single API call. This is the most commonly used endpoint.

Create a new document and publish it in a single API call. This is the most commonly used endpoint for programmatic publishing. It combines Create Document and Publish Document into one step.

The document is saved to your account and immediately accessible at the returned published_url.

Request Body

ParameterTypeRequiredDefaultDescription
contentstringYesThe markdown content to publish
titlestring"Untitled"Document title
template_idstring"swiss"Template ID from the template catalog
theme_mode"light" | "dark""light"Color theme
slugstringauto-generatedCustom URL slug. Pro only.
descriptionstringDescription for SEO metadata

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_errorMissing content field, invalid template, or invalid slug format
401unauthorizedMissing or invalid API key
403forbiddenCustom slugs require Pro
403quota_exceededFree tier limited to 3 documents
409conflictSlug is already taken
500internal_errorUnexpected server error

NOTE

Free tier accounts are limited to 3 documents total. Once the limit is reached, you will receive a 403 error. Upgrade to Pro for unlimited documents.

curl -X POST https://api.unmarkdown.com/v1/documents/publish \
  -H "Authorization: Bearer um_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "# Hello World\n\nThis is my first published document.",
    "title": "Hello World",
    "template_id": "swiss"
  }'
const res = await fetch('https://api.unmarkdown.com/v1/documents/publish', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer um_your_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    content: '# Hello World\n\nThis is my first published document.',
    title: 'Hello World',
    template_id: 'swiss'
  })
});
const data = await res.json();
console.log(data.published_url);
import requests

res = requests.post(
    'https://api.unmarkdown.com/v1/documents/publish',
    headers={'Authorization': 'Bearer um_your_key'},
    json={
        'content': '# Hello World\n\nThis is my first published document.',
        'title': 'Hello World',
        'template_id': 'swiss'
    }
)
data = res.json()
print(data['published_url'])

Response (201)

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "title": "Hello World",
  "published_url": "https://unmarkdown.com/u/jane/hello-world",
  "published_at": "2026-02-15T10:30:00.000Z",
  "template_id": "swiss",
  "word_count": 8,
  "reading_time_minutes": 1
}

With dark theme and custom template

curl -X POST https://api.unmarkdown.com/v1/documents/publish \
  -H "Authorization: Bearer um_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "# Release Notes\n\n## v2.1.0\n\n- Added dark mode\n- Fixed pagination bug",
    "title": "Release Notes",
    "template_id": "tokyo-night",
    "theme_mode": "dark"
  }'