MDER.PRO

Examples

Complete document payloads you can copy, adapt, and send to the API. Each example demonstrates multiple block types working together.

Quick Start — Content Shorthand

The simplest way to publish a document — just send a content string. MDER wraps it in a single markdown block automatically.

terminalbash
curl -X POST https://api.mder.pro/v1/documents \
  -H "Authorization: Bearer mder_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Quick Note",
    "content": "# Hello from MDER\n\nThis document was created with a single API call.\n\n- No blocks required\n- Just plain markdown\n- Published instantly"
  }'

Python — Sales Report

A multi-block sales report with callout, table, and markdown:

Sales Report — April 2026

Trending Up

Revenue is up 12% month-over-month.

Revenue by Region

RegionRevenueGrowth
North America$1.2M+15%
Europe$820k+8%
Asia Pacific$540k+18%

Next Steps

  • Expand APAC sales team
  • Launch EU marketing campaign
  • Review Q2 targets
See live example

TypeScript / Node.js

mder-client.tstypescript
const API_KEY = process.env.MDER_API_KEY!;
const API_URL = "https://api.mder.pro";

interface MderResponse {
  document_id: string;
  viewer_url: string;
  status: string;
}

async function publishDocument(
  title: string,
  content: string,
  ttlHours?: number
): Promise<MderResponse> {
  const res = await fetch(`${API_URL}/v1/documents`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      title,
      content,
      access_policy: {
        mode: "unlisted",
        ...(ttlHours ? { ttl_hours: ttlHours } : {}),
      },
    }),
  });

  if (!res.ok) {
    const err = await res.json();
    throw new Error(`MDER error: ${err.error?.message}`);
  }

  return res.json();
}

// Usage
const doc = await publishDocument(
  "Daily Standup Notes",
  "# Standup — April 20\n\n**Done**: Deployed v2.1\n**Next**: MCP integration\n**Blockers**: None",
  168 // 7 days
);

console.log(doc.viewer_url);

Technical Report — Multi-Block

A complete technical document using heading, callout, markdown, table, code, and list blocks:

Infrastructure Migration Report

Migration Complete

Migration completed on schedule with zero downtime. All 47 services running on GCP.

This report covers the infrastructure migration executed between January 15 and March 28, 2026.


Key Metrics

Performance Comparison

MetricBefore (AWS)After (GCP)Change
P99 Latency245ms180ms-26%
Monthly Cost$34,200$28,100-18%
Deploy Time12 min4 min-67%
Uptime99.95%99.99%+0.04%

Terraform Config

infra/main.tf
resource "google_cloud_run_v2_service" "api" {
  name     = "mder-api"
  location = "us-central1"

  template {
    containers {
      image = "gcr.io/mder-prod/api:latest"
    }
  }
}

⚠️ Lesson Learned

DNS propagation took 4 hours longer than expected. Reduce TTL to 60s at least 48 hours before cutover.

  • Migrate all 47 services
  • Update DNS records
  • Decommission AWS
  • Complete cost analysis
  • Archive CloudWatch logs
See live example

Meeting Notes

Date: April 20, 2026 Attendees: Alice, Bob, Carol Duration: 30 minutes


Agenda

  1. Sprint review
  2. Deployment status
  3. Open questions

Decisions

  1. Ship block types on Monday
  2. Delay PDF export to v2.2
  3. Increase rate limit for Pro tier

Action Items

  • Alice: Write migration guide
  • Bob: Deploy cache layer
  • Carol: Load test with 10k viewers

ℹ️ Schedule Change

Next sync moved to Wednesday due to all-hands.

See live example

Dashboard Summary

A data-heavy document an agent might generate from monitoring data:

Status: Healthy

All systems operational. No incidents in the last 24 hours.

Last 24 Hours

MetricValue
API Requests847,293
Documents Created1,847
Avg Response Time42ms
Error Rate0.02%
P99 Latency185ms

Top Errors

ErrorCountNotes
429 Too Many Requests142Rate limiting working as expected
400 Validation Error87Mostly missing title field
404 Not Found34Expired document access attempts
See live example

MCP Agent Workflow

How an AI agent uses MDER tools in a typical conversation:

agent conversationtext
Human: "Summarize today's sales data and send me a report"

Agent: Let me generate that report for you.

→ Tool: create_document
  title: "Sales Summary — April 20, 2026"
  blocks: [
    { id: "h1", type: "heading", content: "Sales Summary", props: { level: 1 } },
    { id: "kpi", type: "callout", content: "**$127k** in revenue today (+8% vs yesterday)", 
      props: { type: "success", title: "Daily Revenue" } },
    { id: "breakdown", type: "table", 
      content: "Product | Units | Revenue\nPro Plan | 24 | $96k\nFree→Pro | 8 | $31k",
      props: { striped: true } },
    { id: "notes", type: "markdown", 
      content: "## Highlights\n- Record day for Pro conversions\n- APAC growing fastest" }
  ]
  status: "published"
  ttl_hours: 168
  idempotency_key: "sales-summary-2026-04-20"

← Result: { viewer_url: "https://mder.pro/d/xY7mK2" }

Agent: Here's your sales report: https://mder.pro/d/xY7mK2
       Revenue is up 8% — $127k today with record Pro conversions.

Draft → Edit → Publish Workflow

Create a draft, make changes, then publish when ready:

terminalbash
# Step 1: Create as draft
curl -X POST https://api.mder.pro/v1/documents \
  -H "Authorization: Bearer mder_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Draft Report",
    "content": "# Work in Progress\n\nInitial content...",
    "status": "draft"
  }'
# → { "document_id": "doc_abc123", "status": "draft" }

# Step 2: Update the draft
curl -X PATCH https://api.mder.pro/v1/documents/doc_abc123 \
  -H "Authorization: Bearer mder_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Final Report",
    "content": "# Final Report\n\nAll data verified and ready."
  }'

# Step 3: Publish
curl -X POST https://api.mder.pro/v1/documents/doc_abc123/publish \
  -H "Authorization: Bearer mder_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "access_policy": { "mode": "unlisted", "ttl_hours": 720 }
  }'
# → { "viewer_url": "https://mder.pro/d/ab12cd", "status": "published" }

Idempotent Creation

Use an Idempotency-Key header to safely retry failed requests:

terminalbash
# First call creates the document
curl -X POST https://api.mder.pro/v1/documents \
  -H "Authorization: Bearer mder_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: daily-report-2026-04-20" \
  -d '{ "title": "Daily Report", "content": "# April 20\n\nAll systems nominal." }'
# → 201 Created

# Retry (same idempotency key) returns existing document
curl -X POST https://api.mder.pro/v1/documents \
  -H "Authorization: Bearer mder_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: daily-report-2026-04-20" \
  -d '{ "title": "Daily Report", "content": "# April 20\n\nAll systems nominal." }'
# → 200 OK (same document_id, no duplicate created)

💡 Best practice for agents

Always include an Idempotency-Key derived from the task context (e.g. daily-report-<date>). This makes your agent retry-safe.

Explore More