Integrations

Language Integrations, Webhooks & MCP Server

Copy-paste SDK snippets for Node.js, Python, Go, Rust, n8n/Zapier automation, and Model Context Protocol (MCP) AI agents.

Node.js / TypeScript (Native fetch)

Use built-in fetch (Node 18+) without needing heavy SDK wrappers.

renderPdf.ts
const res = await fetch(`${process.env.OPENLAYOUT_URL}/api/v1/templates/${templateId}/render`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.OPENLAYOUT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ format: 'pdf', data: payload }),
});

if (!res.ok) throw new Error(await res.text());
const pdfBuffer = Buffer.from(await res.arrayBuffer());

Python (httpx / requests)

Integrate Open Layout into FastAPI, Django, or Celery worker pipelines.

render_pdf.py
import os, requests

resp = requests.post(
    f"{os.environ['OPENLAYOUT_URL']}/api/v1/templates/{template_id}/render",
    headers={"Authorization": f"Bearer {os.environ['OPENLAYOUT_API_KEY']}"},
    json={"format": "pdf", "data": payload},
    timeout=15,
)
resp.raise_for_status()
with open("output.pdf", "wb") as f:
    f.write(resp.content)

Model Context Protocol (MCP) Server for AI Agents

Open Layout ships with packages/mcp-server/index.mjs so Claude Desktop, Cursor, or Antigravity can list templates, inspect schemas, and trigger renders directly.

mcp-config.json
{
  "mcpServers": {
    "open-layout": {
      "command": "node",
      "args": ["packages/mcp-server/index.mjs"],
      "env": {
        "OPENLAYOUT_API_URL": "https://openlayout.dev",
        "OPENLAYOUT_API_KEY": "ol_live_your_key"
      }
    }
  }
}