REST API

REST API v1 Reference

Complete endpoint contracts for template CRUD, headless multi-format PDF/PNG/JPEG/SVG rendering, and AI reconstruction.

Authentication & Rate Limits

Pass your organization API key via Authorization: Bearer ol_live_... or X-Api-Key headers. Subscription status and monthly export quotas are checked on each render call.

  • 401 Unauthorized — Missing, revoked, or invalid API key.
  • 403 Forbidden — Subscription is canceled/cancelled or inactive.
  • 429 Too Many Requests — Monthly export cap exceeded (when overage consent is disabled).

Render Template — POST /api/v1/templates/:id/render

Compiles a stored template merged with your JSON payload in volatile memory via our Rust + Typst microservice. Supports format values: "pdf" (application/pdf), "png" (image/png), "jpeg" (image/jpeg), "svg" (image/svg+xml), and "svg_pages" (application/json).

request-response-headers.json
// Request Body
{
  "format": "pdf",
  "data": { "customer": { "name": "Acme Corp" }, "items": [] }
}

// Response Headers Returned
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="render-<id>.pdf"
X-Render-Time-Ms: 14
X-Total-Time-Ms: 39

Template CRUD — /api/v1/templates

Manage template JSON schemas programmatically alongside visual editing.

  • GET /api/v1/templates — List active templates scoped to the API key organization.
  • POST /api/v1/templates — Create a new template enforcing organization plan limits.
  • GET /api/v1/templates/:id — Fetch canvas_data JSON definition.
  • PUT /api/v1/templates/:id — Update template name or canvas_data.
  • DELETE /api/v1/templates/:id — Soft-delete template (sets deleted_at).

AI Reconstruction — POST /api/v1/ai/reconstruct

Upload base64 PNG, JPEG, or PDF layouts (up to 25MB) to convert existing static documents into editable @open-layout/canvas-schema JSON using Gemini without disk persistence.