Serifmark Sign in ·

REST & MCP reference

Both entry points talk to the same engine with the same credentials and the same error codes. The base URL is https://serifmark.com.

Getting started · REST & MCP reference · Front-matter reference · Error codes

Authentication

Every API call carries an API key in the Authorization header. Keys are created under Console → API keys; the plaintext is shown exactly once at creation, and revocation takes effect immediately.

Authorization: Bearer smk_YOUR_KEY

The key's account must have a verified email — otherwise calls return 403 forbidden with reason: email_unverified. Missing, invalid or revoked keys return 401 unauthorized.

POST /render

Render one Markdown Source into one PDF Document. This is the billing unit: a successful Render consumes one Credit. A failed Render costs nothing.

FieldTypeRequiredDescription
sourcestringyes The Markdown Source to render. A YAML Front-matter block at the top may declare the Template and brand options — see the Front-matter reference.
source_typestringno Must be markdown or omitted; any other value is rejected with invalid_source (v1 renders Markdown only).
templatestringno Template by name: a built-in (default, report, resume) or one of your private Templates. Precedence: this parameter over the Front-matter template declaration over default. Unresolved names return template_not_found.
optionsobjectno Reserved extension slot; ignored in v1.
curl -X POST https://serifmark.com/render \
  -H "Authorization: Bearer smk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"source": "# Hello Serifmark\n\nMath and diagrams render server-side.", "template": "default"}'

A successful Render returns 200 with:

FieldTypeDescription
download_urlstring Signed URL for the PDF. Valid until expires_at — 10 minutes by default — after which the Document is deleted from the server. Fetch it promptly.
expires_atstring RFC 3339 timestamp of the link's expiry.
pagesnumberPage count of the rendered Document.
size_bytesnumberPDF size in bytes.
credits_remainingnumber Your Credit balance across all buckets after this Render.
{
  "download_url": "https://serifmark.com/download/…?exp=…&sig=…",
  "expires_at": "2026-10-23T12:10:00Z",
  "pages": 1,
  "size_bytes": 84213,
  "credits_remaining": 19
}

An expired link returns 410 gone; a tampered signature returns 403 forbidden. In both cases the fix is the same: Render again.

GET /credits

Returns the current Credit balance — the same numbers the Console account bar shows. It reads the three buckets (free monthly, subscription monthly, packs), aligns the free bucket to the current month, and never consumes anything. Authenticate with the session token from POST /login (API keys don't serve this route).

FieldTypeDescription
credits_remainingnumberTotal across all buckets.
bucketsobject Per-bucket remaining Credits: free, subscription, pack.
daily_remainingnumber · null Renders left today under the free tier's daily cap; null when no daily cap applies (an active subscription or a pack balance).
daily_limitnumber · null The daily cap in effect (5 on the free tier); null when uncapped.

Guardrails

MCP endpoint

Serifmark is also a remote MCP server (zero install): endpoint https://serifmark.com/mcp, same API key as REST. Your agent gets one tool, render_pdf, whose arguments mirror the REST fields — source (required, Front-matter inline) and template (optional). Success and error payloads match the REST shapes above; errors arrive as tool results carrying the same code and message.

{
  "mcpServers": {
    "serifmark": {
      "url": "https://serifmark.com/mcp",
      "headers": { "Authorization": "Bearer YOUR_KEY" }
    }
  }
}

Registration name serifmark-render. Tool errors and HTTP errors share the same code table — an agent that handles insufficient_credits over REST needs no new logic over MCP.