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.
| Field | Type | Required | Description |
|---|---|---|---|
source | string | yes | 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_type | string | no | Must be markdown or omitted; any other value is rejected with
invalid_source (v1 renders Markdown only). |
template | string | no | 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. |
options | object | no | 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:
| Field | Type | Description |
|---|---|---|
download_url | string | 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_at | string | RFC 3339 timestamp of the link's expiry. |
pages | number | Page count of the rendered Document. |
size_bytes | number | PDF size in bytes. |
credits_remaining | number | 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).
| Field | Type | Description |
|---|---|---|
credits_remaining | number | Total across all buckets. |
buckets | object | Per-bucket remaining Credits: free, subscription, pack. |
daily_remaining | number · 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_limit | number · null | The daily cap in effect (5 on the free tier); null when uncapped. |
Guardrails
- Markdown Source up to 1 MB (
source_too_largebeyond). - Up to 50 pages per Document (
page_limit_exceededbeyond). - 60-second timeout per Render (
render_timeoutbeyond). - Free Tier: 5 renders per day (
rate_limitedbeyond); subscriptions and pack balances have no daily cap. - Failed Renders never consume a Credit — the charge is refunded.
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.