API Documentation

Integrate markdown publishing into your applications

Overview
The Markdown Publisher API allows you to programmatically create and share markdown documents

Base URL

https://mdpub-ui-5edusjj7.manus.space/api/trpc

Authentication

No authentication required. The API is publicly accessible.

Create Document
POST /api/trpc/document.create

Request Body

titlestring (required, max 500 chars)
contentstring (required, markdown format)

Response

{
  "result": {
    "data": {
      "shareId": "abc123xyz456"
    }
  }
}

Use the shareId to construct URLs:
Share URL (for social media): https://mdpub-ui-5edusjj7.manus.space/api/preview/{shareId}
Direct URL (for browsers): https://mdpub-ui-5edusjj7.manus.space/d/{shareId}

Preview Endpoint
GET /api/preview/{shareId}

Returns an HTML page with Open Graph meta tags for social media sharing. When shared on WhatsApp, Twitter, Slack, etc., this URL displays a rich preview with the document title, description, and preview image.

Behavior

  • Returns HTML with og:title, og:description, og:image tags
  • Automatically redirects to /d/{shareId} for viewing
  • Use this URL when sharing on social media
OG Image Endpoint
GET /api/og-image/{shareId}

Generates a dynamic preview image (1200x630px PNG) for the document, showing the title and content excerpt. Used automatically by social media platforms when the preview URL is shared.

Response

Content-Type: image/png

Returns a 1200x630 PNG image

cURL Example
Command line usage
curl -X POST https://mdpub-ui-5edusjj7.manus.space/api/trpc/document.create \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My Document Title",
    "content": "# Hello World\n\nThis is **markdown** content."
  }'
Python Example
Using the requests library
import requests

url = "https://mdpub-ui-5edusjj7.manus.space/api/trpc/document.create"
payload = {
    "title": "My Document Title",
    "content": "# Hello World\n\nThis is **markdown** content."
}

response = requests.post(url, json=payload)
data = response.json()

share_id = data["result"]["data"]["shareId"]
# Use preview URL for social media sharing (proper OG tags)
share_url = f"https://mdpub-ui-5edusjj7.manus.space/api/preview/{share_id}"
# Direct URL (for browsers)
direct_url = f"https://mdpub-ui-5edusjj7.manus.space/d/{share_id}"
print(f"Share URL: {share_url}")
JavaScript Example
Using the Fetch API
const response = await fetch("https://mdpub-ui-5edusjj7.manus.space/api/trpc/document.create", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    title: "My Document Title",
    content: "# Hello World\n\nThis is **markdown** content.",
  }),
});

const data = await response.json();
const shareId = data.result.data.shareId;
// Use preview URL for social media sharing (proper OG tags)
const shareUrl = `https://mdpub-ui-5edusjj7.manus.space/api/preview/${shareId}`;
// Direct URL (for browsers)
const directUrl = `https://mdpub-ui-5edusjj7.manus.space/d/${shareId}`;
console.log("Share URL:", shareUrl);
Error Handling
Common error scenarios
400 Bad Request

Missing or invalid title/content fields

500 Internal Server Error

Server-side error during document creation

Rate Limits
Usage guidelines

Currently, there are no enforced rate limits. However, please use the API responsibly and avoid excessive requests that could impact service availability.