@x12i/mdreports-api
v0.4.0
Published
HTTP API server for Markdown Reports Studio — render Markdown and manage templates over REST.
Maintainers
Readme
@x12i/mdreports-api
HTTP API for Markdown Reports Studio. Wraps @x12i/mdreports-core with REST endpoints for rendering and
template management.
Install & run
npm install -g @x12i/mdreports-api
npx playwright install chromium # once, for PDF export
mdreports-apiOr without a global install:
npx @x12i/mdreports-apiListens on 0.0.0.0:${port} where port comes from @x12i/ports-manager zone
markdown-reports-studio (default 6460).
Environment variables
| Variable | Purpose |
| --- | --- |
| MDREPORTS_API_PORT / PORT | Override API listen port (must be even, in 6460–6479) |
| MDREPORTS_API_KEY | If set, require Authorization: Bearer <key> on all routes except /health |
| MDREPORTS_TEMPLATES_DIR | Override user templates directory |
| ANTHROPIC_API_KEY | Optional default for create-from-image flows |
Endpoints
| Method | Path | Description |
| --- | --- | --- |
| GET | /health | Liveness check |
| GET | /templates | List templates |
| GET | /templates/:id | Get template |
| POST | /templates/from-html | Create template from HTML + CSS JSON body |
| POST | /templates/from-image | Create template from image (multipart) |
| PATCH | /templates/:id | Update user template |
| DELETE | /templates/:id | Delete user template |
| POST | /render/html | Render Markdown → HTML JSON |
| POST | /render/pdf | Render Markdown → PDF bytes |
| POST | /render/docx | Render Markdown → DOCX bytes |
| POST | /render/pptx | Render Markdown → PPTX bytes (landscape 16:9) |
Render body
{
"markdown": "# Title\n\nBody",
"templateId": "clean-report",
"options": {
"frontmatterOverrides": { "title": "Override" },
"pdf": { "format": "A4" }
}
}Client
Use @x12i/mdreports-api-client for a typed fetch wrapper.
