{"openapi":"3.1.0","info":{"title":"API Mizanpage","version":"v1","description":"Votre logiciel décrit ses champs une fois, vos utilisateurs dessinent leurs\nmodèles dans l'éditeur Mizanpage ouvert depuis votre application, et chaque\nappel à `POST /v1/render` renvoie le PDF dans la réponse.\n\nMizanpage ne conserve ni le document généré ni les données qu'il\ncontenait. Votre logiciel garde le fichier reçu. Ce qui reste chez\nMizanpage, c'est une ligne de consommation par document (modèle, version,\nclé, date), sans son contenu.\n\n## Démarrer\n\n1. Créez une clé dans votre espace (**Brancher mon logiciel**, puis\n   **Clés API**). Une clé de test (`mzp_test_…`) produit des PDF\n   filigranés et non comptés.\n2. Envoyez le catalogue de vos champs : `PUT /v1/catalogs/{kind}`.\n3. Ouvrez l'éditeur pour un utilisateur : `POST /v1/editor-sessions`, puis\n   mettez l'`url` reçue dans une iframe ou un onglet.\n4. Générez : `POST /v1/render` avec `\"format\": \"pdf\"`.\n\nTous les corps sont en JSON, toutes les dates en ISO 8601. Un corps pèse\nau plus 20 Mo.\n\n## Authentification\n\nToute route `/v1` attend un jeton dans l'en-tête\n`Authorization: Bearer …`, reconnu à son préfixe :\n\n| Préfixe | Qui | Durée |\n| --- | --- | --- |\n| `mzp_` | Votre serveur. Un secret : jamais dans un navigateur. | Jusqu'à révocation |\n| `mzs_` | Une personne dans l'éditeur intégré, obtenu par `POST /v1/editor-sessions`. | 60 s à 8 h |\n| `mzi_` | Une installation d'un partenaire (un de ses serveurs), pour une organisation à la fois. | Jusqu'à révocation |\n\nUne installation nomme l'organisation pour laquelle elle appelle dans\nl'en-tête `X-Mizanpage-Organisation`. Un jeton ne passe jamais par une\nadresse (`?token=` n'est pas lu).\n\nSeuls `/v1/public/…` et `/v1/auth/…` se passent de jeton.\n\n## Erreurs\n\nToujours la même forme. Testez `code`, affichez `message` : il suit\n`Accept-Language` (fr, en, nl, de ; anglais par défaut) et peut être\nmontré tel quel à vos utilisateurs.\n\n```json\n{ \"error\": { \"code\": \"missing_fields\", \"message\": \"Champs obligatoires sans valeur : Total.\", \"details\": { \"fields\": [\"commande.total\"] } } }\n```\n\n| Statut | Codes fréquents |\n| --- | --- |\n| 400 | `invalid_body` : le corps n'est pas un objet JSON lisible. |\n| 401 | `unauthenticated` : jeton absent, inconnu, révoqué ou expiré. |\n| 402 | `card_required`, `trial_over`, `subscription_required`, `template_limit`, `ai_quota`, `api_not_included`, `embedded_editor_not_included`, `white_label_not_included` : l'offre de l'espace ne permet pas l'appel. Rien n'est perdu. |\n| 403 | `forbidden`, `role_required`, `permission_required`, `api_key_required`, `origin_not_declared`, `organisation_forbidden`, `preview_only`. |\n| 404 | `not_found` : absent, ou pas à vous (même réponse). |\n| 409 | `not_published`, `template_archived`, `no_template`, `ambiguous_template`, `template_required`, `invalid_assignment`, `organisation_inactive`, `catalog_incompatible`, `webhook_limit`, `conflict`. |\n| 410 | Route retirée (`documents_retired`, `print_retired`, `format_retired`). |\n| 413 | `payload_too_large` : corps de plus de 20 Mo. |\n| 422 | `invalid` (`details.field` nomme le champ, jamais sa valeur), `missing_fields`, `invalid_design`, `organisation_required`, `idempotency_key_reused`. |\n| 429 | `rate_limited` : limite de débit atteinte. Attendez `Retry-After` secondes. |\n| 500 | `internal_error` : une erreur de notre côté, enregistrée chez nous. Réessayez plus tard. |\n| 503 | `renderer_unavailable`, `renderer_busy` : réessayez après `Retry-After` secondes. |\n\nChaque route liste ses propres codes, avec un exemple de réponse pour\nchacun. Un `429` et un `503` portent l'en-tête `Retry-After` : le nombre\nde secondes à attendre. Une erreur ne compte jamais de document.\n\n## Limites de débit\n\nComptées en fenêtre glissante ; au-delà, `429 rate_limited` avant tout\ntravail, avec l'en-tête `Retry-After` : le nombre de secondes avant\nqu'un appel passe à nouveau.\n\n| Limite | Maximum | Compté par |\n| --- | --- | --- |\n| Rendu | 120 PDF par minute | espace |\n| Clé de test | 200 PDF par heure | espace |\n| Essai gratuit | 100 PDF par jour | espace |\n| Installation d'un partenaire | 600 générations et sessions par minute | installation |\n| Organisation d'un partenaire | 120 générations et sessions par minute | organisation |\n\nLes limites des partenaires sont des valeurs initiales, réglables à la\ndemande.\n\n## Webhooks\n\nDéclarez une adresse https (`POST /v1/webhooks`) : Mizanpage y envoie un\n`POST` JSON quand un modèle est publié, archivé ou remis en service, et\nquand un document est généré. Le message ne contient jamais le document\nni ses valeurs. Les événements sont décrits dans la section\n**Webhooks** de cette référence.\n\nChaque envoi est signé selon [Standard Webhooks](https://www.standardwebhooks.com) :\n`webhook-id`, `webhook-timestamp` et `webhook-signature: v1,<signature>`,\noù la signature est le HMAC-SHA256, en base64, de\n`{webhook-id}.{webhook-timestamp}.{corps}` avec le secret de l'adresse\n(`whsec_…`, décodé du base64). Refusez un horodatage de plus de\n5 minutes. Répondez `2xx` en moins de 5 secondes ; sinon, l'envoi est\nretenté 7 fois en 27 heures environ (1 min, 5 min, 30 min, 2 h, 5 h,\n10 h, 10 h), avec le même `webhook-id`.\n","contact":{"name":"Mizanpage","email":"contact@mizanpage.com","url":"https://mizanpage.com"}},"servers":[{"url":"https://api.mizanpage.com"}],"security":[{"jeton":[]}],"tags":[{"name":"Rendu","description":"Produire un PDF à partir d'un modèle publié et de vos données."},{"name":"Outils PDF","description":"Convertir une page HTML en PDF, fusionner et découper des PDF. Rien n'est conservé."},{"name":"Catalogues","description":"Un catalogue par sorte de document (`kind`) : les champs que votre\nlogiciel peut fournir, rangés par groupe. L'éditeur les montre à vos\nutilisateurs ; ils ne tapent jamais une clé à la main.\n"},{"name":"Modèles","description":"Les modèles que vos utilisateurs dessinent. Les documents impriment\ntoujours la dernière version **publiée** ; un brouillon n'imprime jamais.\n`{ref}` est l'id Mizanpage ou votre `external_id`.\n"},{"name":"Choix du modèle","description":"Votre logiciel peut ne connaître que le type du document. Ces routes\ndisent quel modèle un appel par `kind` imprimera, et règlent le modèle\npar défaut et le mode de sélection de chaque type.\n"},{"name":"Sessions d'éditeur","description":"Ouvrir l'éditeur pour une personne de votre logiciel, sans compte\nMizanpage, et fermer ses sessions. Le jeton `mzs_` voyage dans la partie\n`#…` de l'`url`, que le navigateur n'envoie à aucun serveur.\n"},{"name":"Partenaires","description":"Pour un éditeur de logiciel qui apporte ses clients : une organisation\npar client, créée par votre propre référence, des installations (un\nidentifiant par serveur) et la politique de vos modèles standards.\nClé de l'espace partenaire ; jamais une session d'éditeur.\n"},{"name":"Webhooks","description":"Les adresses de votre logiciel prévenues de ce qui se passe dans\nl'espace. Clé de l'espace ou membre admin ; jamais une session\nd'éditeur. Les adresses d'un partenaire reçoivent aussi les\névénements des organisations qu'il a ouvertes.\n"},{"name":"Documents conservés","description":"Les documents gardés dans « Mes documents » : par défaut ceux faits dans\nl'application, et ceux de l'API seulement si un administrateur l'a\nactivé. Le PDF et les données sont chiffrés, hébergés en Suisse, et\nsupprimés après la durée de conservation de l'espace (1 an par\ndéfaut). Clé de l'espace ou membre ; jamais une session d'éditeur\nouverte par un logiciel, ni un accès délégué.\n"},{"name":"Standards","description":"Côté organisation : les modèles qu'un partenaire propose à ses clients,\npartagés sans copie, avec leurs versions.\n"},{"name":"Assistants IA (MCP)","description":"Brancher Claude, ChatGPT, Cursor ou tout client MCP sur l'espace :\nl'assistant liste les modèles publiés, lit leurs champs et génère le\nPDF. L'IA est celle du client ; Mizanpage n'appelle aucun modèle ici.\n"},{"name":"Système","description":"Vérifier une clé, l'état du service et cette référence."}],"paths":{"/v1/render":{"post":{"tags":["Rendu"],"operationId":"render","summary":"Générer un document","description":"Envoie le modèle et les données, reçoit le PDF dans la réponse. Par\ndéfaut, rien n'est conservé ; si l'espace garde aussi les documents de\nl'API (réglage d'un administrateur dans l'application), le PDF et les\ndonnées sont gardés, chiffrés, voir **Documents conservés**. Avec une clé, écrivez toujours `\"format\": \"pdf\"` :\n`html` et `pages` sont réservés à l'aperçu de l'éditeur\n(`403 preview_only`).\n\nÀ la place de `template`, envoyez `kind` seul : Mizanpage choisit le\nmodèle selon les règles de l'espace (modèle par défaut, standard du\npartenaire, modèle unique), voir **Choix du modèle**. La réponse dit\nlequel a servi dans `X-Mizanpage-Template`.\n\nUn PDF réussi est un document compté, sauf avec une clé de test. Un\nappel qui échoue n'est jamais compté. Avec `Idempotency-Key`, un\nsecond appel avec la même clé et les mêmes paramètres, depuis le même\nespace et dans les 24 heures, retombe sur la même ligne de\nconsommation : le PDF est rendu à nouveau, rien n'est compté deux\nfois. La même clé avec d'autres paramètres est refusée avant le rendu\n(`422 idempotency_key_reused`). Après 24 heures, la clé est libre.\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Organisation"},{"$ref":"#/components/parameters/AcceptLanguage"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderRequest"},"examples":{"parModele":{"summary":"Par modèle","value":{"template":"bon-commande-vehicule","format":"pdf","data":{"values":{"client.nom":"Jean Dupont","commande.total":"45 000,00 EUR","lignes":[{"designation":"Peinture métallisée","quantite":"1","total":"890,00 EUR"}]}}}},"parType":{"summary":"Par type, sans choisir le modèle","value":{"kind":"invoice","format":"pdf","strict":true,"data":{"values":{"invoice.number":"F-2026-001","invoice.total":"1 500,00 EUR"}}}}}}}},"responses":{"200":{"description":"Le PDF.","headers":{"X-Mizanpage-Generation":{"description":"L'identifiant de la ligne de consommation (absent pour une clé de test).","schema":{"type":"string"}},"X-Mizanpage-Template":{"description":"Le modèle et la version imprimés, `<id>;version=<n>`.","schema":{"type":"string"}},"X-Mizanpage-Test":{"description":"`1` pour un PDF de clé de test, filigrané et non compté.","schema":{"type":"string"}},"X-Mizanpage-Document":{"description":"L'identifiant du document conservé, quand l'espace garde les documents de l'API.","schema":{"type":"string"}},"X-Mizanpage-Facturx":{"description":"`EN 16931` quand le PDF est une facture Factur-X (PDF/A-3 avec `factur-x.xml`).","schema":{"type":"string"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/pdf/html":{"post":{"tags":["Outils PDF"],"operationId":"htmlToPdf","summary":"Convertir une page HTML en PDF","description":"Envoie une page HTML complète et reçoit son PDF dans la réponse, sans\nmodèle. Rien n'est conservé : ni la page ni le PDF.\n\nLa page doit contenir tout ce qu'elle affiche (CSS dans la page, images\net polices en `data:`), car le moteur de rendu n'ouvre aucune adresse\nexterne : une image distante n'apparaît pas.\n\nChaque conversion compte comme un PDF généré (forfait, dépassement,\n`X-Mizanpage-Generation`, `Idempotency-Key` comme pour `/v1/render`).\nUne clé de test produit un PDF gratuit marqué du logo Mizanpage ;\npendant l'essai gratuit, le PDF est compté et marqué. Dans ces deux\ncas, les scripts de la page ne s'exécutent pas.\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Organisation"},{"$ref":"#/components/parameters/AcceptLanguage"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["html"],"properties":{"html":{"type":"string","description":"La page HTML complète, 10 Mo au plus."},"paper":{"description":"`A3`, `A4` (par défaut), `A5`, `Letter`, `Legal`, ou une taille en millimètres.","oneOf":[{"type":"string","enum":["A3","A4","A5","Letter","Legal"]},{"type":"object","required":["width","height"],"properties":{"width":{"type":"number","minimum":20,"maximum":1000},"height":{"type":"number","minimum":20,"maximum":1000}}}]},"landscape":{"type":"boolean","default":false,"description":"Le papier tourné à l'horizontale."},"margins":{"description":"Les marges en millimètres (10 par défaut), un nombre pour les quatre côtés ou un objet par côté.","oneOf":[{"type":"number","minimum":0,"maximum":100},{"type":"object","properties":{"top":{"type":"number","minimum":0,"maximum":100},"right":{"type":"number","minimum":0,"maximum":100},"bottom":{"type":"number","minimum":0,"maximum":100},"left":{"type":"number","minimum":0,"maximum":100}}}]},"css_page_size":{"type":"boolean","default":false,"description":"La taille de la règle `@page` de la page l'emporte sur `paper`."},"print_background":{"type":"boolean","default":true,"description":"Les couleurs et images de fond sont imprimées."}}},"example":{"html":"<!doctype html><html><head><meta charset=\"utf-8\"><style>body{font-family:sans-serif}</style></head><body><h1>Bon de livraison 2026-118</h1><p>Livré le 27 novembre 2026.</p></body></html>","paper":"A4","margins":15}}}},"responses":{"200":{"description":"Le PDF.","headers":{"X-Mizanpage-Generation":{"description":"L'identifiant de la ligne de consommation (absent pour une clé de test).","schema":{"type":"string"}},"X-Mizanpage-Test":{"description":"`1` pour un PDF de clé de test, marqué et non compté.","schema":{"type":"string"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/pdf/merge":{"post":{"tags":["Outils PDF"],"operationId":"mergePdfs","summary":"Fusionner des PDF","description":"Assemble 2 à 20 PDF en un seul, dans l'ordre envoyé. Les fichiers\nvoyagent en base64 dans le corps (20 Mo au plus) et ne sont pas\nconservés. Gratuit, 300 appels par heure et par espace avec la\ndécoupe. Un fichier illisible ou protégé par mot de passe est refusé\n(`422 invalid_pdf`, `details.field` le nomme).\n","parameters":[{"$ref":"#/components/parameters/Organisation"},{"$ref":"#/components/parameters/AcceptLanguage"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["pdfs"],"properties":{"pdfs":{"type":"array","minItems":2,"maxItems":20,"items":{"type":"string","description":"Un PDF en base64 (ou en adresse `data:`)."}}}},"example":{"pdfs":["JVBERi0xLjcK…","JVBERi0xLjQK…"]}}}},"responses":{"200":{"description":"Le PDF fusionné.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/pdf/split":{"post":{"tags":["Outils PDF"],"operationId":"splitPdf","summary":"Découper un PDF","description":"Extrait des pages d'un PDF envoyé en base64. Envoyez une seule de ces\noptions :\n\n- `pages` : un PDF avec ces pages, dans cet ordre (`\"1-3,5,8-\"`) ;\n- `ranges` : un ZIP avec un PDF par plage (`[\"1-2\", \"3-\"]`, 50 au plus) ;\n- `every` : un ZIP avec un PDF toutes les N pages.\n\nLa première page est la page 1 ; une plage ouverte (`8-`) va jusqu'à\nla dernière. Rien n'est conservé. Gratuit, 300 appels par heure et par\nespace avec la fusion.\n","parameters":[{"$ref":"#/components/parameters/Organisation"},{"$ref":"#/components/parameters/AcceptLanguage"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["pdf"],"properties":{"pdf":{"type":"string","description":"Le PDF en base64 (ou en adresse `data:`)."},"pages":{"type":"string","example":"1-3,5"},"ranges":{"type":"array","maxItems":50,"items":{"type":"string"}},"every":{"type":"integer","minimum":1}}},"examples":{"pages":{"summary":"Quelques pages en un PDF","value":{"pdf":"JVBERi0xLjcK…","pages":"1-3,5"}},"every":{"summary":"Une page par PDF, dans un ZIP","value":{"pdf":"JVBERi0xLjcK…","every":1}}}}}},"responses":{"200":{"description":"Le PDF (`pages`) ou un ZIP de PDF nommés `part-01.pdf`, `part-02.pdf`… (`ranges`, `every`).","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}},"application/zip":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/mcp":{"post":{"tags":["Assistants IA (MCP)"],"operationId":"mcp","summary":"Serveur MCP","description":"Serveur [Model Context Protocol](https://modelcontextprotocol.io),\ntransport « Streamable HTTP », sans session : un message JSON-RPC 2.0\npar requête, réponse en `application/json`. Une notification reçoit\n`202`. `GET` répond `405` (pas de flux du serveur).\n\nConnexion avec une clé de l'espace dans `Authorization: Bearer`\n(ou l'identifiant d'une installation avec `X-Mizanpage-Organisation`).\nUne session d'éditeur ou de compte est refusée (`403 api_key_required`).\n\nLes applications qui se connectent en un clic (claude.ai, ChatGPT)\npassent par OAuth 2.1 : le `401` porte `WWW-Authenticate` vers\n`/.well-known/oauth-protected-resource/v1/mcp`, puis\n`/.well-known/oauth-authorization-server`, `POST /oauth/register`\n(client public), `GET /oauth/authorize` (PKCE `S256`, scope `mcp`,\naccord du membre sur Mizanpage) et `POST /oauth/token`. Le jeton\n`mzo_…` agit avec le rôle du membre, sur cette route seulement.\n\nTrois outils :\n\n| Outil | Ce qu'il fait | Appel de l'API |\n| --- | --- | --- |\n| `list_templates` | Les modèles publiés et en service (`kind` facultatif). | `GET /v1/templates` |\n| `get_template_fields` | Les champs que le modèle imprime, leur type, s'ils sont obligatoires, un exemple, les colonnes des listes. | `GET /v1/templates/{ref}`, `GET /v1/catalogs/{kind}` |\n| `generate_pdf` | Le PDF du modèle publié avec `values`, renvoyé en ressource `application/pdf` (base64). `strict` vrai par défaut. | `POST /v1/render` |\n\nChaque outil passe par les mêmes contrôles que l'appel direct :\noffre avec l'API, rôle, permissions d'un partenaire, essai, limites\nde débit. Un PDF généré compte comme un document (gratuit et\nfiligrané avec une clé de test), et rejoint « Mes documents » si\nl'espace garde les documents de l'API. Un refus de l'API revient en\nrésultat d'outil `isError: true`, avec la phrase et le code.\n","parameters":[{"$ref":"#/components/parameters/Organisation"},{"$ref":"#/components/parameters/AcceptLanguage"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","method"],"properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"type":["string","integer"]},"method":{"type":"string","enum":["initialize","ping","tools/list","tools/call","notifications/initialized"]},"params":{"type":"object"}}},"examples":{"generer":{"summary":"Générer un PDF","value":{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"generate_pdf","arguments":{"template":"facture-atelier","name":"Facture F-2026-014","values":{"client.nom":"Jean Dupont","facture.total":"189,00 EUR","lignes":[{"designation":"Vidange","total":"89,00 EUR"}]}}}}}}}}},"responses":{"200":{"description":"La réponse JSON-RPC (`result` ou `error`).","content":{"application/json":{"example":{"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"PDF généré : Facture F-2026-014 (1 page). Lien de téléchargement valable une heure."}],"isError":false}},"schema":{"type":"object"}}}},"202":{"description":"Notification reçue."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/renders":{"post":{"tags":["Rendu"],"operationId":"createRender","summary":"Demander un PDF (asynchrone)","description":"Le même document que `POST /v1/render`, sans attendre : la réponse\narrive tout de suite (`202`) et le PDF est fait dans les secondes qui\nsuivent. Pour les outils qui ne peuvent pas attendre la fin d'un\nrendu dans la même réponse (Zapier, Make, une file de votre logiciel).\n\nTout ce que `POST /v1/render` refuse est refusé ici, tout de suite\n(modèle non publié, champ obligatoire vide avec `strict`, limite de\nl'offre). Le document est compté de la même façon, une seule fois,\nquand il est fait.\n\nQuand le PDF est prêt, ou si le rendu échoue, Mizanpage prévient :\n- vos webhooks abonnés à `render.completed` ou `render.failed` ;\n- l'adresse `callback_url` de l'appel, s'il en donne une (même\n  contenu, non signé : un seul envoi, retenté 3 fois tout de suite).\n\nLe PDF reste téléchargeable **une heure**, avec la clé\n(`GET /v1/renders/{id}/pdf`) ou par le lien `download_url`, qui\nn'en demande pas. Puis il est supprimé. Les données envoyées sont\ngardées chiffrées le temps du rendu, puis effacées. Le suivi du rendu\n(statut, identifiants, erreur) reste lisible 24 heures.\n\nAvec `Idempotency-Key`, un second appel avec la même clé et les mêmes\nparamètres renvoie le rendu déjà demandé (`200`). 100 rendus au plus\nen attente par espace (`429 render_queue_full`). Pas pour une session\nd'éditeur (`403 render_async_editor`).\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Organisation"},{"$ref":"#/components/parameters/AcceptLanguage"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderJobRequest"},"example":{"template":"facture","reference":"Ligne 12","callback_url":"https://hooks.zapier.com/hooks/standard/1/abc","data":{"values":{"client.nom":"Jean Dupont","facture.total":"1 500,00 EUR"}}}}}},"responses":{"200":{"description":"Le rendu déjà demandé avec la même `Idempotency-Key`.","content":{"application/json":{"example":{"id":"0193a5c0-1b2c-7d3e-8f4a-5b6c7d8e9f0a","status":"succeeded","reference":"F-2026-0412","created_at":"2026-11-23T10:30:04+01:00","finished_at":"2026-11-23T10:30:04+01:00","template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","template_version":4,"generation_id":"0193a5c1-2d3e-7f40-8a51-6b7c8d9e0f1a","document_id":null,"test":false,"size":48213,"download_url":"https://api.mizanpage.com/v1/public/renders/…","expires_at":"2026-11-23T11:30:06+01:00","error":null},"schema":{"$ref":"#/components/schemas/RenderJob"}}}},"202":{"description":"Le rendu est en file d'attente.","headers":{"Location":{"description":"L'adresse du rendu, `/v1/renders/{id}`.","schema":{"type":"string"}}},"content":{"application/json":{"example":{"id":"0193a5c0-1b2c-7d3e-8f4a-5b6c7d8e9f0a","status":"queued","reference":"F-2026-0412","created_at":"2026-11-23T10:30:04+01:00","finished_at":null,"template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","template_version":4,"generation_id":null,"document_id":null,"test":false,"size":null,"download_url":null,"expires_at":null,"error":null},"schema":{"$ref":"#/components/schemas/RenderJob"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/renders/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Rendu"],"operationId":"getRender","summary":"Suivre un rendu asynchrone","description":"Le statut du rendu : `queued`, `processing`, `succeeded` ou `failed`.\nUne fois fait, `download_url` et `expires_at` ; en cas d'échec,\n`error`. Lisible 24 heures. Interrogez au plus toutes les 2 secondes,\nou mieux, attendez le webhook.\n","responses":{"200":{"description":"Le rendu.","content":{"application/json":{"example":{"id":"0193a5c0-1b2c-7d3e-8f4a-5b6c7d8e9f0a","status":"succeeded","reference":"F-2026-0412","created_at":"2026-11-23T10:30:04+01:00","finished_at":"2026-11-23T10:30:04+01:00","template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","template_version":4,"generation_id":"0193a5c1-2d3e-7f40-8a51-6b7c8d9e0f1a","document_id":null,"test":false,"size":48213,"download_url":"https://api.mizanpage.com/v1/public/renders/…","expires_at":"2026-11-23T11:30:06+01:00","error":null},"schema":{"$ref":"#/components/schemas/RenderJob"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/renders/{id}/pdf":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Rendu"],"operationId":"downloadRender","summary":"Télécharger le PDF d'un rendu","description":"Le PDF, avec la clé, pendant l'heure où il est gardé. Après : `410 render_expired`.","responses":{"200":{"description":"Le PDF.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"410":{"$ref":"#/components/responses/Gone"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/public/renders/{token}":{"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Rendu"],"operationId":"downloadRenderLink","summary":"Télécharger le PDF par son lien","description":"L'adresse de `download_url`. Sans clé : le lien lui-même, chiffré et\nsigné, sert d'accès. Il expire avec le PDF, une heure après le rendu.\nNe le publiez pas.\n","security":[],"responses":{"200":{"description":"Le PDF.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"410":{"$ref":"#/components/responses/Gone"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/catalogs":{"get":{"tags":["Catalogues"],"operationId":"listCatalogs","summary":"Lister les catalogues","responses":{"200":{"description":"Les catalogues de l'espace, et ceux qu'il suit chez son partenaire (`origin: partner`).","content":{"application/json":{"example":{"data":[{"kind":"invoice","origin":"organisation","editable":false,"label":"Facture","groups":[{"key":"client","label":"Client","fields":[{"key":"client.nom","label":"Nom du client","type":"text"},{"key":"client.adresse","label":"Adresse","type":"longtext"}]},{"key":"facture","label":"Facture","fields":[{"key":"facture.numero","label":"Numéro","type":"text"},{"key":"facture.date","label":"Date","type":"date"},{"key":"facture.total","label":"Total TTC","type":"amount"},{"key":"facture.lignes","label":"Lignes","type":"list","fields":[{"key":"designation","label":"Désignation","type":"text"},{"key":"montant","label":"Montant","type":"amount"}]}]}],"required":[{"key":"facture.total","reason":"Mention obligatoire"}],"requiredBlocks":[],"maxPhotos":0,"sample":{"client.nom":"Garage Solvérac","facture.numero":"F-2026-0412","facture.total":"1 250,00 €"},"updated_at":"2026-11-20T16:12:40+01:00"}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Catalog"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/catalogs/{kind}":{"parameters":[{"$ref":"#/components/parameters/Kind"}],"get":{"tags":["Catalogues"],"operationId":"getCatalog","summary":"Lire un catalogue","responses":{"200":{"description":"Le catalogue.","content":{"application/json":{"example":{"kind":"invoice","origin":"organisation","editable":false,"label":"Facture","groups":[{"key":"client","label":"Client","fields":[{"key":"client.nom","label":"Nom du client","type":"text"},{"key":"client.adresse","label":"Adresse","type":"longtext"}]},{"key":"facture","label":"Facture","fields":[{"key":"facture.numero","label":"Numéro","type":"text"},{"key":"facture.date","label":"Date","type":"date"},{"key":"facture.total","label":"Total TTC","type":"amount"},{"key":"facture.lignes","label":"Lignes","type":"list","fields":[{"key":"designation","label":"Désignation","type":"text"},{"key":"montant","label":"Montant","type":"amount"}]}]}],"required":[{"key":"facture.total","reason":"Mention obligatoire"}],"requiredBlocks":[],"maxPhotos":0,"sample":{"client.nom":"Garage Solvérac","facture.numero":"F-2026-0412","facture.total":"1 250,00 €"},"updated_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Catalog"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"put":{"tags":["Catalogues"],"operationId":"putCatalog","summary":"Envoyer un catalogue","description":"Crée ou remplace le catalogue d'une sorte de document. Envoyez-le au\ndémarrage, ou quand vos champs changent : l'éditeur montre les\nnouveaux champs aussitôt. Un catalogue renvoyé sans `sample` garde\nl'exemple qu'il avait.\n\nPour un partenaire, un catalogue qui casserait des modèles publiés\n(champ imprimé retiré ou changé de type) répond\n`409 catalog_incompatible` ; `?force=true` passe outre.\n","parameters":[{"name":"force","in":"query","required":false,"schema":{"type":"boolean"},"description":"Envoyer malgré `catalog_incompatible`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogInput"},"example":{"label":"Bon de commande","groups":[{"key":"customer","label":"Client","fields":[{"key":"customer.name","label":"Nom"},{"key":"customer.address","label":"Adresse","type":"longtext"}]},{"key":"order","label":"Commande","fields":[{"key":"order.reference","label":"Référence"},{"key":"order.total","label":"Total","type":"amount"},{"key":"lignes","label":"Lignes","type":"list","fields":[{"key":"designation","label":"Désignation"},{"key":"total","label":"Total","type":"amount"}]}]}],"required":[{"key":"order.total","reason":"Le total est une mention légale."}],"requiredBlocks":["signature"],"sample":{"customer.name":"Marie Dupont","order.total":"32 490,00 EUR"}}}}},"responses":{"200":{"description":"Le catalogue enregistré.","content":{"application/json":{"example":{"kind":"invoice","origin":"organisation","editable":false,"label":"Facture","groups":[{"key":"client","label":"Client","fields":[{"key":"client.nom","label":"Nom du client","type":"text"},{"key":"client.adresse","label":"Adresse","type":"longtext"}]},{"key":"facture","label":"Facture","fields":[{"key":"facture.numero","label":"Numéro","type":"text"},{"key":"facture.date","label":"Date","type":"date"},{"key":"facture.total","label":"Total TTC","type":"amount"},{"key":"facture.lignes","label":"Lignes","type":"list","fields":[{"key":"designation","label":"Désignation","type":"text"},{"key":"montant","label":"Montant","type":"amount"}]}]}],"required":[{"key":"facture.total","reason":"Mention obligatoire"}],"requiredBlocks":[],"maxPhotos":0,"sample":{"client.nom":"Garage Solvérac","facture.numero":"F-2026-0412","facture.total":"1 250,00 €"},"updated_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Catalog"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates":{"get":{"tags":["Modèles"],"operationId":"listTemplates","summary":"Lister les modèles","parameters":[{"name":"kind","in":"query","required":false,"schema":{"type":"string"},"description":"Seulement les modèles de cette sorte de document."}],"responses":{"200":{"description":"Les modèles, derniers modifiés d'abord.","content":{"application/json":{"example":{"data":[{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture-standard","name":"Facture standard","kind":"invoice","folder_id":null,"version":4,"published":true,"has_draft":false,"private":false,"updated_by":"Julie Martin","updated_at":"2026-11-23T10:30:04+01:00","published_by":"Julie Martin","published_at":"2026-11-23T10:30:04+01:00","offered_to_customers":false,"source_id":null,"archived":false,"archived_at":null,"source_version":null,"numbering":null,"uses":{"keys":["client.nom","facture.numero","facture.total","facture.lignes"],"logo":true,"photos":0,"attachments":0}},{"id":"0193a5b4-1c2d-7e3f-8a4b-6c7d8e9f0a1b","external_id":null,"name":"Facture avec acompte","kind":"invoice","folder_id":null,"version":1,"published":true,"has_draft":false,"private":false,"updated_by":"Julie Martin","updated_at":"2026-11-23T10:30:04+01:00","published_by":"Julie Martin","published_at":"2026-11-23T10:30:04+01:00","offered_to_customers":false,"source_id":null,"archived":false,"archived_at":null,"source_version":null,"numbering":null,"uses":{"keys":["client.nom","facture.total"],"logo":true,"photos":0,"attachments":0}}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"500":{"$ref":"#/components/responses/ServerError"}}},"post":{"tags":["Modèles"],"operationId":"createTemplate","summary":"Créer un modèle","description":"Crée un modèle vide pour une sorte de document, à ouvrir ensuite dans\nl'éditeur. `external_id` vous permet de le retrouver par votre propre\nidentifiant. Rôle `designer`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","maxLength":100},"name":{"type":"string"},"external_id":{"type":"string"},"folder_id":{"type":["string","null"]},"design":{"type":"object","description":"Un design complet ; l'éditeur l'écrit pour vous."},"publish":{"type":"boolean","description":"Publier aussitôt le design envoyé."}}},"example":{"kind":"sales.order_form","name":"Bon de commande showroom","external_id":"tpl-showroom"}}}},"responses":{"201":{"description":"Le modèle créé.","content":{"application/json":{"example":{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture-standard","name":"Facture standard","kind":"invoice","folder_id":null,"version":0,"published":false,"has_draft":true,"private":false,"updated_by":"Julie Martin","updated_at":"2026-11-23T10:30:04+01:00","published_by":null,"published_at":null,"offered_to_customers":false,"source_id":null,"archived":false,"archived_at":null,"source_version":null,"numbering":null,"uses":{"keys":["client.nom","facture.numero","facture.total","facture.lignes"],"logo":true,"photos":0,"attachments":0},"design":{"page":{"size":"A4"},"body":["…"]},"draft":null},"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{ref}":{"parameters":[{"$ref":"#/components/parameters/Ref"}],"get":{"tags":["Modèles"],"operationId":"getTemplate","summary":"Lire un modèle","description":"Le modèle, avec son design publié (`design`) et son brouillon (`draft`).","responses":{"200":{"description":"Le modèle.","content":{"application/json":{"example":{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture-standard","name":"Facture standard","kind":"invoice","folder_id":null,"version":4,"published":true,"has_draft":false,"private":false,"updated_by":"Julie Martin","updated_at":"2026-11-23T10:30:04+01:00","published_by":"Julie Martin","published_at":"2026-11-23T10:30:04+01:00","offered_to_customers":false,"source_id":null,"archived":false,"archived_at":null,"source_version":null,"numbering":null,"uses":{"keys":["client.nom","facture.numero","facture.total","facture.lignes"],"logo":true,"photos":0,"attachments":0},"design":{"page":{"size":"A4"},"body":["…"]},"draft":null},"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{ref}/fields":{"parameters":[{"$ref":"#/components/parameters/Ref"}],"get":{"tags":["Modèles"],"operationId":"listTemplateFields","summary":"Champs d'un modèle","description":"Les champs à envoyer pour ce modèle : ceux du catalogue que son design\npublié imprime, plus ceux que le catalogue rend obligatoires. Même\nforme que le catalogue. De quoi construire un formulaire sans\nafficher tous les champs du type de document.\n","responses":{"200":{"description":"Les champs du modèle.","content":{"application/json":{"example":{"template":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","kind":"invoice","version":4,"groups":[{"key":"client","label":"Client","fields":[{"key":"client.nom","label":"Nom du client","type":"text","required":false}]},{"key":"facture","label":"Facture","fields":[{"key":"facture.numero","label":"Numéro","type":"text","required":false},{"key":"facture.total","label":"Total TTC","type":"amount","required":true},{"key":"facture.lignes","label":"Lignes","type":"list","fields":[{"key":"designation","label":"Désignation","type":"text"},{"key":"montant","label":"Montant","type":"amount"}],"required":false}]}]},"schema":{"type":"object","required":["template","kind","version","groups"],"properties":{"template":{"type":"string"},"kind":{"type":"string"},"version":{"type":"integer"},"groups":{"type":"array","description":"Les groupes du catalogue qui ont au moins un champ du modèle.","items":{"type":"object","required":["key","label","fields"],"properties":{"key":{"type":"string"},"label":{"type":"string"},"fields":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/CatalogField"},{"type":"object","properties":{"required":{"type":"boolean","description":"Le catalogue exige une valeur."}}}]}}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{ref}/translations":{"parameters":[{"$ref":"#/components/parameters/Ref"}],"get":{"tags":["Modèles"],"operationId":"getTemplateTranslations","summary":"Textes et traductions d'un modèle","description":"Un modèle peut avoir plusieurs langues : une seule mise en page, ses\ntextes fixes traduits. `texts` donne chaque texte que le modèle\nimprime, par emplacement, dans sa langue principale ; `translations`\nses traductions ; `missing` ce qui reste à traduire par langue. Un\nemplacement `@clé` est le libellé d'un champ du catalogue, `@liste:colonne`\ncelui d'une colonne. Un modèle en une seule langue a `main: null`.\n\nPar défaut la version de travail (le brouillon, sinon la version\npubliée) ; `?version=published` lit la version publiée.\n","parameters":[{"name":"version","in":"query","required":false,"schema":{"type":"string","enum":["working","published"]}}],"responses":{"200":{"description":"Les textes et les traductions.","content":{"application/json":{"example":{"template":{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","name":"Facture","kind":"invoice","version":4},"main":"fr","languages":["fr","nl"],"texts":{"title.text":"Facture {{facture.numero}}","@facture.total":"Total TTC","thanks.text":"Merci pour votre confiance."},"translations":{"nl":{"title.text":"Factuur {{facture.numero}}","@facture.total":"Totaal incl. btw"}},"missing":{"nl":["thanks.text"]}},"schema":{"$ref":"#/components/schemas/TemplateTranslations"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"put":{"tags":["Modèles"],"operationId":"updateTemplateTranslations","summary":"Enregistrer des traductions","description":"Fusionne les traductions envoyées dans le brouillon du modèle : un\ntexte vide ou `null` retire une traduction. `languages` sert seulement\nà ajouter ou retirer une langue, la langue principale en premier ; une\nseule langue (ou `[]`) remet le modèle en une seule langue et efface\nses traductions. Chaque `{{champ}}` doit exister dans le catalogue.\n\nComme toute modification du brouillon, les documents utilisent les\ntraductions après la publication suivante (`POST /v1/templates/{ref}/publish`\nou « Publier » dans l'éditeur). Rôle designer requis.\n","requestBody":{"required":true,"content":{"application/json":{"example":{"languages":["fr","nl"],"translations":{"nl":{"title.text":"Factuur {{facture.numero}}","thanks.text":"Bedankt voor uw vertrouwen."}}},"schema":{"type":"object","properties":{"languages":{"type":"array","items":{"type":"string","enum":["fr","en","nl","de"]},"description":"Les langues du modèle, la principale en premier."},"translations":{"type":"object","description":"Par langue, puis par emplacement.","additionalProperties":{"type":"object","additionalProperties":{"type":["string","null"]}}}}}}}},"responses":{"200":{"description":"Les textes et les traductions du brouillon, comme `GET`.","content":{"application/json":{"example":{"template":{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","name":"Facture","kind":"invoice","version":4},"main":"fr","languages":["fr","nl"],"texts":{"title.text":"Facture {{facture.numero}}","thanks.text":"Merci pour votre confiance."},"translations":{"nl":{"title.text":"Factuur {{facture.numero}}","thanks.text":"Bedankt voor uw vertrouwen."}},"missing":{"nl":[]}},"schema":{"$ref":"#/components/schemas/TemplateTranslations"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{ref}/versions":{"parameters":[{"$ref":"#/components/parameters/Ref"}],"get":{"tags":["Modèles"],"operationId":"listTemplateVersions","summary":"Historique des versions d'un modèle","description":"Les versions publiées et conservées, la plus récente d'abord ; la\nversion en ligne porte `current: true`. Un modèle publié avant la\nconservation des versions n'a que sa version en ligne.\n","responses":{"200":{"description":"Les versions.","content":{"application/json":{"example":{"data":[{"version":4,"published_at":"2026-11-23T10:30:04+01:00","published_by":"Julie Martin","current":true},{"version":3,"published_at":"2026-11-20T16:12:40+01:00","published_by":"Julie Martin","current":false}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TemplateVersion"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{ref}/versions/{version}":{"parameters":[{"$ref":"#/components/parameters/Ref"},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"get":{"tags":["Modèles"],"operationId":"getTemplateVersion","summary":"Lire une version publiée","description":"Une version et son design tel qu'il a été publié. Pour la restaurer,\nl'éditeur la remet dans le brouillon (`PUT /v1/templates/{ref}/draft`),\npuis elle se publie comme toute autre modification.\n","responses":{"200":{"description":"La version, avec `design`.","content":{"application/json":{"example":{"version":3,"published_at":"2026-11-20T16:12:40+01:00","published_by":"Julie Martin","current":false,"design":{"page":{"size":"A4"},"body":["…"]}},"schema":{"allOf":[{"$ref":"#/components/schemas/TemplateVersion"},{"type":"object","properties":{"design":{"type":"object"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/available":{"get":{"tags":["Choix du modèle"],"operationId":"availableTemplates","summary":"Les modèles disponibles pour un type","description":"Pour afficher un menu dans votre logiciel, ou savoir ce qu'un appel\npar `kind` donnera. Sans `kind`, un objet par type :\n`{\"data\": [...]}`. Un id lu ici n'est pas une autorisation : la\ngénération vérifie tout à nouveau.\n","parameters":[{"name":"kind","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Organisation"}],"responses":{"200":{"description":"Les modèles du type et celui qu'un appel sans `template` recevrait.","content":{"application/json":{"example":{"kind":"invoice","label":"Facture","selection_mode":"optional","default_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_version":4,"resolution_error":null,"templates":[{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture-standard","name":"Facture standard","kind":"invoice","published":true,"version":4,"origin":"organisation","is_default":true,"usable":true},{"id":"0193a5b4-1c2d-7e3f-8a4b-6c7d8e9f0a1b","external_id":null,"name":"Facture avec acompte","kind":"invoice","published":true,"version":1,"origin":"organisation","is_default":false,"usable":true}]},"schema":{"$ref":"#/components/schemas/Availability"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/document-config":{"get":{"tags":["Choix du modèle"],"operationId":"listDocumentConfig","summary":"La configuration de chaque type","parameters":[{"$ref":"#/components/parameters/Organisation"}],"responses":{"200":{"description":"Pour chaque type, le mode, le modèle par défaut et ce qu'un appel recevrait.","content":{"application/json":{"example":{"data":[{"kind":"invoice","label":"Facture","selection_mode":"automatic","default_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_by":"organisation_default","resolution_error":null}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentConfig"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/document-config/{kind}":{"parameters":[{"$ref":"#/components/parameters/Kind"},{"$ref":"#/components/parameters/Organisation"}],"get":{"tags":["Choix du modèle"],"operationId":"getDocumentConfig","summary":"La configuration d'un type","responses":{"200":{"description":"La configuration.","content":{"application/json":{"example":{"kind":"invoice","label":"Facture","selection_mode":"automatic","default_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_by":"organisation_default","resolution_error":null},"schema":{"$ref":"#/components/schemas/DocumentConfig"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"500":{"$ref":"#/components/responses/ServerError"}}},"put":{"tags":["Choix du modèle"],"operationId":"putDocumentConfig","summary":"Choisir le modèle par défaut et le mode","description":"`automatic` (par défaut) : Mizanpage résout le modèle. `optional` :\nmême résolution, votre logiciel peut proposer un menu. `required` :\nl'appel doit nommer un modèle. `null` revient au comportement par\ndéfaut. Rôle `designer` pour le défaut, `admin` pour le mode.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"default_template":{"type":["string","null"],"description":"Id ou `external_id` d'un modèle publié de ce type."},"selection_mode":{"type":["string","null"],"enum":["automatic","optional","required",null]}}},"example":{"default_template":"tpl_invoice","selection_mode":"optional"}}}},"responses":{"200":{"description":"La configuration enregistrée.","content":{"application/json":{"example":{"kind":"invoice","label":"Facture","selection_mode":"automatic","default_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","resolved_by":"organisation_default","resolution_error":null},"schema":{"$ref":"#/components/schemas/DocumentConfig"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"tags":["Choix du modèle"],"operationId":"deleteDocumentConfig","summary":"Revenir au mode automatique","description":"Le type redevient automatique, sans défaut. Rôle `admin`.","responses":{"204":{"description":"Fait."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/editor-sessions":{"post":{"tags":["Sessions d'éditeur"],"operationId":"openEditorSession","summary":"Ouvrir l'éditeur pour une personne","description":"Renvoie un lien à mettre dans une iframe ou un onglet. Une session\nn'est jamais `admin` : demander `admin` donne `designer`, et la\nréponse le dit.\n\nUne installation (`mzi_`) ou la clé d'un partenaire ouvre une\n**session déléguée** : `organisation` et `origin` obligatoires, et\n`permissions` à la place de `role`.\n\n`origin` est l'origine de la page qui intègre l'éditeur : l'éditeur\nne s'affiche dans une iframe que sur cette page. Une fois des pages\nautorisées déclarées (`PUT /v1/embed-origins`), elle doit en faire\npartie.\n","parameters":[{"$ref":"#/components/parameters/Organisation"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditorSessionRequest"},"examples":{"cle":{"summary":"Avec la clé de l'espace","value":{"user":{"id":"42","name":"Marie Dupont"},"kind":"sales.order_form","template":"tpl-showroom","ttl":3600,"language":"fr","role":"operator","origin":"https://app.example.com","appearance":{"color":"#0b6e4f","font":"system","radius":6,"brand":false,"pdf":"host"}}},"deleguee":{"summary":"Session déléguée (installation d'un partenaire)","value":{"organisation":"dealer-42","user":{"id":"fb-user-8812","name":"Marie Dupont"},"permissions":["templates:read","templates:write","documents:generate"],"origin":"https://dms.partenaire.example","kind":"vehicle_order","ttl":900}}}}}},"responses":{"201":{"description":"La session ouverte.","content":{"application/json":{"example":{"id":"0193a5d0-4e5f-7a6b-8c7d-9e0f1a2b3c4d","session_id":"0193a5d0-4e5f-7a6b-8c7d-9e0f1a2b3c4d","token":"mzs_6f1c…","role":"designer","permissions":["templates:read","templates:write"],"organisation":{"ref":"client-4821","name":"Garage Solvérac"},"url":"https://app.mizanpage.com/embed#token=mzs_6f1c…","expires_at":"2026-11-23T11:30:04+01:00"},"schema":{"$ref":"#/components/schemas/EditorSession"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}}},"get":{"tags":["Sessions d'éditeur"],"operationId":"listEditorSessions","summary":"Lister les sessions déléguées en cours","description":"Sans jeton. Une clé partenaire doit nommer `organisation`.","parameters":[{"name":"organisation","in":"query","schema":{"type":"string"}},{"name":"user","in":"query","schema":{"type":"string"}},{"$ref":"#/components/parameters/Organisation"}],"responses":{"200":{"description":"Les sessions.","content":{"application/json":{"example":{"data":[{"session_id":"0193a5d0-4e5f-7a6b-8c7d-9e0f1a2b3c4d","organisation":"client-4821","user":{"id":"u-118","name":"Julie Martin"},"permissions":["templates:read","templates:write"],"opened_by":"Fastback EU","installation":"serveur-eu-1","origin":"https://app.fastback.example","created_at":"2026-11-23T10:30:04+01:00","expires_at":"2026-11-23T11:30:04+01:00"}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"session_id":{"type":"string"},"organisation":{"type":"string"},"user":{"type":"object"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}},"opened_by":{"type":"string"},"installation":{"type":["string","null"]},"origin":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"tags":["Sessions d'éditeur"],"operationId":"endAllEditorSessions","summary":"Fermer toutes les sessions de l'espace","description":"Ferme toutes les sessions ouvertes jusqu'ici (une clé qui a fui, un\nutilisateur parti). Celles ouvertes ensuite fonctionnent.\n","responses":{"204":{"description":"Fait."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/editor-sessions/{id}":{"delete":{"tags":["Sessions d'éditeur"],"operationId":"endEditorSession","summary":"Fermer une session","description":"Un `id` inconnu ne change rien et répond pareil.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{22}$"}}],"responses":{"204":{"description":"Fait."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/editor-sessions/current":{"delete":{"tags":["Sessions d'éditeur"],"operationId":"endCurrentEditorSession","summary":"Fermer sa propre session","description":"Appelé par l'éditeur avec son jeton `mzs_` (déconnexion).","responses":{"204":{"description":"Fait."},"401":{"$ref":"#/components/responses/Unauthenticated"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/editor-sessions/revoke":{"post":{"tags":["Sessions d'éditeur"],"operationId":"revokeEditorSessions","summary":"Fermer les sessions d'une personne ou d'une organisation","description":"Un droit retiré chez vous ; sans `user`, toute l'organisation.","parameters":[{"$ref":"#/components/parameters/Organisation"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organisation":{"type":"string"},"user":{"type":"string"}}},"example":{"organisation":"dealer-42","user":"fb-user-8812"}}}},"responses":{"200":{"description":"Le nombre de sessions fermées.","content":{"application/json":{"example":{"revoked":2},"schema":{"type":"object","properties":{"revoked":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/embed-origins":{"get":{"tags":["Sessions d'éditeur"],"operationId":"listEmbedOrigins","summary":"Les pages autorisées à intégrer l'éditeur","responses":{"200":{"description":"La liste.","content":{"application/json":{"example":{"origins":["https://app.fastback.example"]},"schema":{"$ref":"#/components/schemas/EmbedOrigins"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}},"put":{"tags":["Sessions d'éditeur"],"operationId":"replaceEmbedOrigins","summary":"Déclarer les pages autorisées","description":"20 origines au plus, chacune `https://hôte[:port]`, sans chemin ni\njoker. Une fois une liste déclarée, chaque session nomme une de ces\norigines (`403 origin_not_declared`). La liste d'un partenaire vaut\naussi pour ses organisations.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbedOrigins"},"example":{"origins":["https://app.example.com","https://staging.example.com"]}}}},"responses":{"200":{"description":"La liste enregistrée.","content":{"application/json":{"example":{"origins":["https://app.fastback.example","https://staging.fastback.example"]},"schema":{"$ref":"#/components/schemas/EmbedOrigins"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks":{"get":{"tags":["Webhooks"],"operationId":"listWebhooks","summary":"Les adresses de webhook","responses":{"200":{"description":"Les adresses de l'espace (sans leur secret) et les événements disponibles.","content":{"application/json":{"example":{"data":[{"id":"0193a5e1-7a8b-7c9d-8e0f-1a2b3c4d5e6f","url":"https://example.com/hooks/mizanpage","description":"ERP","events":["document.generated","template.published"],"enabled":true,"created_at":"2026-11-20T16:12:40+01:00","last_delivery":{"type":"template.published","status":"delivered","response_status":200,"created_at":"2026-11-23T10:30:04+01:00"}}],"events":["document.generated","template.published","template.archived","template.restored"]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/WebhookEndpoint"},{"type":"object","properties":{"last_delivery":{"description":"La dernière livraison de l'adresse, pour voir d'un coup d'œil si elle répond. `null` tant que rien n'a été envoyé.","oneOf":[{"type":"null"},{"type":"object","properties":{"type":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"response_status":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time"}}}]}}}]}},"events":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEventType"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}},"post":{"tags":["Webhooks"],"operationId":"createWebhook","summary":"Déclarer une adresse","description":"Une adresse `https` publique (ni réseau privé, ni `localhost`, ni\nidentifiants dans l'adresse), 10 par espace au plus\n(`409 webhook_limit`). `events` vaut `[\"*\"]` (tous, par défaut) ou\nune liste d'événements. Le `secret` de signature n'apparaît que dans\ncette réponse.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointInput"},"example":{"url":"https://erp.example.com/hooks/mizanpage","events":["template.published","document.generated"],"description":"ERP production"}}}},"responses":{"201":{"description":"L'adresse, avec son secret.","content":{"application/json":{"example":{"id":"0193a5e1-7a8b-7c9d-8e0f-1a2b3c4d5e6f","url":"https://example.com/hooks/mizanpage","description":"ERP","events":["document.generated","template.published"],"enabled":true,"created_at":"2026-11-20T16:12:40+01:00","secret":"whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"},"schema":{"$ref":"#/components/schemas/WebhookEndpointWithSecret"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks/{id}":{"parameters":[{"$ref":"#/components/parameters/WebhookId"}],"get":{"tags":["Webhooks"],"operationId":"getWebhook","summary":"Lire une adresse","responses":{"200":{"description":"L'adresse, sans son secret.","content":{"application/json":{"example":{"id":"0193a5e1-7a8b-7c9d-8e0f-1a2b3c4d5e6f","url":"https://example.com/hooks/mizanpage","description":"ERP","events":["document.generated","template.published"],"enabled":true,"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"patch":{"tags":["Webhooks"],"operationId":"updateWebhook","summary":"Modifier ou mettre en pause une adresse","description":"Seuls les champs envoyés changent. `\"enabled\": false` suspend les envois sans supprimer l'adresse.","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEndpointInput"},{"type":"object","properties":{"enabled":{"type":"boolean"}}}]},"example":{"enabled":false}}}},"responses":{"200":{"description":"L'adresse modifiée.","content":{"application/json":{"example":{"id":"0193a5e1-7a8b-7c9d-8e0f-1a2b3c4d5e6f","url":"https://example.com/hooks/mizanpage","description":"ERP","events":["document.generated","template.published"],"enabled":false,"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"tags":["Webhooks"],"operationId":"deleteWebhook","summary":"Supprimer une adresse","description":"L'adresse et l'historique de ses envois.","responses":{"204":{"description":"Supprimée."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks/{id}/secret":{"parameters":[{"$ref":"#/components/parameters/WebhookId"}],"post":{"tags":["Webhooks"],"operationId":"rotateWebhookSecret","summary":"Changer le secret","description":"Un nouveau secret, aussitôt en service ; l'ancien ne signe plus rien.","responses":{"200":{"description":"L'adresse, avec son nouveau secret.","content":{"application/json":{"example":{"id":"0193a5e1-7a8b-7c9d-8e0f-1a2b3c4d5e6f","url":"https://example.com/hooks/mizanpage","description":"ERP","events":["document.generated","template.published"],"enabled":true,"created_at":"2026-11-20T16:12:40+01:00","secret":"whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"},"schema":{"$ref":"#/components/schemas/WebhookEndpointWithSecret"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks/{id}/test":{"parameters":[{"$ref":"#/components/parameters/WebhookId"}],"post":{"tags":["Webhooks"],"operationId":"testWebhook","summary":"Envoyer un événement de test","description":"Envoie `webhook.test` tout de suite, signé comme les autres. La réponse dit ce que l'adresse a répondu.","responses":{"200":{"description":"L'envoi et son résultat (`delivered`, ou `pending` avec le statut reçu).","content":{"application/json":{"example":{"id":"0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f90","event_id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"webhook.test","status":"delivered","attempts":1,"response_status":200,"error":null,"created_at":"2026-11-23T10:30:04+01:00","last_attempt_at":"2026-11-23T10:30:04+01:00","next_attempt_at":null,"payload":{"id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"webhook.test","timestamp":"2026-11-23T10:30:04+01:00","organisation":{"id":"0193a4f0-6b7c-7d8e-9f0a-1b2c3d4e5f60","ref":null},"data":[]}},"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks/{id}/deliveries":{"parameters":[{"$ref":"#/components/parameters/WebhookId"}],"get":{"tags":["Webhooks"],"operationId":"listWebhookDeliveries","summary":"L'historique des envois","description":"Les 50 derniers envois de l'adresse, du plus récent au plus ancien, gardés 30 jours.","responses":{"200":{"description":"Les envois.","content":{"application/json":{"example":{"data":[{"id":"0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f90","event_id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"template.published","status":"delivered","attempts":1,"response_status":200,"error":null,"created_at":"2026-11-23T10:30:04+01:00","last_attempt_at":"2026-11-23T10:30:04+01:00","next_attempt_at":null,"payload":{"id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"template.published","timestamp":"2026-11-23T10:30:04+01:00","organisation":{"id":"0193a4f0-6b7c-7d8e-9f0a-1b2c3d4e5f60","ref":null},"data":{"template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture-standard","kind":"invoice","name":"Facture standard","version":4,"published_at":"2026-11-23T10:30:04+01:00","archived":false}}},{"id":"0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f92","event_id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"template.published","status":"pending","attempts":2,"response_status":500,"error":"HTTP 500","created_at":"2026-11-23T10:30:04+01:00","last_attempt_at":"2026-11-23T10:30:04+01:00","next_attempt_at":"2026-11-23T11:00:04+01:00","payload":{"id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"template.published","timestamp":"2026-11-23T10:30:04+01:00","organisation":{"id":"0193a4f0-6b7c-7d8e-9f0a-1b2c3d4e5f60","ref":null},"data":{"template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture-standard","kind":"invoice","name":"Facture standard","version":4,"published_at":"2026-11-23T10:30:04+01:00","archived":false}}}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks/{id}/deliveries/{delivery}/retry":{"parameters":[{"$ref":"#/components/parameters/WebhookId"},{"name":"delivery","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Webhooks"],"operationId":"retryWebhookDelivery","summary":"Renvoyer un envoi","description":"Renvoie tout de suite un envoi abandonné ou en attente, avec le même `webhook-id`, et repart de la première tentative.","responses":{"200":{"description":"L'envoi et son résultat.","content":{"application/json":{"example":{"id":"0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f90","event_id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"template.published","status":"pending","attempts":3,"response_status":200,"error":null,"created_at":"2026-11-23T10:30:04+01:00","last_attempt_at":"2026-11-23T10:30:04+01:00","next_attempt_at":"2026-11-23T10:30:04+01:00","payload":{"id":"evt_0193a5f2-0b1c-7d2e-9f3a-4b5c6d7e8f91","type":"template.published","timestamp":"2026-11-23T10:30:04+01:00","organisation":{"id":"0193a4f0-6b7c-7d8e-9f0a-1b2c3d4e5f60","ref":null},"data":{"template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture-standard","kind":"invoice","name":"Facture standard","version":4,"published_at":"2026-11-23T10:30:04+01:00","archived":false}}},"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/history":{"get":{"tags":["Documents conservés"],"operationId":"listHistory","summary":"Les documents conservés","description":"Filtrés, triés et paginés par le serveur, 50 par page. Du plus récent au plus ancien par défaut. La recherche et le tri par nom portent sur les 5 000 documents les plus récents que gardent les autres filtres.","parameters":[{"name":"q","in":"query","description":"Recherche dans le nom, le modèle et la personne.","schema":{"type":"string"}},{"name":"template","in":"query","description":"Seulement les documents de ce modèle (son id).","schema":{"type":"string"}},{"name":"from","in":"query","description":"Depuis ce jour inclus (`AAAA-MM-JJ`).","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","description":"Jusqu'à ce jour inclus (`AAAA-MM-JJ`).","schema":{"type":"string","format":"date"}},{"name":"sort","in":"query","description":"Colonne de tri.","schema":{"type":"string","enum":["created_at","name","template_name","created_by"],"default":"created_at"}},{"name":"dir","in":"query","description":"Sens du tri.","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}},{"name":"page","in":"query","description":"Numéro de page, à partir de 1.","schema":{"type":"integer","minimum":1,"default":1}}],"responses":{"200":{"description":"Les documents de la page, le total, les modèles pour le filtre et les réglages de l'espace.","content":{"application/json":{"example":{"data":[{"id":"0193a601-5c6d-7e7f-8a9b-0c1d2e3f4a5b","name":"F-2026-0412","template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","template_name":"Facture standard","kind":"invoice","version":4,"source":"app","created_by":"Julie Martin","size":48213,"generation_id":"0193a601-5c6d-7e7f-8a9b-0c1d2e3f4a5c","created_at":"2026-11-23T10:30:04+01:00"}],"total":1,"page":1,"pages":1,"templates":[{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","name":"Facture standard"}],"settings":{"app":true,"api":false,"retention_days":365,"retentions":[90,365,1095,3650]}},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KeptDocument"}},"total":{"type":"integer","description":"Nombre de documents qui correspondent."},"page":{"type":"integer"},"pages":{"type":"integer"},"templates":{"type":"array","description":"Les modèles des documents conservés, pour le filtre.","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}},"settings":{"type":"object","properties":{"app":{"type":"boolean","description":"Les documents faits dans l'application sont gardés."},"api":{"type":"boolean","description":"Les documents de l'API sont gardés."},"retention_days":{"type":"integer","description":"Durée de conservation en jours."},"retentions":{"type":"array","items":{"type":"integer"}},"share_links":{"type":"boolean","description":"Le partage par lien est autorisé."},"share_durations":{"type":"array","items":{"type":"integer"},"description":"Les expirations proposées, en jours."}}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/history/archive":{"post":{"tags":["Documents conservés"],"operationId":"archiveHistory","summary":"Télécharger plusieurs documents","description":"Un zip des PDF tels qu'ils ont été générés. Non comptés.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Les ids des documents, 100 au plus."}}}}}},"responses":{"200":{"description":"Le zip.","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/history/export":{"get":{"tags":["Documents conservés"],"operationId":"exportHistory","summary":"Exporter tous les documents","description":"Un zip des PDF de tous les documents que gardent les filtres de la liste (les 5 000 plus récents au plus). Non comptés. 404 si aucun document ne correspond.","parameters":[{"name":"q","in":"query","description":"Recherche dans le nom, le modèle et la personne.","schema":{"type":"string"}},{"name":"template","in":"query","description":"Seulement les documents de ce modèle (son id).","schema":{"type":"string"}},{"name":"from","in":"query","description":"Depuis ce jour inclus (`AAAA-MM-JJ`).","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","description":"Jusqu'à ce jour inclus (`AAAA-MM-JJ`).","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Le zip.","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/history/delete":{"post":{"tags":["Documents conservés"],"operationId":"deleteHistoryDocuments","summary":"Supprimer plusieurs documents","description":"Les PDF et leurs données sont supprimés pour de bon.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Les ids des documents, 100 au plus."}}}}}},"responses":{"200":{"description":"Le nombre de documents supprimés.","content":{"application/json":{"example":{"deleted":3},"schema":{"type":"object","properties":{"deleted":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/history/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Documents conservés"],"operationId":"getHistoryDocument","summary":"Lire un document conservé","description":"Le document et les `data` envoyées pour le générer.","responses":{"200":{"description":"Le document.","content":{"application/json":{"example":{"id":"0193a601-5c6d-7e7f-8a9b-0c1d2e3f4a5b","name":"F-2026-0412","template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","template_name":"Facture standard","kind":"invoice","version":4,"source":"app","created_by":"Julie Martin","size":48213,"generation_id":"0193a601-5c6d-7e7f-8a9b-0c1d2e3f4a5c","created_at":"2026-11-23T10:30:04+01:00","data":{"client.nom":"Garage Solvérac","facture.numero":"F-2026-0412","facture.total":"1 250,00 €"}},"schema":{"allOf":[{"$ref":"#/components/schemas/KeptDocument"},{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"tags":["Documents conservés"],"operationId":"deleteHistoryDocument","summary":"Supprimer un document conservé","description":"Le PDF et ses données sont supprimés pour de bon.","responses":{"204":{"description":"Supprimé."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/history/{id}/pdf":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Documents conservés"],"operationId":"getHistoryPdf","summary":"Télécharger le PDF conservé","description":"Le PDF tel qu'il a été généré. Non compté.","parameters":[{"name":"inline","in":"query","description":"`1` : le PDF s'affiche dans la page (aperçu) au lieu d'être téléchargé.","schema":{"type":"integer","enum":[0,1]}}],"responses":{"200":{"description":"Le PDF.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/history/{id}/share":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Documents conservés"],"operationId":"shareHistoryDocument","summary":"Créer un lien public","description":"Un lien public vers le PDF : toute personne qui a l'adresse l'ouvre sans compte, jusqu'à l'expiration ou au retrait du lien. Un nouveau lien remplace celui que le document avait. L'adresse (`/s/<jeton>`) répond `noindex` et `no-store`, et ne compte aucun document. `403 share_links_off` quand un administrateur a désactivé le partage.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer","enum":[1,7,30,90],"default":30,"description":"Jours avant l'expiration du lien."}}}}}},"responses":{"201":{"description":"Le lien.","content":{"application/json":{"example":{"url":"https://api.mizanpage.com/s/k7Qm2vXpL9","expires_at":"2026-12-23T10:30:04+01:00","expired":false,"views":0,"last_viewed_at":null,"created_by":"Julie Martin","created_at":"2026-11-23T10:30:04+01:00"},"schema":{"$ref":"#/components/schemas/ShareLink"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"patch":{"tags":["Documents conservés"],"operationId":"extendHistoryDocumentShare","summary":"Changer l'échéance du lien","description":"La nouvelle échéance part d'aujourd'hui. L'adresse ne change pas. `404` si le document n'a pas de lien.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer","enum":[1,7,30,90],"default":30,"description":"Jours avant l'expiration du lien."}}}}}},"responses":{"200":{"description":"Le lien.","content":{"application/json":{"example":{"url":"https://api.mizanpage.com/s/k7Qm2vXpL9","expires_at":"2027-01-22T10:30:04+01:00","expired":false,"views":4,"last_viewed_at":"2026-11-23T10:30:04+01:00","created_by":"Julie Martin","created_at":"2026-11-23T10:30:04+01:00"},"schema":{"$ref":"#/components/schemas/ShareLink"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"tags":["Documents conservés"],"operationId":"unshareHistoryDocument","summary":"Retirer le lien public","description":"L'adresse n'ouvre plus rien.","responses":{"204":{"description":"Retiré."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/standards":{"get":{"tags":["Standards"],"operationId":"listStandards","summary":"Les standards de l'organisation","parameters":[{"name":"kind","in":"query","schema":{"type":"string"}},{"$ref":"#/components/parameters/Organisation"}],"responses":{"200":{"description":"Chaque standard, la version imprimée ici, la dernière, et les personnalisations.","content":{"application/json":{"example":{"data":[{"id":"0193a612-9d0e-7f1a-8b2c-3d4e5f6a7b8c","external_id":"bdc-vehicule","name":"Bon de commande véhicule","kind":"sales.order_form","version":2,"latest_version":3,"adopted_version":2,"adopted_at":"2026-11-20T16:12:40+01:00","update_policy":"manual","update_policy_source":"partner","update_available":true,"customizable":true,"personalisations":[{"id":"0193a5b4-1c2d-7e3f-8a4b-6c7d8e9f0a1b","name":"Bon de commande véhicule (atelier)","published":true,"archived":false,"source_version":2,"outdated":true}]}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Standard"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/standards/{ref}":{"parameters":[{"$ref":"#/components/parameters/Ref"},{"$ref":"#/components/parameters/Organisation"}],"get":{"tags":["Standards"],"operationId":"getStandard","summary":"Lire un standard","description":"Le standard, plus `versions` (numéro, date, auteur), la plus récente d'abord.","responses":{"200":{"description":"Le standard.","content":{"application/json":{"example":{"id":"0193a612-9d0e-7f1a-8b2c-3d4e5f6a7b8c","external_id":"bdc-vehicule","name":"Bon de commande véhicule","kind":"sales.order_form","version":2,"latest_version":3,"adopted_version":2,"adopted_at":"2026-11-20T16:12:40+01:00","update_policy":"manual","update_policy_source":"partner","update_available":true,"customizable":true,"personalisations":[{"id":"0193a5b4-1c2d-7e3f-8a4b-6c7d8e9f0a1b","name":"Bon de commande véhicule (atelier)","published":true,"archived":false,"source_version":2,"outdated":true}],"versions":[{"version":3,"published_at":"2026-11-23T10:30:04+01:00","published_by":"Fastback"},{"version":2,"published_at":"2026-11-20T16:12:40+01:00","published_by":"Fastback"}]},"schema":{"$ref":"#/components/schemas/Standard"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"put":{"tags":["Standards"],"operationId":"setStandardPolicy","summary":"Suivre chaque version, ou choisir","description":"`null` : la règle du partenaire. Rôle `admin`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"update_policy":{"type":["string","null"],"enum":["manual","automatic",null]}}}}}},"responses":{"200":{"description":"Le standard.","content":{"application/json":{"example":{"id":"0193a612-9d0e-7f1a-8b2c-3d4e5f6a7b8c","external_id":"bdc-vehicule","name":"Bon de commande véhicule","kind":"sales.order_form","version":2,"latest_version":3,"adopted_version":2,"adopted_at":"2026-11-20T16:12:40+01:00","update_policy":"automatic","update_policy_source":"partner","update_available":true,"customizable":true,"personalisations":[{"id":"0193a5b4-1c2d-7e3f-8a4b-6c7d8e9f0a1b","name":"Bon de commande véhicule (atelier)","published":true,"archived":false,"source_version":2,"outdated":true}]},"schema":{"$ref":"#/components/schemas/Standard"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/standards/{ref}/adopt":{"post":{"tags":["Standards"],"operationId":"adoptStandard","summary":"Adopter une version","description":"Cette version imprime désormais (la dernière par défaut). Rôle `designer`.","parameters":[{"$ref":"#/components/parameters/Ref"},{"$ref":"#/components/parameters/Organisation"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"}}}}}},"responses":{"200":{"description":"Le standard.","content":{"application/json":{"example":{"id":"0193a612-9d0e-7f1a-8b2c-3d4e5f6a7b8c","external_id":"bdc-vehicule","name":"Bon de commande véhicule","kind":"sales.order_form","version":3,"latest_version":3,"adopted_version":3,"adopted_at":"2026-11-23T10:30:04+01:00","update_policy":"manual","update_policy_source":"partner","update_available":false,"customizable":true,"personalisations":[{"id":"0193a5b4-1c2d-7e3f-8a4b-6c7d8e9f0a1b","name":"Bon de commande véhicule (atelier)","published":true,"archived":false,"source_version":2,"outdated":true}]},"schema":{"$ref":"#/components/schemas/Standard"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/standards/{ref}/customize":{"post":{"tags":["Standards"],"operationId":"customizeStandard","summary":"Personnaliser un standard","description":"Crée la copie de l'organisation, publiée telle quelle, qui devient\nle modèle par défaut du type (sauf `make_default: false`). Le\nstandard du partenaire ne bouge pas. Rôle `designer`.\n","parameters":[{"$ref":"#/components/parameters/Ref"},{"$ref":"#/components/parameters/Organisation"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"make_default":{"type":"boolean"},"version":{"type":"integer"}}}}}},"responses":{"201":{"description":"La personnalisation.","content":{"application/json":{"example":{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":null,"name":"Bon de commande véhicule","kind":"sales.order_form","folder_id":null,"version":1,"published":true,"has_draft":false,"private":false,"updated_by":"Julie Martin","updated_at":"2026-11-23T10:30:04+01:00","published_by":"Julie Martin","published_at":"2026-11-23T10:30:04+01:00","offered_to_customers":false,"source_id":"0193a612-9d0e-7f1a-8b2c-3d4e5f6a7b8c","archived":false,"archived_at":null,"source_version":3,"numbering":null,"uses":{"keys":["client.nom","facture.numero","facture.total","facture.lignes"],"logo":true,"photos":0,"attachments":0}},"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{ref}/update-from-standard":{"post":{"tags":["Standards"],"operationId":"updateFromStandard","summary":"Reprendre la dernière version du standard","description":"Sur une personnalisation, met la dernière version du standard en brouillon. Rien n'imprime autrement tant que personne ne publie.","parameters":[{"$ref":"#/components/parameters/Ref"},{"$ref":"#/components/parameters/Organisation"}],"responses":{"200":{"description":"La personnalisation, avec son nouveau brouillon.","content":{"application/json":{"example":{"id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":null,"name":"Bon de commande véhicule","kind":"sales.order_form","folder_id":null,"version":2,"published":true,"has_draft":false,"private":false,"updated_by":"Julie Martin","updated_at":"2026-11-23T10:30:04+01:00","published_by":"Julie Martin","published_at":"2026-11-23T10:30:04+01:00","offered_to_customers":false,"source_id":"0193a612-9d0e-7f1a-8b2c-3d4e5f6a7b8c","archived":false,"archived_at":null,"source_version":3,"numbering":null,"uses":{"keys":["client.nom","facture.numero","facture.total","facture.lignes"],"logo":true,"photos":0,"attachments":0}},"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/organisations":{"post":{"tags":["Partenaires"],"operationId":"provisionOrganisation","summary":"Créer ou retrouver une organisation","description":"Par votre propre référence : `201` à la création, `200` ensuite, la\nmême organisation même si deux appels arrivent au même instant.\nAucune clé n'est émise sauf `issue_key: true` (secret montré une\nfois).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ref","name"],"properties":{"ref":{"$ref":"#/components/schemas/PartnerRef"},"name":{"type":"string"},"issue_key":{"type":"boolean"},"key_label":{"type":"string"}}},"example":{"ref":"dealer-42","name":"Garage Ternevaux"}}}},"responses":{"200":{"description":"L'organisation existait déjà.","content":{"application/json":{"example":{"organisation":{"id":"0193a620-1e2f-7a3b-9c4d-5e6f7a8b9c0d","ref":"client-4821","name":"Garage Solvérac","status":"active","deactivated_at":null,"created_at":"2026-11-20T16:12:40+01:00"},"api_key":null,"api_key_id":null},"schema":{"$ref":"#/components/schemas/OrganisationEnvelope"}}}},"201":{"description":"L'organisation créée.","content":{"application/json":{"example":{"organisation":{"id":"0193a620-1e2f-7a3b-9c4d-5e6f7a8b9c0d","ref":"client-4821","name":"Garage Solvérac","status":"active","deactivated_at":null,"created_at":"2026-11-20T16:12:40+01:00"},"api_key":"mzp_live_7Hq2…","api_key_id":"0193a631-3f4a-7b5c-8d6e-7f8a9b0c1d2e"},"schema":{"$ref":"#/components/schemas/OrganisationEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"get":{"tags":["Partenaires"],"operationId":"listOrganisations","summary":"Lister les organisations","description":"Les plus anciennes d'abord, 100 par page (1 000 au plus).","parameters":[{"name":"ref","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["active","inactive"]}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":1000}}],"responses":{"200":{"description":"Une page.","content":{"application/json":{"example":{"data":[{"id":"0193a620-1e2f-7a3b-9c4d-5e6f7a8b9c0d","ref":"client-4821","name":"Garage Solvérac","status":"active","deactivated_at":null,"created_at":"2026-11-20T16:12:40+01:00"}],"next_cursor":null},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Organisation"}},"next_cursor":{"type":["string","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/organisations/{ref}":{"parameters":[{"$ref":"#/components/parameters/PartnerRefPath"}],"get":{"tags":["Partenaires"],"operationId":"getOrganisation","summary":"Lire une organisation","responses":{"200":{"description":"L'organisation.","content":{"application/json":{"example":{"id":"0193a620-1e2f-7a3b-9c4d-5e6f7a8b9c0d","ref":"client-4821","name":"Garage Solvérac","status":"active","deactivated_at":null,"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Organisation"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"patch":{"tags":["Partenaires"],"operationId":"updateOrganisation","summary":"Renommer, désactiver ou réactiver","description":"Désactivée, l'organisation reste lisible mais ne génère et ne modifie\nplus rien (`409 organisation_inactive`), et rien n'est compté. Rien\nn'est effacé.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]}}}}}},"responses":{"200":{"description":"L'organisation.","content":{"application/json":{"example":{"id":"0193a620-1e2f-7a3b-9c4d-5e6f7a8b9c0d","ref":"client-4821","name":"Garage Solvérac & Fils","status":"active","deactivated_at":null,"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Organisation"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/organisations/{ref}/keys":{"parameters":[{"$ref":"#/components/parameters/PartnerRefPath"}],"get":{"tags":["Partenaires"],"operationId":"listOrganisationKeys","summary":"Les clés d'une organisation","description":"Jamais le secret.","responses":{"200":{"description":"Les clés.","content":{"application/json":{"example":{"data":[{"id":"0193a631-3f4a-7b5c-8d6e-7f8a9b0c1d2e","label":"Production","prefix":"mzp_live_7Hq2","test":false,"created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"post":{"tags":["Partenaires"],"operationId":"issueOrganisationKey","summary":"Créer une clé pour une organisation","description":"Le secret est montré une fois. `test: true` crée une clé de test.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","maxLength":80},"test":{"type":"boolean"}}}}}},"responses":{"201":{"description":"La clé, avec son secret.","content":{"application/json":{"example":{"id":"0193a631-3f4a-7b5c-8d6e-7f8a9b0c1d2f","label":"Production","test":false,"api_key":"mzp_live_9Kd4…"},"schema":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"test":{"type":"boolean"},"api_key":{"type":"string","description":"Le secret `mzp_…`, montré une seule fois."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/organisations/{ref}/keys/{id}":{"delete":{"tags":["Partenaires"],"operationId":"revokeOrganisationKey","summary":"Révoquer une clé d'organisation","parameters":[{"$ref":"#/components/parameters/PartnerRefPath"},{"$ref":"#/components/parameters/Id"}],"responses":{"204":{"description":"La clé est révoquée."},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/installations":{"post":{"tags":["Partenaires"],"operationId":"createInstallation","summary":"Créer une installation","description":"Un identifiant `mzi_…` par serveur de votre logiciel. Une installation\nnouvelle n'a aucune permission : accordez chacune explicitement.\n`201` avec l'identifiant, montré une fois ; redemandé avec la même\n`ref`, `200` sans nouvel identifiant.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ref","name"],"properties":{"ref":{"$ref":"#/components/schemas/PartnerRef"},"name":{"type":"string"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}},"organisations":{"type":"array","items":{"type":"string"}}}},"example":{"ref":"srv-lyon","name":"Serveur Lyon","permissions":["templates:read","documents:generate"],"organisations":["dealer-42","dealer-43"]}}}},"responses":{"200":{"description":"L'installation existait déjà (sans nouvel identifiant).","content":{"application/json":{"example":{"installation":{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback EU","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821","client-4822"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"},"credential":null,"credential_id":null},"schema":{"$ref":"#/components/schemas/InstallationEnvelope"}}}},"201":{"description":"L'installation créée, avec son identifiant.","content":{"application/json":{"example":{"installation":{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback EU","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821","client-4822"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"},"credential":"mzi_Wq8d…","credential_id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a"},"schema":{"$ref":"#/components/schemas/InstallationEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"get":{"tags":["Partenaires"],"operationId":"listInstallations","summary":"Lister les installations","parameters":[{"name":"ref","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Les installations, leurs organisations et leurs identifiants (jamais le secret).","content":{"application/json":{"example":{"data":[{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback EU","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821","client-4822"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Installation"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/installations/{ref}":{"parameters":[{"$ref":"#/components/parameters/PartnerRefPath"}],"get":{"tags":["Partenaires"],"operationId":"getInstallation","summary":"Lire une installation","responses":{"200":{"description":"L'installation.","content":{"application/json":{"example":{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback EU","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821","client-4822"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Installation"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"patch":{"tags":["Partenaires"],"operationId":"updateInstallation","summary":"Modifier ou révoquer une installation","description":"Révoquée, elle ne répond plus et ses sessions s'arrêtent.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}},"status":{"type":"string","enum":["active","revoked"]}}}}}},"responses":{"200":{"description":"L'installation.","content":{"application/json":{"example":{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback Europe","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821","client-4822"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Installation"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/installations/{ref}/credentials":{"post":{"tags":["Partenaires"],"operationId":"rotateInstallationCredential","summary":"Émettre un nouvel identifiant (rotation)","description":"L'ancien reste valable jusqu'à ce que vous le révoquiez.","parameters":[{"$ref":"#/components/parameters/PartnerRefPath"}],"responses":{"201":{"description":"Le nouvel identifiant, montré une fois.","content":{"application/json":{"example":{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5b","credential":"mzi_Zt3k…"},"schema":{"type":"object","properties":{"id":{"type":"string"},"credential":{"type":"string","description":"Le secret `mzi_…`."}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/installations/{ref}/credentials/{id}":{"delete":{"tags":["Partenaires"],"operationId":"revokeInstallationCredential","summary":"Révoquer un identifiant","parameters":[{"$ref":"#/components/parameters/PartnerRefPath"},{"$ref":"#/components/parameters/Id"}],"responses":{"204":{"description":"L'identifiant est révoqué."},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/installations/{ref}/organisations":{"put":{"tags":["Partenaires"],"operationId":"replaceInstallationOrganisations","summary":"Remplacer les organisations autorisées","parameters":[{"$ref":"#/components/parameters/PartnerRefPath"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["refs"],"properties":{"refs":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"L'installation.","content":{"application/json":{"example":{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback EU","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821","client-4822"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Installation"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/installations/{ref}/organisations/{organisation}":{"parameters":[{"$ref":"#/components/parameters/PartnerRefPath"},{"name":"organisation","in":"path","required":true,"schema":{"type":"string"},"description":"La référence de l'organisation."}],"post":{"tags":["Partenaires"],"operationId":"grantInstallationOrganisation","summary":"Autoriser une organisation","responses":{"200":{"description":"L'installation.","content":{"application/json":{"example":{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback EU","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821","client-4822","client-4823"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Installation"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"tags":["Partenaires"],"operationId":"withdrawInstallationOrganisation","summary":"Retirer une organisation","description":"Les sessions de l'installation sur cette organisation s'arrêtent.","responses":{"200":{"description":"L'installation.","content":{"application/json":{"example":{"id":"0193a642-5a6b-7c7d-9e8f-9a0b1c2d3e4f","ref":"serveur-eu-1","name":"Fastback EU","status":"active","permissions":["templates:read","templates:write","documents:generate"],"organisations":["client-4821"],"credentials":[{"id":"0193a643-6b7c-7d8e-8f9a-0b1c2d3e4f5a","prefix":"mzi_Wq8d","created_at":"2026-11-20T16:12:40+01:00","last_used_at":"2026-11-23T10:30:04+01:00","revoked":false}],"created_at":"2026-11-20T16:12:40+01:00"},"schema":{"$ref":"#/components/schemas/Installation"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/document-config":{"get":{"tags":["Partenaires"],"operationId":"listPartnerPolicies","summary":"La politique de chaque type","responses":{"200":{"description":"Les politiques, une par type.","content":{"application/json":{"example":{"data":[{"kind":"sales.order_form","default_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","distribution":"all","update_policy":"manual","allow_customization":true}]},"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PartnerPolicy"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/document-config/{kind}":{"parameters":[{"$ref":"#/components/parameters/Kind"}],"get":{"tags":["Partenaires"],"operationId":"getPartnerPolicy","summary":"La politique d'un type","responses":{"200":{"description":"La politique (les valeurs par défaut s'il n'y en a pas).","content":{"application/json":{"example":{"kind":"sales.order_form","default_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","distribution":"all","update_policy":"manual","allow_customization":true},"schema":{"$ref":"#/components/schemas/PartnerPolicy"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}},"put":{"tags":["Partenaires"],"operationId":"putPartnerPolicy","summary":"Régler la politique d'un type","description":"Ce qui n'est pas envoyé garde sa valeur. Le standard désigné doit être proposé, publié et du bon type.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"default_template":{"type":["string","null"]},"distribution":{"type":"string","enum":["all","none"]},"update_policy":{"type":"string","enum":["manual","automatic"]},"allow_customization":{"type":"boolean"}}}}}},"responses":{"200":{"description":"La politique.","content":{"application/json":{"example":{"kind":"sales.order_form","default_template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","distribution":"all","update_policy":"manual","allow_customization":true},"schema":{"$ref":"#/components/schemas/PartnerPolicy"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Invalid"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"tags":["Partenaires"],"operationId":"deletePartnerPolicy","summary":"Revenir aux valeurs par défaut","responses":{"204":{"description":"Fait."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/partner/workspaces":{"post":{"tags":["Partenaires"],"operationId":"openPartnerWorkspace","deprecated":true,"summary":"Ouvrir un espace client (forme historique)","description":"Remplacée par `POST /v1/partner/organisations`. Répond avec `Deprecation: true`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"ref":{"type":"string"}}}}}},"responses":{"200":{"description":"L'espace existait déjà (sans clé)."},"201":{"description":"L'espace ouvert, avec sa clé."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/me":{"get":{"tags":["Système"],"operationId":"me","summary":"Qui suis-je","description":"L'espace, la personne qui agit, la session et ce que le studio offre.\nLe plus simple pour vérifier une clé. C'est aussi la seule route\nqu'une installation sans aucune permission peut appeler.\n","parameters":[{"$ref":"#/components/parameters/Organisation"}],"responses":{"200":{"description":"Le contexte de l'appelant.","content":{"application/json":{"example":{"workspace":{"id":"0193a4f0-6b7c-7d8e-9f0a-1b2c3d4e5f60","name":"Garage Solvérac","status":"active","plan":"business","trial_ends_at":null,"pro_features":true,"partner":false,"sector":"automotive","templates":{"limit":null,"used":12},"team":true},"user":{"id":"0193a631-3f4a-7b5c-8d6e-7f8a9b0c1d2e","name":"Production","role":"admin","permissions":null},"organisation":{"ref":null},"installation":null,"session":null,"studio":{"…":"…"}},"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/public/health":{"get":{"tags":["Système"],"operationId":"health","summary":"État du service","security":[],"responses":{"200":{"description":"La base et le moteur PDF répondent.","content":{"application/json":{"example":{"status":"ok","database":true,"renderer":true,"version":"6d02d3bf"},"schema":{"$ref":"#/components/schemas/Health"}}}},"500":{"$ref":"#/components/responses/ServerError"},"503":{"description":"La base ou le moteur PDF ne répond pas.","content":{"application/json":{"example":{"status":"degraded","database":true,"renderer":false},"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/v1/public/status":{"get":{"tags":["Système"],"operationId":"status","summary":"Page de statut","description":"Ce que montre mizanpage.com/statut/ : l'état de l'API et de la génération des PDF maintenant, et la part des contrôles réussis chacun des 90 derniers jours (un contrôle toutes les 5 minutes, `null` pour un jour sans contrôle). Mis en cache une minute.","security":[],"responses":{"200":{"description":"L'état et l'historique.","content":{"application/json":{"example":{"status":"operational","checked_at":"2026-11-27T10:00:00+01:00","components":{"api":{"status":"up","uptime":99.98,"days":[{"date":"2026-11-26","uptime":100},{"date":"2026-11-27","uptime":99.31}]},"renderer":{"status":"up","uptime":99.95,"days":[{"date":"2026-11-26","uptime":100},{"date":"2026-11-27","uptime":98.62}]}}},"schema":{"$ref":"#/components/schemas/Status"}}}},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/public/openapi.json":{"get":{"tags":["Système"],"operationId":"openapi","summary":"Cette référence, au format OpenAPI","description":"Pour générer un client ou l'importer dans Postman, Insomnia ou Bruno.","security":[],"parameters":[{"name":"lang","in":"query","required":false,"schema":{"type":"string","enum":["en"]},"description":"`en` pour la version anglaise de cette référence (affichée sur `/docs/en`)."}],"responses":{"200":{"description":"Le document OpenAPI 3.1.","content":{"application/json":{"example":{"openapi":"3.1.0","info":{"title":"API Mizanpage","version":"v1"},"paths":{"…":"…"}},"schema":{"type":"object"}}}},"500":{"$ref":"#/components/responses/ServerError"}}}}},"webhooks":{"document.generated":{"post":{"tags":["Webhooks"],"operationId":"document_generated","summary":"Document généré","description":"Un document compté vient d'être généré (`POST /v1/render`). Une fois par document : la reprise d'un appel avec la même `Idempotency-Key` n'en envoie pas un second. Rien du contenu.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEvent"},{"type":"object","properties":{"type":{"const":"document.generated"},"data":{"$ref":"#/components/schemas/DocumentGeneratedData"}}}]},"example":{"id":"evt_019a8f3c2b7e7c41a2d5e9f0b1c3d4e5","type":"document.generated","timestamp":"2026-11-21T09:30:00Z","organisation":{"id":"7c9e6679-7425-40de-944b-e07fc1f90ae7","ref":"org-42"},"data":{"generation_id":"0193a5c1-2d3e-7f40-8a51-6b7c8d9e0f1a","template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture","kind":"invoice","version":4,"format":"pdf","api_key_id":"0193a4f0-1a2b-7c3d-8e4f-5a6b7c8d9e0f","created_at":"2026-11-21T09:30:00+01:00"}}}}},"responses":{"200":{"description":"Reçu. Toute réponse 2xx convient."}}}},"render.completed":{"post":{"tags":["Webhooks"],"operationId":"render_completed","summary":"PDF prêt","description":"Un rendu demandé avec `POST /v1/renders` est fait. `download_url` ouvre le PDF pendant une heure, sans clé. Rien des données envoyées.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEvent"},{"type":"object","properties":{"type":{"const":"render.completed"},"data":{"$ref":"#/components/schemas/RenderEventData"}}}]},"example":{"id":"evt_019a8f3c2b7e7c41a2d5e9f0b1c3d4e6","type":"render.completed","timestamp":"2026-11-23T09:30:04Z","organisation":{"id":"7c9e6679-7425-40de-944b-e07fc1f90ae7","ref":null},"data":{"render_id":"019ab3c1-2d3e-7f40-8a51-6b7c8d9e0f1a","status":"succeeded","reference":"Ligne 12","template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","template_version":4,"generation_id":"0193a5c1-2d3e-7f40-8a51-6b7c8d9e0f1a","download_url":"https://api.mizanpage.com/v1/public/renders/…","expires_at":"2026-11-23T11:30:04+01:00","error":null}}}}},"responses":{"200":{"description":"Reçu. Toute réponse 2xx convient."}}}},"render.failed":{"post":{"tags":["Webhooks"],"operationId":"render_failed","summary":"Rendu échoué","description":"Un rendu demandé avec `POST /v1/renders` n'a pas pu être fait (modèle retiré entre-temps, moteur PDF indisponible après plusieurs essais…). `error` dit pourquoi. Rien n'est compté.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEvent"},{"type":"object","properties":{"type":{"const":"render.failed"},"data":{"$ref":"#/components/schemas/RenderEventData"}}}]}}}},"responses":{"200":{"description":"Reçu. Toute réponse 2xx convient."}}}},"template.published":{"post":{"tags":["Webhooks"],"operationId":"template_published","summary":"Modèle publié","description":"Un modèle a une nouvelle version publiée : les documents l'impriment désormais.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEvent"},{"type":"object","properties":{"type":{"const":"template.published"},"data":{"$ref":"#/components/schemas/TemplateEventData"}}}]},"example":{"id":"evt_019a8f3c2b7e7c41a2d5e9f0b1c3d4e5","type":"template.published","timestamp":"2026-11-21T09:30:00Z","organisation":{"id":"7c9e6679-7425-40de-944b-e07fc1f90ae7","ref":"org-42"},"data":{"template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture","kind":"invoice","name":"Facture","version":4,"published_at":"2026-11-21T09:30:00+01:00","archived":false}}}}},"responses":{"200":{"description":"Reçu. Toute réponse 2xx convient."}}}},"template.archived":{"post":{"tags":["Webhooks"],"operationId":"template_archived","summary":"Modèle archivé","description":"Un modèle est retiré : votre logiciel ne peut plus imprimer avec lui (`409 template_archived`).","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEvent"},{"type":"object","properties":{"type":{"const":"template.archived"},"data":{"$ref":"#/components/schemas/TemplateEventData"}}}]},"example":{"id":"evt_019a8f3c2b7e7c41a2d5e9f0b1c3d4e5","type":"template.archived","timestamp":"2026-11-21T09:30:00Z","organisation":{"id":"7c9e6679-7425-40de-944b-e07fc1f90ae7","ref":"org-42"},"data":{"template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture","kind":"invoice","name":"Facture","version":4,"published_at":"2026-11-21T09:30:00+01:00","archived":true}}}}},"responses":{"200":{"description":"Reçu. Toute réponse 2xx convient."}}}},"template.restored":{"post":{"tags":["Webhooks"],"operationId":"template_restored","summary":"Modèle remis en service","description":"Un modèle archivé est rendu à votre logiciel.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEvent"},{"type":"object","properties":{"type":{"const":"template.restored"},"data":{"$ref":"#/components/schemas/TemplateEventData"}}}]},"example":{"id":"evt_019a8f3c2b7e7c41a2d5e9f0b1c3d4e5","type":"template.restored","timestamp":"2026-11-21T09:30:00Z","organisation":{"id":"7c9e6679-7425-40de-944b-e07fc1f90ae7","ref":"org-42"},"data":{"template_id":"0193a5b2-8f1e-7c3d-9a4b-5e6f7a8b9c0d","external_id":"facture","kind":"invoice","name":"Facture","version":4,"published_at":"2026-11-21T09:30:00+01:00","archived":false}}}}},"responses":{"200":{"description":"Reçu. Toute réponse 2xx convient."}}}},"webhook.test":{"post":{"tags":["Webhooks"],"operationId":"webhook_test","summary":"Événement de test","description":"Envoyé seulement par `POST /v1/webhooks/{id}/test`. `data.endpoint_id` nomme l'adresse.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Reçu."}}}}},"components":{"securitySchemes":{"jeton":{"type":"http","scheme":"bearer","description":"`mzp_…` (clé de votre serveur), `mzi_…` (installation d'un partenaire) ou `mzs_…` (session d'éditeur)."}},"parameters":{"Ref":{"name":"ref","in":"path","required":true,"schema":{"type":"string"},"description":"L'id Mizanpage du modèle, ou votre `external_id`."},"Kind":{"name":"kind","in":"path","required":true,"schema":{"type":"string","maxLength":100},"description":"La sorte de document, par exemple `sales.order_form`.","example":"sales.order_form"},"Id":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"PartnerRefPath":{"name":"ref","in":"path","required":true,"schema":{"$ref":"#/components/schemas/PartnerRef"},"description":"Votre propre référence."},"Organisation":{"name":"X-Mizanpage-Organisation","in":"header","required":false,"schema":{"type":"string"},"description":"Pour une installation (`mzi_`) seulement, la référence de l'organisation pour laquelle elle appelle."},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"description":"Votre numéro de commande ou un UUID, 200 caractères imprimables au plus. Pendant 24 heures, un second appel avec la même clé et les mêmes paramètres ne compte pas un second document ; avec d'autres paramètres, il est refusé (`422 idempotency_key_reused`).","example":"commande-2041"},"WebhookId":{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"L'id de l'adresse de webhook."},"AcceptLanguage":{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string","enum":["fr","en","nl","de"]},"description":"La langue des messages d'erreur."}},"responses":{"Unauthenticated":{"description":"Jeton absent, inconnu, révoqué ou expiré.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthenticated","message":"Jeton absent ou invalide."}}}}},"PaymentRequired":{"description":"L'offre de l'espace ne permet pas l'appel (essai à démarrer, espace suspendu, limite de l'offre). Rien n'est perdu.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"trial_over","message":"Votre essai est terminé : votre espace est en lecture seule. Choisissez une offre pour reprendre ; rien n'a été effacé."}}}}},"Forbidden":{"description":"Le jeton ne permet pas cet appel (rôle, permission, origine, organisation).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"role_required","message":"Cette action est réservée aux designers et aux administrateurs : votre rôle (opérateur) permet de remplir les champs et de générer des documents, pas de modifier les modèles.","details":{"role":"designer"}}}}}},"NotFound":{"description":"Absent, ou pas à vous (même réponse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"not_found","message":"Introuvable."}}}}},"Conflict":{"description":"L'état actuel empêche l'appel (modèle non publié ou archivé, modèle à choisir, organisation désactivée…).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"ambiguous_template","message":"Plusieurs modèles publiés pour ce type et pas de modèle par défaut.","details":{"candidates":["tpl_a","tpl_b"]}}}}}},"Invalid":{"description":"Une valeur est refusée ; `details.field` nomme le champ, jamais sa valeur.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"missing_fields","message":"Champs obligatoires sans valeur : Total.","details":{"fields":["commande.total"]}}}}}},"RateLimited":{"description":"Limite de débit atteinte.","headers":{"Retry-After":{"description":"Secondes à attendre avant de réessayer : le temps qu'une place se libère dans la fenêtre de la limite.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Trop de demandes en peu de temps. Réessayez dans quelques minutes."}}}}},"Unavailable":{"description":"Le moteur PDF ne répond pas ou est saturé. Réessayez dans quelques secondes.","headers":{"Retry-After":{"description":"Secondes à attendre avant de réessayer : 5 pour un moteur saturé, 30 pour un moteur qui ne répond pas.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"renderer_busy","message":"Le service de rendu est occupé par d’autres documents. Réessayez dans quelques secondes."}}}}},"Gone":{"description":"Le PDF n'est plus là : son heure est passée, ou le lien n'est pas valable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"render_expired","message":"Ce lien de téléchargement a expiré, ou le PDF a déjà été supprimé."}}}}},"BadRequest":{"description":"Le corps n'est pas un objet JSON lisible (JSON mal formé, tableau, texte).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_body","message":"Le corps de la requête doit être un objet JSON."}}}}},"PayloadTooLarge":{"description":"Le corps pèse plus de 20 Mo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"payload_too_large","message":"Cette requête est trop lourde (20 Mo au plus)."}}}}},"ServerError":{"description":"Une erreur de notre côté, enregistrée chez nous. Même forme que les autres erreurs, sans détail technique. Réessayez plus tard ; un `POST /v1/render` avec la même `Idempotency-Key` ne compte jamais deux documents.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Une erreur inattendue s'est produite de notre côté. Réessayez dans un instant ; si elle se répète, écrivez à contact@mizanpage.com."}}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","description":"Stable, à tester dans votre code."},"message":{"type":"string","description":"Lisible, dans la langue d'`Accept-Language`."},"details":{"type":"object","additionalProperties":true}}}}},"Permission":{"type":"string","enum":["templates:read","templates:write","templates:configure","documents:generate"],"description":"`templates:read` : ouvrir le studio, voir, aperçus gratuits.\n`documents:generate` : un PDF final, compté.\n`templates:write` : créer, modifier, publier des modèles.\n`templates:configure` : modèle par défaut, mode de sélection, versions des standards.\n"},"PartnerRef":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,100}$","description":"Votre propre référence (lettres, chiffres, `.`, `_`, `:`, `-`)."},"KeptDocument":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"template_id":{"type":"string","nullable":true},"template_name":{"type":"string"},"kind":{"type":"string"},"version":{"type":"integer","nullable":true},"source":{"type":"string","enum":["app","api"]},"created_by":{"type":"string"},"size":{"type":"integer","description":"Taille du PDF en octets."},"generation_id":{"type":"string","description":"La ligne de consommation du document."},"created_at":{"type":"string","format":"date-time"},"share":{"$ref":"#/components/schemas/ShareLink"}}},"ShareLink":{"type":"object","nullable":true,"properties":{"url":{"type":"string","nullable":true,"description":"L'adresse publique ; nulle si elle ne peut plus être affichée."},"expires_at":{"type":"string","format":"date-time"},"expired":{"type":"boolean"},"views":{"type":"integer","description":"Nombre d'ouvertures."},"last_viewed_at":{"type":"string","format":"date-time","nullable":true},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}},"RenderJobRequest":{"allOf":[{"$ref":"#/components/schemas/RenderRequest"},{"type":"object","properties":{"format":{"type":"string","enum":["pdf"],"description":"Toujours `pdf` (la valeur par défaut ici)."},"reference":{"type":["string","null"],"maxLength":200,"description":"Votre nom pour ce rendu (numéro de commande, ligne d'un tableau), rendu avec le résultat et dans le webhook. Il sert aussi de nom au fichier téléchargé."},"callback_url":{"type":["string","null"],"format":"uri","maxLength":500,"description":"Une adresse https prévenue quand le rendu est fait ou échoue, en plus des webhooks."}}}]},"RenderJob":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","processing","succeeded","failed"]},"reference":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"finished_at":{"type":["string","null"],"format":"date-time"},"template_id":{"type":["string","null"]},"template_version":{"type":["integer","null"]},"generation_id":{"type":["string","null"],"description":"La ligne de consommation, comme `X-Mizanpage-Generation` (absente pour une clé de test)."},"document_id":{"type":["string","null"],"description":"Le document conservé dans « Mes documents », quand l'espace garde les documents de l'API."},"test":{"type":"boolean","description":"Un PDF de clé de test, filigrané et non compté."},"size":{"type":["integer","null"],"description":"Taille du PDF en octets."},"download_url":{"type":["string","null"],"format":"uri","description":"Le lien du PDF, sans clé, tant qu'il est gardé."},"expires_at":{"type":["string","null"],"format":"date-time","description":"Jusqu'à quand le PDF peut être téléchargé."},"error":{"type":["object","null"],"properties":{"code":{"type":"string","example":"template_archived"},"message":{"type":"string"}}}}},"RenderEventData":{"allOf":[{"$ref":"#/components/schemas/RenderJob"},{"type":"object","properties":{"render_id":{"type":"string","description":"L'id du rendu (à la place de `id`)."}}}]},"Facturx":{"type":"object","description":"La facture en données structurées : le PDF devient une facture\nFactur-X (PDF/A-3, `factur-x.xml` au profil EN 16931). Sans cet\nobjet, un modèle réglé sur « Joindre les données Factur-X » lit la\nfacture dans `data.values`, par les clés des factures de la\nbibliothèque (`facture.numero`, `emetteur.tva`, `lignes`…).\n\nLes montants et les dates s'écrivent en nombres et au format ISO, ou\ntels qu'ils sont imprimés (« 2 400,00 € », « 21 octobre 2026 »). La\nTVA par taux se calcule à partir des lignes quand elle n'est pas\ndonnée. Chaque total donné est vérifié : une facture qui ne tombe\npas juste est refusée avant le rendu (`422 facturx_invalid`, chaque\nproblème avec son champ dans `details.problems`), sans être comptée.\n\nFactur-X sert en France et en Allemagne (ZUGFeRD). En Belgique, elle\nne remplace pas Peppol.\n","required":["number","issue_date","seller","buyer","lines"],"properties":{"type":{"type":"string","enum":["invoice","credit_note"],"description":"Facture (380, par défaut) ou note de crédit (381)."},"number":{"type":"string"},"issue_date":{"type":"string","example":"2026-10-21"},"due_date":{"type":"string","description":"L'échéance. Elle ou `payment_terms` est requise quand il reste un montant à payer."},"currency":{"type":"string","example":"EUR","description":"Code ISO 4217, EUR par défaut."},"payment_terms":{"type":"string"},"purchase_order":{"type":"string","description":"Votre référence de commande."},"buyer_reference":{"type":"string"},"note":{"type":"string"},"vat_category":{"type":"string","enum":["S","Z","E","AE","K","G","O","L","M"],"description":"La catégorie de TVA par défaut des lignes : S quand le taux est positif, E (exonéré) à 0 %."},"vat_exemption_reason":{"type":"string","description":"La mention d'exonération, requise pour les catégories E, AE, K, G et O."},"seller":{"$ref":"#/components/schemas/FacturxParty"},"buyer":{"$ref":"#/components/schemas/FacturxParty"},"lines":{"type":"array","maxItems":1000,"items":{"type":"object","required":["name","vat_rate"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"quantity":{"description":"1 par défaut."},"unit":{"type":"string","description":"Code d'unité UN/ECE (HUR, DAY, C62 par défaut)."},"unit_price":{"description":"Prix unitaire hors TVA."},"vat_rate":{"description":"Taux de TVA en pour cent (21, « 21 % »)."},"vat_category":{"type":"string"},"net_amount":{"description":"Total hors TVA de la ligne ; calculé (quantité × prix) s'il manque."}}}},"vat_breakdown":{"type":"array","description":"La TVA par taux telle qu'imprimée. Facultative.","items":{"type":"object","properties":{"rate":[],"basis":[],"amount":[],"exemption_reason":{"type":"string"}}}},"totals":{"type":"object","description":"Les totaux imprimés, vérifiés. `prepaid` est l'acompte déjà reçu.","properties":{"net":[],"vat":[],"gross":[],"prepaid":[],"due":[]}},"payment":{"type":"object","properties":{"iban":{"type":"string"},"bic":{"type":"string"},"reference":{"type":"string","description":"La communication du virement."}}}}},"FacturxParty":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"vat_id":{"type":"string","description":"Le numéro de TVA (« BE 0700.000.101 » est accepté). Requis pour le vendeur dès qu'une ligne porte de la TVA."},"legal_id":{"type":"string","description":"Le numéro d'entreprise."},"email":{"type":"string"},"address":{"type":"object","required":["country"],"properties":{"line1":{"type":"string"},"line2":{"type":"string"},"postcode":{"type":"string"},"city":{"type":"string"},"country":{"type":"string","description":"Code ISO à deux lettres ; déduit du numéro de TVA s'il manque."}}}}},"RenderRequest":{"type":"object","properties":{"template":{"type":"string","description":"L'id ou l'`external_id` du modèle. Facultatif avec `kind`."},"kind":{"type":"string","description":"La sorte de document ; sans `template`, Mizanpage choisit le modèle."},"format":{"type":"string","enum":["pdf","html","pages"],"description":"Écrivez toujours `pdf`. `html` (la valeur par défaut) et `pages` sont réservés à l'éditeur."},"version":{"description":"`published` (défaut). Un numéro demande une version publiée précise.","oneOf":[{"type":"string","enum":["published","draft"]},{"type":"integer"}]},"strict":{"type":"boolean","description":"Refuser le document (`422 missing_fields`) quand un champ obligatoire du catalogue est vide."},"name":{"type":"string","maxLength":200,"description":"Le nom du document dans « Mes documents », quand l'espace le conserve. Par défaut, le nom du modèle."},"show_empty":{"type":"boolean","description":"Montrer le libellé d'un champ vide au lieu de le faire disparaître."},"facturx":{"$ref":"#/components/schemas/Facturx"},"data":{"type":"object","description":"Sans `data`, les valeurs d'exemple du catalogue.","properties":{"values":{"type":"object","additionalProperties":true,"description":"Les valeurs déjà formatées, par clé du catalogue. Les lignes\nd'un champ `list` voyagent sous sa clé, un objet par ligne\n(5 000 lignes au plus).\n"},"logo":{"type":"string","description":"Une image en data URI (8 Mo au plus). Mizanpage ne va jamais chercher une URL."},"photos":{"type":"array","items":{"type":"string"},"description":"Des images en data URI."},"language":{"type":"string","enum":["fr","en","nl","de"],"description":"fr, en, nl ou de : les textes d'un modèle en plusieurs langues et les séparateurs des nombres de ses graphiques. Absent : la langue principale du modèle."}}}}},"CatalogField":{"type":"object","required":["key","label"],"properties":{"key":{"type":"string","description":"Unique dans le catalogue, par exemple `order.total`. Sans point pour une colonne de liste."},"label":{"type":"string"},"type":{"type":"string","enum":["text","longtext","amount","date","list"],"default":"text","description":"Guide l'éditeur ; les valeurs arrivent déjà formatées."},"fields":{"type":"array","description":"Pour un champ `list`, ses colonnes (douze au plus).","items":{"$ref":"#/components/schemas/CatalogField"}}}},"CatalogInput":{"type":"object","required":["label","groups"],"properties":{"label":{"type":"string"},"groups":{"type":"array","items":{"type":"object","required":["key","label","fields"],"properties":{"key":{"type":"string"},"label":{"type":"string"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/CatalogField"}}}}},"required":{"type":"array","description":"Les champs qu'un modèle publié ne peut jamais perdre.","items":{"type":"object","properties":{"key":{"type":"string"},"reason":{"type":"string"}}}},"requiredBlocks":{"type":"array","items":{"type":"string","enum":["signature"]}},"maxPhotos":{"type":"integer","minimum":0},"sample":{"type":"object","additionalProperties":true,"description":"Ce que l'éditeur affiche en aperçu."}}},"Catalog":{"allOf":[{"$ref":"#/components/schemas/CatalogInput"},{"type":"object","properties":{"kind":{"type":"string"},"origin":{"type":"string","enum":["organisation","partner"]},"editable":{"type":"boolean","description":"Créé dans le studio, modifiable depuis l'éditeur."}}}]},"Template":{"type":"object","properties":{"id":{"type":"string"},"external_id":{"type":["string","null"]},"name":{"type":"string"},"kind":{"type":"string"},"folder_id":{"type":["string","null"]},"version":{"type":"integer","description":"Le nombre de publications."},"published":{"type":"boolean"},"has_draft":{"type":"boolean"},"private":{"type":"boolean","description":"Jamais publié et visible de la seule personne qui l’a créé ; faux dès la première publication."},"updated_by":{"type":["string","null"]},"updated_at":{"type":"string","format":"date-time"},"published_by":{"type":["string","null"]},"published_at":{"type":["string","null"],"format":"date-time"},"offered_to_customers":{"type":"boolean"},"source_id":{"type":["string","null"]},"source_version":{"type":["integer","null"]},"numbering":{"type":["object","null"],"description":"« Numéroter automatiquement » d'une génération depuis un fichier, dans le studio : le champ numéroté, son préfixe, son nombre de chiffres et le prochain numéro.","properties":{"field":{"type":"string"},"prefix":{"type":"string"},"width":{"type":"integer"},"next":{"type":"integer"}}},"archived":{"type":"boolean"},"archived_at":{"type":["string","null"],"format":"date-time"},"uses":{"type":"object","description":"Ce que le design publié imprime, pour n'envoyer que ça.","properties":{"keys":{"type":"array","items":{"type":"string"}},"logo":{"type":"boolean","description":"Un bloc Logo attend le logo envoyé avec `data.logo` (aucun logo de l'identité de marque choisi)."},"photos":{"type":"integer"},"attachments":{"type":"integer"}}},"design":{"type":["object","null"],"description":"Le design publié (lecture d'un modèle)."},"draft":{"type":["object","null"],"description":"Le brouillon (lecture d'un modèle)."}}},"TemplateTranslations":{"type":"object","required":["template","main","languages","texts","translations","missing"],"properties":{"template":{"$ref":"#/components/schemas/Template"},"main":{"type":["string","null"],"description":"La langue principale ; `null` pour un modèle en une seule langue."},"languages":{"type":"array","items":{"type":"string"}},"texts":{"type":"object","additionalProperties":{"type":"string"},"description":"Chaque texte imprimé, par emplacement, dans la langue principale."},"translations":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"string"}}},"missing":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"Les emplacements sans traduction, par langue."}}},"TemplateVersion":{"type":"object","properties":{"version":{"type":"integer"},"published_at":{"type":["string","null"],"format":"date-time"},"published_by":{"type":["string","null"]},"current":{"type":"boolean","description":"La version en ligne, celle que les documents impriment."}}},"Availability":{"type":"object","properties":{"kind":{"type":"string"},"label":{"type":"string"},"selection_mode":{"type":"string","enum":["automatic","optional","required"]},"default_template_id":{"type":["string","null"]},"resolved_template_id":{"type":["string","null"],"description":"Ce qu'un appel sans `template` recevrait."},"resolved_version":{"type":["integer","null"]},"resolution_error":{"type":["string","null"],"description":"Le code d'erreur qu'un appel sans `template` recevrait."},"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"external_id":{"type":["string","null"]},"name":{"type":"string"},"kind":{"type":"string"},"published":{"type":"boolean"},"version":{"type":"integer"},"origin":{"type":"string","enum":["organisation","partner"]},"is_default":{"type":"boolean"},"usable":{"type":"boolean","description":"Un appel qui le nomme recevrait un PDF."}}}}}},"DocumentConfig":{"type":"object","properties":{"kind":{"type":"string"},"label":{"type":"string"},"selection_mode":{"type":"string","enum":["automatic","optional","required"]},"default_template_id":{"type":["string","null"]},"resolved_template_id":{"type":["string","null"]},"resolved_by":{"type":["string","null"],"enum":["requested","organisation_default","only_template",null]},"resolution_error":{"type":["string","null"]}}},"EditorSessionRequest":{"type":"object","required":["user"],"properties":{"user":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","maxLength":100,"description":"L'identifiant stable de la personne chez vous."},"name":{"type":"string","description":"Le nom affiché dans « modifié par »."}}},"kind":{"type":"string","description":"Limite la session à cette sorte de document."},"template":{"type":"string","description":"Ouvre l'éditeur directement sur ce modèle."},"ttl":{"type":"integer","minimum":60,"maximum":28800,"default":3600,"description":"En secondes. Session déléguée : 900 par défaut, 3 600 au plus."},"language":{"type":"string","enum":["fr","en","nl","de"]},"role":{"type":"string","enum":["designer","operator"],"default":"designer"},"permissions":{"type":"array","description":"Session déléguée, à la place de `role`. `templates:read` est obligatoire.","items":{"$ref":"#/components/schemas/Permission"}},"organisation":{"type":"string","description":"Session déléguée, la référence de l'organisation."},"origin":{"type":"string","format":"uri","description":"L'origine de la page qui intègre l'éditeur, sans chemin."},"appearance":{"$ref":"#/components/schemas/Appearance"}}},"Appearance":{"type":"object","description":"L'allure de l'éditeur dans votre logiciel, signée dans le jeton.","properties":{"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","description":"La couleur des actions, assez sombre pour un texte blanc (contraste 4,5:1)."},"font":{"type":"string","enum":["system","inter","manrope","plus-jakarta-sans"]},"radius":{"type":"integer","minimum":0,"maximum":16},"brand":{"type":"boolean","default":true,"description":"`false` masque la marque Mizanpage (offre Mizanpage Entreprise et organisations d'un partenaire)."},"pdf":{"type":"string","enum":["download","host"],"default":"download","description":"`host` : votre page seule reçoit le PDF final."}}},"EditorSession":{"type":"object","properties":{"id":{"type":"string","description":"Pour fermer la session avant son expiration."},"session_id":{"type":"string"},"token":{"type":"string","description":"Le jeton `mzs_…`, déjà dans l'`url`."},"role":{"type":"string","enum":["designer","operator"]},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}},"organisation":{"type":"object","properties":{"ref":{"type":"string"},"name":{"type":"string"}}},"url":{"type":"string","format":"uri","description":"Le lien à mettre dans une iframe ou un onglet."},"expires_at":{"type":"string","format":"date-time"}}},"WebhookEventType":{"type":"string","enum":["document.generated","render.completed","render.failed","template.published","template.archived","template.restored"]},"WebhookEndpointInput":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":500,"example":"https://erp.example.com/hooks/mizanpage"},"events":{"type":"array","minItems":1,"items":{"oneOf":[{"$ref":"#/components/schemas/WebhookEventType"},{"type":"string","const":"*"}]},"default":["*"]},"description":{"type":["string","null"],"maxLength":120}}},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}}},"WebhookEndpointWithSecret":{"allOf":[{"$ref":"#/components/schemas/WebhookEndpoint"},{"type":"object","properties":{"secret":{"type":"string","description":"Le secret de signature, `whsec_` suivi de 32 octets en base64. Montré une seule fois.","example":"whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"}}}]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","description":"Le `webhook-id` reçu par l'adresse, le même à chaque tentative."},"event_id":{"type":"string"},"type":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"response_status":{"type":["integer","null"],"description":"Le statut HTTP de la dernière réponse."},"error":{"type":["string","null"],"description":"L'erreur réseau de la dernière tentative."},"created_at":{"type":"string","format":"date-time"},"last_attempt_at":{"type":["string","null"],"format":"date-time"},"next_attempt_at":{"type":["string","null"],"format":"date-time"},"payload":{"$ref":"#/components/schemas/WebhookEvent"}}},"WebhookEvent":{"type":"object","required":["id","type","timestamp","organisation","data"],"properties":{"id":{"type":"string","example":"evt_019a8f3c2b7e7c41a2d5e9f0b1c3d4e5"},"type":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"organisation":{"type":"object","description":"L'espace concerné ; `ref` est la référence du partenaire qui l'a ouvert, sinon `null`.","properties":{"id":{"type":"string"},"ref":{"type":["string","null"]}}},"data":{"type":"object","additionalProperties":true}}},"TemplateEventData":{"type":"object","properties":{"template_id":{"type":"string"},"external_id":{"type":["string","null"]},"kind":{"type":"string"},"name":{"type":"string"},"version":{"type":["integer","null"],"description":"La version publiée, celle qu'impriment les documents."},"published_at":{"type":["string","null"],"format":"date-time"},"archived":{"type":"boolean"}}},"DocumentGeneratedData":{"type":"object","properties":{"generation_id":{"type":"string","description":"Le même que `X-Mizanpage-Generation`."},"template_id":{"type":["string","null"]},"external_id":{"type":["string","null"]},"kind":{"type":["string","null"]},"version":{"type":["integer","null"]},"format":{"type":"string","example":"pdf"},"api_key_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}}},"EmbedOrigins":{"type":"object","required":["origins"],"properties":{"origins":{"type":"array","maxItems":20,"items":{"type":"string","format":"uri"}}}},"Standard":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string"},"version":{"type":"integer","description":"La version imprimée ici."},"latest_version":{"type":"integer"},"adopted_version":{"type":["integer","null"]},"update_policy":{"type":"string","enum":["manual","automatic"]},"update_available":{"type":"boolean"},"customizable":{"type":"boolean"},"personalisations":{"type":"array","items":{"type":"object"}},"versions":{"type":"array","items":{"type":"object"}}}},"Organisation":{"type":"object","properties":{"id":{"type":"string"},"ref":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"deactivated_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"OrganisationEnvelope":{"type":"object","properties":{"organisation":{"$ref":"#/components/schemas/Organisation"},"api_key":{"type":"string","description":"Avec `issue_key: true` seulement, montré une fois."},"api_key_id":{"type":"string"}}},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"prefix":{"type":"string"},"test":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"},"revoked":{"type":"boolean"}}},"Installation":{"type":"object","properties":{"id":{"type":"string"},"ref":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}},"organisations":{"type":"array","items":{"type":"string"}},"credentials":{"type":"array","items":{"type":"object"}},"created_at":{"type":"string","format":"date-time"}}},"InstallationEnvelope":{"type":"object","properties":{"installation":{"$ref":"#/components/schemas/Installation"},"credential":{"type":"string","description":"Le secret `mzi_…`, à la création seulement."},"credential_id":{"type":"string"}}},"PartnerPolicy":{"type":"object","properties":{"kind":{"type":"string"},"default_template_id":{"type":["string","null"]},"distribution":{"type":"string","enum":["all","none"]},"update_policy":{"type":"string","enum":["manual","automatic"]},"allow_customization":{"type":"boolean"}}},"Me":{"type":"object","properties":{"workspace":{"type":"object","additionalProperties":true},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"permissions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Permission"}}}},"organisation":{"type":["object","null"]},"installation":{"type":["object","null"]},"session":{"type":["object","null"]},"studio":{"type":"object","description":"Les blocs, polices et formats de page offerts."}}},"Status":{"type":"object","properties":{"status":{"type":"string","enum":["operational","degraded","down"]},"checked_at":{"type":"string","format":"date-time"},"components":{"type":"object","properties":{"api":{"$ref":"#/components/schemas/StatusComponent"},"renderer":{"$ref":"#/components/schemas/StatusComponent"}}}}},"StatusComponent":{"type":"object","properties":{"status":{"type":"string","enum":["up","down"]},"uptime":{"type":["number","null"]},"days":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"uptime":{"type":["number","null"]}}}}}},"Health":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"database":{"type":"boolean"},"renderer":{"type":"boolean"},"version":{"type":["string","null"],"description":"Le commit en service (null hors production)."}}}}}}