https://app.firma.dev/templateEditor/{template_id}
Embed via iframe
A minimal iframe embed looks like this:Recommended integration points
- Pass the current user’s workspace or auth token so the editor loads the correct templates.
- Listen for postMessage events from the editor to react to saves, publish, or close events.
Recommended integration (secure, production-ready)
Use a small server-side endpoint to request an embedded JWT token from the Firma API and return a short-lived embed URL to your frontend. The OpenAPI for this repo exposes:- POST /templates/template_id/embed-token — returns token, expires_at, embed_url
- Use your server API key (never expose it to the browser).
- Request an embed token scoped to the template and an expiry (short-lived, e.g. 1 hour).
- Return only the embed_url (or token) to the authenticated frontend user.
Server example — Node (Express, server-side)
Server example — Python (Flask, server-side)
Client usage (browser)
Call your server endpoint to get theembed_url
and render an iframe. The embed_url
returned by the API is safe to place into an iframe because the token is short-lived and signed.
postMessage events (editor → host)
Firma’s editor will emit postMessage events for important lifecycle actions. Below is a recommended, minimal event schema you can implement for reacting to editor saves and publishes. If you have a canonical schema in your platform, replace these with your official event names. Event envelope (window.postMessage payload):Client listener example (plain JS)
Sending messages to the iframe (host → editor)
If the editor supports initialization via postMessage (common for embedded apps), you can send a small init message after the iframe loads with a short-lived token. Example:Security considerations
- Never expose your main API key in the browser. Use a server endpoint to mint embed tokens (see server examples)