MDER.PRO

REST API Reference

Base URL: https://api.mder.pro. All requests must include an Authorization: Bearer <token> header (see Authentication). Responses are JSON with Content-Type: application/json.

ℹ️ Versioning

All endpoints are prefixed with /v1. Future breaking changes will increment the version number.

Endpoints Overview

Documents

POST/v1/documents

Create a new document. Use content for a simple single-block markdown document, or blocks for full control over block types.

ParameterTypeRequiredDescription
titlestringRequiredDocument title (max 500 chars)
contentstringOptionalShorthand: markdown content (auto-wrapped in a single markdown block)
blocksBlock[]OptionalArray of typed blocks (see Block Types). Required if content is not set.
document_typestringOptional ("document")Type label for categorization
summarystringOptionalBrief summary (max 2000 chars)
statusstringOptional ("published")"published" or "draft"
access_policyobjectOptionalAccess control settings (see below)
render_optionsobjectOptionalRender profile, theme, and ToC settings
metadataobjectOptionalArbitrary key-value metadata

access_policy

ParameterTypeRequiredDescription
modestringOptional ("unlisted")"unlisted", "public", "password_protected", or "signed_link"
ttl_hoursnumberOptionalAuto-expire after N hours (e.g. 168 = 7 days)
passwordstringOptionalPassword for password_protected mode (min 4 chars)
allowed_viewsnumberOptionalMax number of views before auto-revocation

render_options

ParameterTypeRequiredDescription
render_profilestringOptional ("default")"default", "memo", "report", or "technical_doc"
table_of_contentsbooleanOptional (false)Generate a table of contents
themestringOptional ("auto")"light", "dark", or "auto"

Idempotency

Include an Idempotency-Key header to prevent duplicate documents from agent retries. If a document with the same key already exists, the existing document is returned with a 200 status.

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

Response

201 Createdjson
{
  "document_id": "doc_8f2d4a...",
  "status": "published",
  "current_revision": 1,
  "viewer_url": "https://mder.pro/d/ab12cd",
  "short_url": "https://mder.pro/d/ab12cd",
  "resource_uri": "mder://documents/doc_8f2d4a...",
  "access_mode": "unlisted",
  "expires_at": null,
  "request_id": "req_..."
}
GET/v1/documents
ParameterTypeRequiredDescription
statusstringOptionalFilter by status: draft, published, expired, revoked, archived
pagenumberOptional (1)Page number
page_sizenumberOptional (20)Items per page (1-100)
terminalbash
curl "https://api.mder.pro/v1/documents?status=published&page=1" \
  -H "Authorization: Bearer mder_YOUR_KEY"
GET/v1/documents/:id

Returns full document metadata including blocks, access policy, and revision info.

terminalbash
curl https://api.mder.pro/v1/documents/doc_8f2d4a \
  -H "Authorization: Bearer mder_YOUR_KEY"
PATCH/v1/documents/:id

Update a document in draft status. Supports the same content shorthand as creation.

ParameterTypeRequiredDescription
titlestringOptionalNew title
contentstringOptionalNew content (shorthand)
blocksBlock[]OptionalNew blocks array
summarystringOptionalNew summary
access_policyobjectOptionalUpdated access policy
render_optionsobjectOptionalUpdated render options
metadataobjectOptionalUpdated metadata
POST/v1/documents/:id/publish

Transitions a draft document to published status, making it accessible via its viewer URL.

ParameterTypeRequiredDescription
access_policyobjectOptionalOverride access policy at publish time
POST/v1/documents/:id/revoke

Immediately revokes access. The viewer URL will show a "document unavailable" message. Revoked documents can be renewed.

POST/v1/documents/:id/renew

Extend or restart the TTL on a published or expired document.

ParameterTypeRequiredDescription
ttl_hoursnumberOptional (168 (7 days))New TTL in hours

API Keys

GET/v1/api-keys

Returns all API keys for the current workspace (keys are masked, showing only the prefix).

POST/v1/api-keys
ParameterTypeRequiredDescription
namestringRequiredKey name (max 100 chars)
scopesstring[]Optional (["documents:write", "documents:read"])Permission scopes
expires_in_daysnumberOptionalExpiration in days (1-365)
DELETE/v1/api-keys/:apiKeyId

Immediately revokes the API key. All requests using this key will return 401.

Usage & Limits

GET/v1/usage

Returns usage metrics for the current billing period including document count, view count, and active document count versus plan limits.

Health Check

GET/health

Returns 200 with service status. No authentication required.

200 OKjson
{
  "status": "ok",
  "version": "1.0.0"
}

Error Format

All errors follow a consistent structure with a machine-readable code and human-readable message:

error responsejson
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "title is required"
  },
  "request_id": "req_abc123"
}
CodeStatusDescription
VALIDATION_ERROR400Request body failed schema validation
UNAUTHORIZED401Missing or invalid authentication
FORBIDDEN403Insufficient permissions or scope
NOT_FOUND404Resource does not exist
PLAN_LIMIT_REACHED403Plan limit exceeded (upgrade required)
DOCUMENT_TOO_LARGE400Content exceeds size limit
INVALID_STATE409Document is not in the required state for this action

Rate Limits

Free tier: 60 requests per minute. Pro tier: 1,000 requests per minute. Rate limit headers are included in every response:

response headerstext
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1713600000

Plan Limits

LimitFreePro
Documents / month25Unlimited
Active documents10Unlimited
Views / month1,000Unlimited
Max document size512 KB10 MB
Max TTL720 hours (30 days)Unlimited
API keys220
PDF exports / month10Unlimited
Access modesUnlisted onlyAll 4 modes
Render profilesDefault onlyAll profiles