Editor sessions
Request a session for a user, open the editor in an iframe or a tab, choose its role, close it.
Your server never gives its key to the browser. It requests a time-limited session for the user, then passes the link it receives to your page.
1. Check rights on your side
Mizanpage trusts your server. Before opening the editor:
- authenticate the user in your software;
- check that they belong to the organisation whose key you are about to use;
- choose their Mizanpage role based on their rights in your software.
| Role | What it allows |
|---|---|
operator |
Fill in, preview, generate the document (final PDF counted) |
designer |
In addition: create and edit templates, brand identities, images, fonts |
A session is never admin. Requesting admin gives designer.
2. Request the session
POST /v1/editor-sessions
Authorization: Bearer mzp_<organisation key>
Content-Type: application/json
{
"user": { "id": "u-1287", "name": "Mary Smith" },
"role": "operator",
"template": "tpl-order-form",
"ttl": 3600,
"language": "en",
"origin": "https://app.your-software.example"
}
{ "id": "Q2x1c3Rlci1zZXNzaW9uLTE", "token": "mzs_…", "role": "operator", "url": "https://app.mizanpage.com/#/edit/…?session=mzs_…&lang=en", "expires_at": "2026-10-20T16:02:00+02:00" }
| Parameter | Role |
|---|---|
user.id, user.name |
Your stable identifier for the person, and their display name |
role |
operator or designer |
template or kind |
Optional. Without them, the person lands on their templates |
ttl |
Duration in seconds, from 60 to 28,800 (8 hours) |
language |
fr, nl, de or en |
origin |
The exact origin of the page that will open the editor. Required for an iframe |
appearance |
The look of the editor: see Appearance |
Keep id on the server side to close the session. Never log url or token.
3. Open the editor
In an iframe:
<iframe id="mizanpage" title="Document editor" src=""></iframe>
<script>
document.getElementById('mizanpage').src = urlFromYourServer
</script>
In a new tab, in response to a click:
const editor = window.open(urlFromYourServer, '_blank')
Do not use noopener: the editor needs window.opener to talk to your page.
4. Close the session
A session ends when it expires, or when you ask:
DELETE /v1/editor-sessions/{id}
Authorization: Bearer mzp_…
Do so when the user logs out, loses their rights or closes the editor. DELETE /v1/editor-sessions closes all the organisation's sessions.
Editor events
The editor notifies your page through postMessage: draft saved, version published, PDF generated, close requested, session expired. See Data bridge.