# Installations and delegated permissions

> One identifier per server of your software, permissions granted one by one, and sessions for your users without a Mizanpage account.

For a partner serving many organisations, managing one key per customer becomes heavy. **Installations** and **delegated permissions** make this simpler.

## Installations

Each server of your software can be an installation. It has its own `mzi_…` identifier. You assign it the organisations it serves and the permissions it can exercise. A new installation can do nothing until you have granted it something.

It then calls for one organisation at a time, named by your reference:

```http
POST /v1/render
Authorization: Bearer mzi_…
X-Mizanpage-Organisation: org-42
```

An organisation that has not been assigned to it answers `403 organisation_forbidden`, exactly like an organisation that does not exist. The identifier can be renewed without interruption: create a new one, then revoke the old one.

Installations are managed in **Partner › Installations** or through `/v1/partner/installations`.

## Permissions

| Permission | What it opens |
| --- | --- |
| `templates:read` | Open the editor, see templates, preview (free) |
| `documents:generate` | Produce a final PDF (counted) |
| `templates:write` | Create, edit and publish templates, customise a standard, manage files, fonts and brand identities |
| `templates:configure` | Choose the default template and the adopted version of a standard |

Your software decides which permission matches which role on your side. Mizanpage does not know your role names. Keys, users, the subscription and catalogs are never delegated.

## Delegated sessions

Your server sends one of its users into the editor, without a Mizanpage account:

```http
POST /v1/editor-sessions
Authorization: Bearer mzi_…
Content-Type: application/json

{
  "organisation": "org-42",
  "user": { "id": "u-1287", "name": "Mary Smith" },
  "permissions": ["templates:read", "templates:write", "documents:generate"],
  "origin": "https://app.your-software.example",
  "ttl": 900
}
```

The session is short: 15 minutes by default, one hour at most. An installation never delegates more than you have given it (`403 permission_not_allowed`).

## Renew without reloading

Two minutes before the end, the editor sends `mizanpage:session-expiring` to your page. Your page asks your server for a new token. The server checks the person's rights again, then passes it on:

```js
if (message.type === 'mizanpage:session-expiring' && message.session === session) {
  const { token } = await fetch('/mizanpage/session', { method: 'POST' }).then((r) => r.json())
  if (token) send({ type: 'mizanpage:session', token })
}
```

A right withdrawn on your side no longer yields a token. The session stops at its set time.

## Stop sessions

`POST /v1/editor-sessions/revoke` with `{"organisation": "org-42", "user": "u-1287"}` stops a person's sessions. Without `user`, all those of the organisation.

---

Documentation Mizanpage · Developers › Embedding the editor
https://mizanpage.com/en/docs/integration/installations-permissions/
