{"openapi":"3.1.0","info":{"title":"Sculdoc API","version":"1.0.0","description":"PDF generation from versioned templates. Users sign in with OIDC (MyEQ, Supscale) and work inside an organization; applications call the API with an organization API key (`x-api-key`). Every resource is scoped to one organization."},"servers":[{"url":"/v1"}],"components":{"securitySchemes":{"session":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"Session cookie set by the OIDC sign-in (POST /api/auth/sign-in/social)"},"apiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"Organization API key (also accepted as `Authorization: Bearer sk_…`)"}},"schemas":{"Organization":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"slug":{"type":"string"},"name":{"type":"string"},"logo":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","slug","name","logo","createdAt"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","example":"validation"},"message":{"type":"string"},"path":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","example":"$.items[2].total"},"message":{"type":"string"}},"required":["path","message"]}},"retryAfter":{"type":"integer","description":"429: seconds before the same request may succeed (also in the `Retry-After` header)"}},"required":["code","message","issues"]},"requestId":{"type":"string"}},"required":["error","requestId"]},"CurrentOrganization":{"allOf":[{"$ref":"#/components/schemas/Organization"},{"type":"object","properties":{"settings":{"$ref":"#/components/schemas/OrganizationSettings"}},"required":["settings"]}]},"OrganizationSettings":{"type":"object","properties":{"requirePinnedVersion":{"type":"boolean","description":"API keys must name a version number: `version: latest` is refused (422 `version.unpinned`) instead of answered with a warning"},"keepRenderData":{"type":"boolean","description":"Keep the data of each render (encrypted at rest) for `retention.renderDataDays`: POST /renders/{id}/verify then needs no data"},"allowRaw":{"type":"boolean","description":"Templates may contain `raw` nodes (Typst code, expert mode of the editor); refused by default (422 `raw.forbidden` when a draft is saved, published or previewed)"},"retention":{"$ref":"#/components/schemas/Retention"},"exports":{"$ref":"#/components/schemas/ExportSettings"}},"required":["requirePinnedVersion","keepRenderData","allowRaw","retention","exports"]},"Retention":{"type":"object","properties":{"documentsDays":{"type":"integer","description":"Stored PDFs are deleted after this many days (render `expired`, manifest kept), except for templates with `meta.retention: legal`"},"renderDataDays":{"type":"integer","description":"Render data (kept snapshots, data of jobs) is deleted after this many days"},"legalHoldCoversData":{"type":"boolean","description":"`true`: the legal hold of a template (`meta.retention: legal`) also keeps the data of its renders; by default it keeps the document only"}},"required":["documentsDays","renderDataDays","legalHoldCoversData"]},"ExportSettings":{"type":"object","properties":{"csvDelimiter":{"type":"string","enum":[",",";"],"description":"Separator of the CSV exports of the journal (GET /renders/export, GET /jobs/export); `;` for spreadsheets in French"}},"required":["csvDelimiter"]},"Member":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"userId":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"source":{"type":"string","description":"`oidc` memberships follow the claims at each sign-in"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","userId","name","email","role","source","createdAt"]},"Role":{"type":"string","enum":["owner","admin","editor","viewer"]},"ProviderMapping":{"type":"object","properties":{"rules":{"type":"array","items":{"$ref":"#/components/schemas/MappingRule"},"maxItems":50},"defaultRole":{"anyOf":[{"$ref":"#/components/schemas/Role"},{"type":"null"}],"description":"Role when no rule matches; null = no membership"},"platformAdmin":{"type":"boolean","description":"Platform administrators only"},"provider":{"type":"string"}},"required":["rules","defaultRole","platformAdmin","provider"]},"MappingRule":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":100,"example":"erp_role"},"equals":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"contains":{"anyOf":[{"type":"string"},{"type":"number"}]},"role":{"$ref":"#/components/schemas/Role"}},"required":["claim","role"]},"Usage":{"type":"object","properties":{"quotas":{"$ref":"#/components/schemas/Quotas"},"usage":{"type":"object","properties":{"rendersLastMinute":{"type":"integer"},"pagesLast24Hours":{"type":"integer"},"storageBytes":{"type":"integer"},"batchItemsQueued":{"type":"integer"},"batchItemsRunning":{"type":"integer"}},"required":["rendersLastMinute","pagesLast24Hours","storageBytes","batchItemsQueued","batchItemsRunning"]}},"required":["quotas","usage"]},"Quotas":{"type":"object","properties":{"rendersPerMinute":{"type":"integer","description":"Renders started in a sliding minute"},"pagesPerDay":{"type":"integer","description":"Pages rendered in a sliding 24 hours"},"storageBytes":{"type":"integer","description":"Documents and batch outputs stored"},"batchMaxItems":{"type":"integer","description":"Items of one batch job"},"batchConcurrency":{"type":"integer","description":"Items of the organization rendering at once"}},"required":["rendersPerMinute","pagesPerDay","storageBytes","batchMaxItems","batchConcurrency"]},"Folder":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"parentId":{"type":["string","null"],"minLength":1,"maxLength":64},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","parentId","name","createdAt","updatedAt"]},"Template":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"folderId":{"type":["string","null"],"minLength":1,"maxLength":64},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","folderId","slug","name","description","createdAt","updatedAt"]},"VersionSummary":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["integer","null"],"description":"null while draft"},"status":{"type":"string","enum":["draft","published","deprecated","archived"]},"changelog":{"type":["string","null"]},"contentHash":{"type":["string","null"]},"rollbackOf":{"type":["integer","null"]},"publishedBy":{"type":["string","null"]},"publishedAt":{"type":["string","null"],"format":"date-time"},"deprecatedAt":{"type":["string","null"],"format":"date-time"},"archivedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"revision":{"type":"integer","description":"Draft: incremented by every save (see `ETag`)"},"updatedBy":{"type":["string","null"],"description":"Last author of the draft (user id)"}},"required":["id","number","status","changelog","contentHash","rollbackOf","publishedBy","publishedAt","deprecatedAt","archivedAt","createdAt","updatedAt","revision","updatedBy"]},"Version":{"allOf":[{"$ref":"#/components/schemas/VersionSummary"},{"type":"object","properties":{"ir":{"type":"object","additionalProperties":{},"description":"SDM document (packages/model)"},"dataSchema":{"type":["object","null"],"additionalProperties":{},"description":"JSON Schema 2020-12 of the data"},"samples":{"type":"array","items":{"$ref":"#/components/schemas/Sample"}},"fingerprints":{"type":["object","null"],"additionalProperties":{}},"engine":{"type":["object","null"],"properties":{"typst":{"type":"string"},"codegen":{"type":"string"},"sdm":{"type":"string"}},"required":["typst","codegen","sdm"]},"lock":{"anyOf":[{"$ref":"#/components/schemas/DraftLock"},{"type":"null"}],"description":"Draft only: who is editing it (soft lock, information only)"}},"required":["ir","dataSchema","samples","fingerprints","engine"]}]},"Sample":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^/\\\\]+$","example":"facture-standard"},"data":{}},"required":["name"]},"DraftLock":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}},"required":["userId","name","email","expiresAt"]},"DraftConflict":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"current":{"anyOf":[{"$ref":"#/components/schemas/Version"},{"type":"null"}],"description":"The draft as it is now (null: no draft any more)"}},"required":["current"]}]},"DraftLockState":{"type":"object","properties":{"acquired":{"type":"boolean","description":"The caller holds the lock after this call"},"lock":{"anyOf":[{"$ref":"#/components/schemas/DraftLock"},{"type":"null"}]},"ttlSeconds":{"type":"integer","description":"Validity of the lock without heartbeat"}},"required":["acquired","lock","ttlSeconds"]},"PublishedVersion":{"allOf":[{"$ref":"#/components/schemas/Version"},{"type":"object","properties":{"warnings":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]},"description":"Reported without refusing the publication: font families substituted"}},"required":["warnings"]}]},"VersionDiff":{"type":"object","properties":{"from":{"type":"object","properties":{"number":{"type":["number","null"]},"status":{"type":"string","enum":["draft","published","deprecated","archived"]},"contentHash":{"type":["string","null"]}},"required":["number","status","contentHash"]},"to":{"type":"object","properties":{"number":{"type":["number","null"]},"status":{"type":"string","enum":["draft","published","deprecated","archived"]},"contentHash":{"type":["string","null"]}},"required":["number","status","contentHash"]},"ir":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"kind":{"type":"string","enum":["added","removed","changed","moved"]},"parent":{"type":"string"}},"required":["id","type","kind","parent"]}},"sections":{"type":"array","items":{"type":"string"}},"identical":{"type":"boolean"}},"required":["nodes","sections","identical"]},"schema":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"kind":{"type":"string","enum":["added","removed","type-changed","required-added","required-removed"]},"breaking":{"type":"boolean"},"from":{},"to":{}},"required":["path","kind","breaking"]}},"breaking":{"type":"boolean"}},"required":["from","to","ir","schema","breaking"]},"PublicationCheck":{"type":"object","properties":{"valid":{"type":"boolean"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]},"description":"Why the publication would be refused (JSON paths)"},"warnings":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]},"description":"Font families that would be substituted"},"contentHash":{"type":["string","null"],"description":"Content hash the publication would freeze"},"against":{"type":["object","null"],"properties":{"number":{"type":["number","null"]},"status":{"type":"string","enum":["draft","published","deprecated","archived"]},"contentHash":{"type":["string","null"]}},"required":["number","status","contentHash"],"description":"Version compared with; null: no such version"},"unchanged":{"type":"boolean","description":"Publishing would freeze the same content as `against`"},"diff":{"type":["object","null"],"properties":{"ir":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"kind":{"type":"string","enum":["added","removed","changed","moved"]},"parent":{"type":"string"}},"required":["id","type","kind","parent"]}},"sections":{"type":"array","items":{"type":"string"}},"identical":{"type":"boolean"}},"required":["nodes","sections","identical"]},"schema":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"kind":{"type":"string","enum":["added","removed","type-changed","required-added","required-removed"]},"breaking":{"type":"boolean"},"from":{},"to":{}},"required":["path","kind","breaking"]}},"breaking":{"type":"boolean"}},"required":["ir","schema","breaking"]},"derivedSchema":{"type":["object","null"],"additionalProperties":{},"description":"JSON Schema derived from the template and the samples, reported even when other issues refuse the publication; null when it cannot be derived (invalid document, unresolved includes or assets, compilation error)"},"dataSchema":{"type":["object","null"],"additionalProperties":{},"description":"Data contract the publication would freeze (the author's schema, else the derived one); null when refused"}},"required":["valid","issues","warnings","contentHash","against","unchanged","diff","derivedSchema","dataSchema"]},"DataSchema":{"type":"object","additionalProperties":{}},"VersionDocs":{"type":"object","properties":{"template":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"}},"required":["id","slug","name","description"]},"version":{"type":"object","properties":{"number":{"type":["integer","null"]},"status":{"type":"string","enum":["draft","published","deprecated","archived"]},"changelog":{"type":["string","null"]},"contentHash":{"type":["string","null"]},"rollbackOf":{"type":["integer","null"]},"publishedAt":{"type":["string","null"],"format":"date-time"},"deprecatedAt":{"type":["string","null"],"format":"date-time"},"archivedAt":{"type":["string","null"],"format":"date-time"}},"required":["number","status","changelog","contentHash","rollbackOf","publishedAt","deprecatedAt","archivedAt"]},"title":{"type":"string"},"profile":{"type":"string"},"engine":{"type":["object","null"],"properties":{"typst":{"type":"string"},"codegen":{"type":"string"},"sdm":{"type":"string"}},"required":["typst","codegen","sdm"]},"fonts":{"type":"array","items":{"type":"object","properties":{"family":{"type":"string"},"scope":{"type":"string","enum":["organization","platform"]},"hashes":{"type":"array","items":{"type":"string"}},"substitute":{"type":"string"}},"required":["family","scope","hashes"]}},"history":{"type":"array","items":{"type":"object","properties":{"number":{"type":"integer"},"status":{"type":"string","enum":["draft","published","deprecated","archived"]},"changelog":{"type":"string"},"publishedAt":{"type":["string","null"],"format":"date-time"}},"required":["number","status","changelog","publishedAt"]}},"schema":{"type":"object","properties":{"jsonSchema":{"type":"object","additionalProperties":{}},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","example":"$.lines[].qty"},"type":{"type":"string"},"required":{"type":"boolean","description":"In its parent object"},"description":{"type":"string"},"format":{"type":"string"},"enum":{"type":"array","items":{}},"examples":{"type":"array","items":{},"description":"Values taken from the samples"}},"required":["path","type","required","examples"]}}},"required":["jsonSchema","fields"]},"samples":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"data":{},"preview":{"type":"string","description":"Path of the PNG of the first page (GET)"}},"required":["name","preview"]}},"calls":{"type":"object","properties":{"render":{"type":"object","properties":{"method":{"type":"string","enum":["POST"]},"path":{"type":"string"},"body":{"type":"object","additionalProperties":{}},"curl":{"type":"string"}},"required":["method","path","body","curl"]},"renderSample":{"type":["object","null"],"properties":{"method":{"type":"string","enum":["POST"]},"path":{"type":"string"},"body":{"type":"object","additionalProperties":{}},"curl":{"type":"string"}},"required":["method","path","body","curl"]},"job":{"type":"object","properties":{"method":{"type":"string","enum":["POST"]},"path":{"type":"string"},"body":{"type":"object","additionalProperties":{}},"curl":{"type":"string"}},"required":["method","path","body","curl"]},"typescript":{"type":"string"}},"required":["render","renderSample","job","typescript"]},"generatedAt":{"type":"string","format":"date-time"}},"required":["template","version","title","profile","engine","fonts","history","schema","samples","calls","generatedAt"]},"Asset":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"sha256":{"type":"string","description":"Templates reference assets as `sha256:<hex, 16+ digits>`"},"name":{"type":"string"},"mime":{"type":"string"},"size":{"type":"integer"},"scope":{"type":"string","enum":["organization","platform"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sha256","name","mime","size","scope","createdAt"]},"Font":{"type":"object","properties":{"id":{"type":["string","null"],"minLength":1,"maxLength":64,"description":"null for platform fonts"},"sha256":{"type":"string"},"name":{"type":"string"},"format":{"type":"string","enum":["ttf","otf","ttc"]},"size":{"type":"integer"},"scope":{"type":"string","enum":["organization","platform"]},"families":{"type":"array","items":{"type":"string"}},"faces":{"type":"array","items":{"type":"object","properties":{"family":{"type":"string"},"subfamily":{"type":"string"},"style":{"type":"string","enum":["normal","italic"]},"weight":{"type":"number"},"fsType":{"type":"integer"},"embedding":{"type":"string","enum":["installable","editable","preview-print","restricted"]}},"required":["family","subfamily","style","weight","fsType","embedding"]}},"license":{"type":["string","null"],"description":"Mention entered at deposit (informative)"},"notes":{"type":"array","items":{"type":"string"},"description":"Embedding remarks read from fsType (informative)"},"createdAt":{"type":["string","null"],"format":"date-time"}},"required":["id","sha256","name","format","size","scope","families","faces","license","notes","createdAt"]},"FontFamily":{"type":"object","properties":{"family":{"type":"string"},"scope":{"type":"string","enum":["organization","platform"]},"hashes":{"type":"array","items":{"type":"string"}}},"required":["family","scope","hashes"]},"Render":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"status":{"type":"string","enum":["succeeded","failed","expired"],"description":"`expired`: the document was deleted by the retention of the organization; the manifest is kept"},"templateId":{"type":"string","minLength":1,"maxLength":64},"templateSlug":{"type":["string","null"]},"version":{"type":["integer","null"]},"jobId":{"type":["string","null"],"minLength":1,"maxLength":64},"callerType":{"type":"string","enum":["user","api_key"]},"callerId":{"type":"string","minLength":1,"maxLength":64},"idempotencyKey":{"type":["string","null"]},"profile":{"type":"string"},"pages":{"type":["integer","null"]},"size":{"type":["integer","null"]},"pdfSha256":{"type":["string","null"]},"dataSha256":{"type":"string"},"durationMs":{"type":"integer"},"manifest":{"type":["object","null"],"additionalProperties":{},"description":"Generation manifest (ADR-008)"},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]}}},"required":["code","message"]},"dataRetained":{"type":"boolean","description":"The data of the render are kept (encrypted): POST /renders/{id}/verify needs no `data`"},"expiredAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","status","templateId","version","jobId","callerType","callerId","idempotencyKey","profile","pages","size","pdfSha256","dataSha256","durationMs","manifest","error","dataRetained","expiredAt","createdAt"]},"Document":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"url":{"type":"string","description":"Time-limited signed URL of the stored PDF"},"expiresAt":{"type":"string","format":"date-time"},"sha256":{"type":"string"},"size":{"type":"integer"},"pages":{"type":"integer"}},"required":["id","url","expiresAt","sha256","size","pages"]},"Warning":{"type":"object","properties":{"code":{"type":"string","example":"version.latest"},"message":{"type":"string"},"path":{"type":"string"}},"required":["code","message"]},"RenderRequest":{"type":"object","properties":{"template":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"version":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"string","enum":["latest","draft"]}],"default":"latest","description":"Pin a number in production; `latest` = highest published version"},"data":{"description":"Validated against the JSON Schema of the version"},"sample":{"type":"string","minLength":1,"maxLength":120,"description":"Name of a sample of the version, rendered instead of `data` (exclusive with `data`)"},"profile":{"type":"string","enum":["standard","archive","accessible"],"description":"Overrides the output profile of the template"},"locale":{"type":"string","maxLength":35},"seal":{"type":"object","properties":{"level":{"type":"string","enum":["b-t","b-lta"]}},"description":"Advanced electronic seal (PAdES, ADR-014), last step of the chain; the template may request one too"}},"required":["template"]},"RenderDetail":{"allOf":[{"$ref":"#/components/schemas/Render"},{"type":"object","properties":{"download":{"type":["object","null"],"properties":{"url":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}},"required":["url","expiresAt"],"description":"Time-limited signed URL of the stored PDF; null once expired or failed"},"postprocess":{"type":["object","null"],"additionalProperties":{},"description":"Post-processing chain (pikepdf): operations, PDF/A and PDF/UA identification, sizes"},"seal":{"type":["object","null"],"additionalProperties":{},"description":"Electronic seal: level, certificate, timestamp authority"}},"required":["download","postprocess","seal"]}]},"Verification":{"type":"object","properties":{"renderId":{"type":"string","minLength":1,"maxLength":64},"result":{"type":"string","enum":["identical","different"]},"basis":{"type":"string","enum":["document","unsealed-document","engine-output"],"description":"`document`: stored PDF; `unsealed-document`: a sealed PDF compared before its seal; `engine-output`: PDF of the engine (sealed renders of older manifests)"},"dataSource":{"type":"string","enum":["request","snapshot","job"]},"original":{"type":"object","properties":{"sha256":{"type":"string"},"pdfSha256":{"type":["string","null"]}},"required":["sha256","pdfSha256"]},"rerender":{"type":"object","properties":{"sha256":{"type":"string"},"pages":{"type":"integer"},"bytes":{"type":"integer"},"durationMs":{"type":"integer"}},"required":["sha256","pages","bytes","durationMs"]},"differences":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"original":{},"rerender":{}},"required":["path"]},"description":"Manifest fields that differ (engine, fonts, sizes…); volatile fields (timings, ids) excluded"},"verifiedAt":{"type":"string","format":"date-time"}},"required":["renderId","result","basis","dataSource","original","rerender","differences","verifiedAt"]},"JobAccepted":{"allOf":[{"$ref":"#/components/schemas/Job"},{"type":"object","properties":{"warnings":{"type":"array","items":{"$ref":"#/components/schemas/Warning"},"description":"`version.latest`: an API key asked for `latest`; pin a version number in production"}},"required":["warnings"]}]},"Job":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"queue":{"type":"string","enum":["light","heavy"]},"templateId":{"type":"string","minLength":1,"maxLength":64},"version":{"type":["integer","null"]},"profile":{"type":"string"},"callerType":{"type":"string","enum":["user","api_key"]},"callerId":{"type":"string","minLength":1,"maxLength":64},"idempotencyKey":{"type":["string","null"]},"callbackUrl":{"type":["string","null"]},"renderId":{"type":["string","null"],"minLength":1,"maxLength":64},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]}}},"required":["code","message"]},"output":{"type":["string","null"],"enum":["zip","merged","separate",null],"description":"Batch jobs: one ZIP archive, one merged PDF, or the documents of the items; null: one document"},"progress":{"type":["object","null"],"properties":{"total":{"type":"integer"},"done":{"type":"integer"},"succeeded":{"type":"integer"},"failed":{"type":"integer"}},"required":["total","done","succeeded","failed"],"description":"Batch jobs: items rendered so far (failures listed by GET /jobs/{id}/items)"},"createdAt":{"type":"string","format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","status","queue","templateId","version","profile","callerType","callerId","idempotencyKey","callbackUrl","renderId","error","output","progress","createdAt","startedAt","finishedAt"]},"JobRequest":{"allOf":[{"$ref":"#/components/schemas/RenderRequest"},{"type":"object","properties":{"callbackUrl":{"type":"string","maxLength":2048,"format":"uri","description":"Notified like a webhook when the job ends (`job.completed`, `job.failed`, `job.lost`), signed with the callback secret of the organization (GET /webhooks/callback-secret)"},"items":{"type":"array","items":{"$ref":"#/components/schemas/BatchItem"},"minItems":1,"maxItems":1000,"description":"Batch: documents of the same template and version (instead of `data` / `sample`), each validated at submission; at most `batchMaxItems` of the organization"},"output":{"type":"string","enum":["zip","merged","separate"],"description":"Batch only (default `zip`): one ZIP archive with an index `items.json`; one merged PDF (one bookmark per document, one seal); or the documents of the items only"}}}]},"BatchItem":{"type":"object","properties":{"data":{"description":"Validated against the JSON Schema of the version"},"sample":{"type":"string","minLength":1,"maxLength":120,"description":"Name of a sample of the version, rendered instead of `data` (exclusive with `data`)"},"filename":{"type":"string","minLength":1,"maxLength":200,"description":"File name in the archive (`.pdf` appended when missing), bookmark of the merged document without its extension; `<position>.pdf` by default. Unique within the batch (case-insensitive)."},"metadata":{"type":"object","additionalProperties":{},"description":"References of the caller, returned with the item and in the index of the archive"}}},"JobItem":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"description":"Id of the item, of its render and of its document"},"index":{"type":"integer","description":"Position in `items` of the request"},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"queue":{"type":"string","enum":["light","heavy"]},"filename":{"type":"string"},"metadata":{"type":["object","null"],"additionalProperties":{}},"sample":{"type":["string","null"]},"dataSha256":{"type":"string"},"renderId":{"type":["string","null"],"minLength":1,"maxLength":64},"pages":{"type":["integer","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]}}},"required":["code","message"]},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","index","status","queue","filename","metadata","sample","dataSha256","renderId","pages","error","startedAt","finishedAt"]},"JobOutput":{"type":"object","properties":{"url":{"type":"string","description":"Time-limited signed URL"},"expiresAt":{"type":"string","format":"date-time"},"contentType":{"type":"string","enum":["application/pdf","application/zip"]},"sha256":{"type":"string"},"size":{"type":"integer"},"pages":{"type":["integer","null"],"description":"Merged document"}},"required":["url","expiresAt","contentType","sha256","size","pages"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"webhookId":{"type":["string","null"],"minLength":1,"maxLength":64,"description":"null: `callbackUrl` of a job"},"jobId":{"type":["string","null"],"minLength":1,"maxLength":64},"eventId":{"type":"string","minLength":1,"maxLength":64,"description":"Same for every delivery of an event: receivers dedupe on it"},"event":{"type":"string"},"url":{"type":"string"},"status":{"type":"string","enum":["pending","succeeded","failed"]},"attempts":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"status":{"type":["integer","null"],"description":"HTTP status; null: no answer"},"durationMs":{"type":"integer"},"error":{"type":"string"}},"required":["at","status","durationMs"]}},"responseStatus":{"type":["integer","null"]},"responseBody":{"type":["string","null"],"description":"First bytes of the last answer"},"redeliveryOf":{"type":["string","null"],"minLength":1,"maxLength":64},"payload":{"type":"object","additionalProperties":{},"description":"Body POSTed to the receiver: `{ id, type, createdAt, organizationId, data }`, signed in `X-Sculdoc-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>`"},"createdAt":{"type":"string","format":"date-time"},"lastAttemptAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","webhookId","jobId","eventId","event","url","status","attempts","responseStatus","responseBody","redeliveryOf","payload","createdAt","lastAttemptAt","finishedAt"]},"Preview":{"type":"object","properties":{"format":{"type":"string","enum":["svg","png"]},"pages":{"type":"array","items":{"type":"string"},"description":"SVG documents, or PNG images in base64"},"pageNumbers":{"type":"array","items":{"type":"integer"},"description":"Number of each returned page"},"pageCount":{"type":"integer","description":"Pages of the whole document"},"unit":{"type":"string","enum":["mm"]},"boxes":{"type":"array","items":{"$ref":"#/components/schemas/PreviewBox"}},"overflows":{"type":"array","items":{"$ref":"#/components/schemas/PreviewOverflow"}},"warnings":{"type":"array","items":{"type":"string"}}},"required":["format","pages","pageNumbers","pageCount","unit","boxes","overflows","warnings"]},"PreviewBox":{"type":"object","properties":{"id":{"type":"string","description":"Node id (the instances of a repetition share the id of their model)"},"page":{"type":"integer"},"x":{"type":"number","description":"mm from the left edge of the page"},"y":{"type":"number","description":"mm from the top edge of the page"},"w":{"type":"number","description":"mm"},"h":{"type":"number","description":"mm"},"multi":{"type":"boolean","description":"The node spans several pages: one box per page fragment"},"fragment":{"type":["integer","null"],"description":"Index of the page fragment (multi-page node)"}},"required":["id","page","x","y","w","h","multi","fragment"]},"PreviewOverflow":{"type":"object","properties":{"id":{"type":"string","description":"Frame of fixed size (zone, place with a height)"},"node":{"type":["string","null"],"description":"First node of the frame that does not fit"},"page":{"type":"integer"},"right":{"type":"number","description":"mm beyond the right edge"},"bottom":{"type":"number","description":"mm beyond the bottom edge (clipped in the PDF for a zone)"}},"required":["id","node","page","right","bottom"]},"PreviewRequest":{"type":"object","properties":{"template":{"type":"string","minLength":1,"maxLength":100},"version":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"string","enum":["latest","draft"]}],"default":"latest","description":"Pin a number in production; `latest` = highest published version"},"ir":{"type":"object","additionalProperties":{},"description":"Inline SDM document (unsaved editor state); signed-in users only"},"data":{},"sample":{"type":"string","minLength":1,"maxLength":120,"description":"Name of a sample of the version, rendered instead of `data` (exclusive with `data`)"},"locale":{"type":"string","maxLength":35},"pages":{"type":"array","items":{"type":"integer","minimum":1,"maximum":100000},"minItems":1,"maxItems":100,"description":"Pages to return (1-based); all by default in SVG, the first 20 in PNG (20 at most per request). `pageCount` gives the total."},"boxes":{"type":"string","enum":["leaf","light","none"],"default":"leaf","description":"`leaf`: every node, leaves measured; `light`: positions and container widths (cheaper); `none`: no boxes"},"format":{"type":"string","enum":["svg","png"],"default":"svg"},"ppi":{"type":"integer","minimum":18,"maximum":200,"description":"PNG resolution (96 by default)"}}},"Validation":{"type":"object","properties":{"valid":{"type":"boolean"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/Warning"},"description":"`version.latest`: an API key asked for `latest`; pin a version number in production"}},"required":["valid","issues","warnings"]},"WebhookCreated":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","description":"HMAC-SHA256 key of the signatures (`whsec_…`), shown at creation and rotation only"}},"required":["secret"]}]},"WebhookEvent":{"type":"string","enum":["job.completed","job.failed","job.lost","version.published","version.deprecated"]},"Webhook":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"url":{"type":"string"},"description":{"type":"string"},"events":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEvent"}},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","url","description","events","active","createdAt","updatedAt"]},"WebhookUpdated":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","description":"HMAC-SHA256 key of the signatures (`whsec_…`), shown at creation and rotation only"}}}]},"ApiKey":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":["string","null"]},"start":{"type":["string","null"],"description":"First characters of the key, for identification"},"folderId":{"type":["string","null"],"minLength":1,"maxLength":64,"description":"The key only sees this folder subtree"},"access":{"type":"string","enum":["render","publish"],"description":"`render`: reads published contracts and renders. `publish`: also saves drafts, uploads assets and publishes (templates as code from a CI); publications are attributed to the creator of the key"},"enabled":{"type":"boolean"},"rateLimit":{"type":"object","properties":{"max":{"type":["integer","null"]},"windowSeconds":{"type":["integer","null"]}},"required":["max","windowSeconds"]},"quota":{"type":"object","properties":{"remaining":{"type":["integer","null"]},"refillAmount":{"type":["integer","null"]},"refillIntervalDays":{"type":["integer","null"]}},"required":["remaining","refillAmount","refillIntervalDays"]},"requestCount":{"type":"integer"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","start","folderId","access","enabled","rateLimit","quota","requestCount","lastUsedAt","expiresAt","createdAt"]},"ApiKeyCreated":{"type":"object","properties":{"key":{"type":"string","description":"Plaintext key, shown once"},"apiKey":{"$ref":"#/components/schemas/ApiKey"}},"required":["key","apiKey"]},"Invitation":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"organization":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string"}},"required":["id","name"]},"email":{"type":"string"},"role":{"type":"string","enum":["owner","admin","editor","viewer"]},"status":{"type":"string","enum":["pending","accepted","rejected","canceled"]},"expired":{"type":"boolean","description":"Pending but past its expiry: can no longer be accepted"},"inviter":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string"}},"required":["id","name"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","organization","email","role","status","expired","inviter","createdAt","expiresAt"]},"ActivityEvent":{"type":"object","properties":{"type":{"type":"string","enum":["version.published","version.deprecated","version.archived","render.succeeded","render.failed","member.joined","invitation.sent"]},"at":{"type":"string","format":"date-time"},"actor":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["user","api_key"]},"id":{"type":"string"},"name":{"type":"string"}},"required":["type","id","name"],"description":"Who did it: a user or an API key (null for lifecycle changes)"},"template":{"type":["object","null"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"]},"version":{"type":["integer","null"]},"detail":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"null"}]},"description":"`version.published`: changelog; `render.*`: render id, pages, profile, error code; `member.joined`: role, source; `invitation.sent`: e-mail, role, status"}},"required":["type","at","actor","template","version","detail"]},"Starter":{"type":"object","properties":{"id":{"type":"string","example":"facture"},"label":{"type":"object","properties":{"fr":{"type":"string"},"en":{"type":"string"}},"required":["fr","en"]},"description":{"type":"object","properties":{"fr":{"type":"string"},"en":{"type":"string"}},"required":["fr","en"]},"category":{"type":"string","enum":["invoice","certificate","expense","letter"]},"outputProfile":{"type":"string"},"samples":{"type":"array","items":{"type":"string"},"description":"Samples copied into the draft"},"preview":{"type":"string","description":"First page of the first sample (PNG)"}},"required":["id","label","description","category","outputProfile","samples","preview"]},"Model":{"type":"object","properties":{"sdm":{"type":"string","description":"Version of the model written by the editor","example":"1.3"},"sdmVersions":{"type":"array","items":{"type":"string"},"description":"Versions accepted at reading"},"schema":{"type":"object","additionalProperties":{},"description":"JSON Schema 2020-12 of an SDM document (the IR)"},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"$ref":"#/components/schemas/Label"},"icon":{"type":"string"}},"required":["id","label","icon"]}},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/ModelNode"}},"style":{"type":"array","items":{"$ref":"#/components/schemas/ModelProperty"}},"master":{"type":"array","items":{"$ref":"#/components/schemas/ModelProperty"}},"region":{"type":"array","items":{"$ref":"#/components/schemas/ModelProperty"}},"meta":{"type":"array","items":{"$ref":"#/components/schemas/ModelProperty"}}},"required":["sdm","sdmVersions","schema","categories","nodes","style","master","region","meta"]},"Label":{"type":"object","properties":{"fr":{"type":"string"},"en":{"type":"string"}},"required":["fr","en"]},"ModelNode":{"type":"object","properties":{"type":{"type":"string"},"aliasOf":{"type":"string","description":"Same node under another name: not in the palette"},"label":{"$ref":"#/components/schemas/Label"},"description":{"$ref":"#/components/schemas/Label"},"category":{"type":"string"},"icon":{"type":"string","description":"Iconify name (Lucide)","example":"i-lucide-pilcrow"},"properties":{"type":"array","items":{"$ref":"#/components/schemas/ModelProperty"}},"create":{"type":"object","additionalProperties":{},"description":"Minimal valid node inserted by the palette (an `id` is to add)"}},"required":["type","label","description","category","icon","properties","create"]},"ModelProperty":{"type":"object","properties":{"name":{"type":"string"},"label":{"$ref":"#/components/schemas/Label"},"editor":{"type":"string","description":"Suggested control: length, color, expression, text, runs, style, stroke, padding, asset, identifier, master, children, rows, columns, cells, enum, boolean, number, integer, union (see `alternatives`), json…"},"required":{"type":"boolean"},"options":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}},"alternatives":{"type":"array","items":{"type":"string"}},"min":{"type":"number"},"max":{"type":"number"},"default":{"description":"Value applied by the compiler when absent"},"advanced":{"type":"boolean"}},"required":["name","label","editor","required"]},"ExpressionLanguage":{"type":"object","properties":{"syntax":{"type":"object","properties":{"interpolation":{"type":"string"},"operators":{"type":"array","items":{"type":"object","properties":{"operator":{"type":"string"},"label":{"$ref":"#/components/schemas/Label"}},"required":["operator","label"]}}},"required":["interpolation","operators"]},"exampleScope":{"type":"object","additionalProperties":{},"description":"Data the examples are evaluated on (fr-FR, Europe/Paris)"},"entries":{"type":"array","items":{"$ref":"#/components/schemas/ExpressionReference"}}},"required":["syntax","exampleScope","entries"]},"ExpressionReference":{"type":"object","properties":{"name":{"type":"string"},"kind":{"type":"string","enum":["filter","function"]},"category":{"type":"string"},"input":{"type":"string","description":"Type of the piped value (filters)"},"params":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"optional":{"type":"boolean"},"label":{"$ref":"#/components/schemas/Label"}},"required":["name","type","label"]}},"returns":{"type":"string"},"label":{"$ref":"#/components/schemas/Label"},"description":{"$ref":"#/components/schemas/Label"},"examples":{"type":"array","items":{"type":"object","properties":{"expr":{"type":"string"},"result":{"description":"Checked by the tests"}},"required":["expr"]}}},"required":["name","kind","category","params","returns","label","description","examples"]}},"parameters":{}},"paths":{"/me":{"get":{"operationId":"getMe","tags":["Organizations"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Who am I: user, organizations with roles and permissions, active organization; or API key","responses":{"200":{"description":"Identity","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["user","api_key"]},"user":{"type":["object","null"],"properties":{"id":{"type":"string","minLength":1,"maxLength":64},"email":{"type":"string"},"name":{"type":"string"},"image":{"type":["string","null"]},"platformAdmin":{"type":"boolean"}},"required":["id","email","name","image","platformAdmin"]},"organizations":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Organization"},{"type":"object","properties":{"role":{"type":["string","null"],"description":"null: platform administrator without membership"},"permissions":{"type":"array","items":{"type":"string"},"description":"What the caller may do in it"}},"required":["role","permissions"]}]}},"activeOrganizationId":{"type":["string","null"],"minLength":1,"maxLength":64,"description":"Organization of the requests without `x-sculdoc-organization`: the active one of the session (POST /me/organization), else the only membership"},"providers":{"type":"array","items":{"type":"string"},"description":"Sign-in providers enabled on this deployment"}},"required":["type","user","organizations","activeOrganizationId","providers"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/me/organization":{"post":{"operationId":"setActiveOrganization","tags":["Organizations"],"security":[{"session":[]}],"summary":"Choose the active organization of the session (requests without `x-sculdoc-organization`)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organization":{"type":"string","minLength":1,"maxLength":100,"description":"Id or slug"}},"required":["organization"]}}}},"responses":{"200":{"description":"Identity","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["user","api_key"]},"user":{"type":["object","null"],"properties":{"id":{"type":"string","minLength":1,"maxLength":64},"email":{"type":"string"},"name":{"type":"string"},"image":{"type":["string","null"]},"platformAdmin":{"type":"boolean"}},"required":["id","email","name","image","platformAdmin"]},"organizations":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Organization"},{"type":"object","properties":{"role":{"type":["string","null"],"description":"null: platform administrator without membership"},"permissions":{"type":"array","items":{"type":"string"},"description":"What the caller may do in it"}},"required":["role","permissions"]}]}},"activeOrganizationId":{"type":["string","null"],"minLength":1,"maxLength":64,"description":"Organization of the requests without `x-sculdoc-organization`: the active one of the session (POST /me/organization), else the only membership"},"providers":{"type":"array","items":{"type":"string"},"description":"Sign-in providers enabled on this deployment"}},"required":["type","user","organizations","activeOrganizationId","providers"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organizations":{"post":{"operationId":"createOrganization","tags":["Organizations"],"security":[{"session":[]}],"summary":"Create an organization (platform administrators); the creator becomes its owner","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"slug":{"type":"string","maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}},"required":["name","slug"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization":{"get":{"operationId":"getOrganization","tags":["Organizations"],"security":[{"session":[]},{"apiKey":[]}],"summary":"The current organization","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrentOrganization"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateOrganization","tags":["Organizations"],"security":[{"session":[]}],"summary":"Update the current organization","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"logo":{"type":["string","null"],"format":"uri"},"requirePinnedVersion":{"type":"boolean"},"keepRenderData":{"type":"boolean"},"allowRaw":{"type":"boolean"},"retention":{"type":"object","properties":{"documentsDays":{"type":"integer","minimum":1,"maximum":36500},"renderDataDays":{"type":"integer","minimum":0,"maximum":36500},"legalHoldCoversData":{"type":"boolean"}}},"exports":{"type":"object","properties":{"csvDelimiter":{"type":"string","enum":[",",";"]}}}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrentOrganization"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/members":{"get":{"operationId":"listMembers","tags":["Organizations"],"security":[{"session":[]}],"summary":"Members of the current organization","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Members","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}},"required":["members"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/members/{memberId}":{"patch":{"operationId":"updateMember","tags":["Organizations"],"security":[{"session":[]}],"summary":"Change the role of a member (the membership stops following OIDC claims)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"memberId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/Role"}},"required":["role"]}}}},"responses":{"204":{"description":"Updated"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeMember","tags":["Organizations"],"security":[{"session":[]}],"summary":"Remove a member","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"memberId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Removed"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/provider-mappings":{"get":{"operationId":"listProviderMappings","tags":["Organizations"],"security":[{"session":[]}],"summary":"OIDC provisioning rules: which provider feeds this organization, and claims → role","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Mappings","content":{"application/json":{"schema":{"type":"object","properties":{"mappings":{"type":"array","items":{"$ref":"#/components/schemas/ProviderMapping"}}},"required":["mappings"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/provider-mappings/{provider}":{"put":{"operationId":"putProviderMapping","tags":["Organizations"],"security":[{"session":[]}],"summary":"Create or replace the mapping of a provider","description":"Attaching an identity provider to an organization opens it to every user of that provider: platform administrators only.","parameters":[{"schema":{"type":"string","enum":["myeq","supscale"]},"required":true,"name":"provider","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"$ref":"#/components/schemas/MappingRule"},"maxItems":50},"defaultRole":{"anyOf":[{"$ref":"#/components/schemas/Role"},{"type":"null"}],"description":"Role when no rule matches; null = no membership"},"platformAdmin":{"type":"boolean","description":"Platform administrators only"}},"required":["rules","defaultRole"]}}}},"responses":{"200":{"description":"Mapping","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderMapping"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteProviderMapping","tags":["Organizations"],"security":[{"session":[]}],"summary":"Detach a provider from this organization","parameters":[{"schema":{"type":"string","enum":["myeq","supscale"]},"required":true,"name":"provider","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Removed"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/usage":{"get":{"operationId":"getUsage","tags":["Organizations"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Quotas of the organization and their use: renders of the minute, pages of the day, storage, batches","description":"Sliding windows (60 seconds, 24 hours). A request beyond a quota is refused with 429 and `error.retryAfter` (seconds, also `Retry-After`); items of a batch wait for room instead. API keys are bounded by these quotas on top of their own limits, and may read them here.","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/quotas":{"put":{"operationId":"putQuotas","tags":["Organizations"],"security":[{"session":[]}],"summary":"Set the quotas of the organization (platform administrators); `null` restores a default","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rendersPerMinute":{"type":["integer","null"],"minimum":1,"maximum":1000000},"pagesPerDay":{"type":["integer","null"],"minimum":1,"maximum":1000000000},"storageBytes":{"type":["integer","null"],"minimum":1,"maximum":9007199254740991},"batchMaxItems":{"type":["integer","null"],"minimum":1,"maximum":1000},"batchConcurrency":{"type":["integer","null"],"minimum":1,"maximum":50}}}}}},"responses":{"200":{"description":"Quotas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quotas"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/folders":{"get":{"operationId":"listFolders","tags":["Folders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Folder tree of the organization (flat list, linked by parentId)","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Folders","content":{"application/json":{"schema":{"type":"object","properties":{"folders":{"type":"array","items":{"$ref":"#/components/schemas/Folder"}}},"required":["folders"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createFolder","tags":["Folders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Create a folder","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"parentId":{"type":["string","null"],"minLength":1,"maxLength":64}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Folder"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/folders/{folderId}":{"get":{"operationId":"getFolder","tags":["Folders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Get a folder","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"folderId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Folder","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Folder"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateFolder","tags":["Folders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Rename or move a folder (parentId null = root)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"folderId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"parentId":{"type":["string","null"],"minLength":1,"maxLength":64}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Folder"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteFolder","tags":["Folders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Delete an empty folder","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"folderId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Deleted"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates":{"get":{"operationId":"listTemplates","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"List templates (optionally of one folder; folderId=root for the root)","parameters":[{"schema":{"type":"string"},"required":false,"name":"folderId","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Templates","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}},"required":["templates"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createTemplate","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Create a template, empty (save a draft next) or from a starter of the platform","description":"`fromStarter` (GET /starters): the template is created with a draft holding the content and the samples of the starter, in one transaction.","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"slug":{"type":"string","maxLength":100,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","description":"Stable identifier used by API callers","example":"certificat-etalonnage"},"description":{"type":"string","maxLength":2000},"folderId":{"type":["string","null"],"minLength":1,"maxLength":64},"fromStarter":{"type":"string","maxLength":60,"description":"Id of a starter (GET /starters)"}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}":{"get":{"operationId":"getTemplate","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Get a template by id or slug","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateTemplate","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Rename, describe or move a template (folderId null = root)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"slug":{"type":"string","maxLength":100,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","description":"Stable identifier used by API callers","example":"certificat-etalonnage"},"description":{"type":"string","maxLength":2000},"folderId":{"type":["string","null"],"minLength":1,"maxLength":64}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteTemplate","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Delete a template (soft delete: published versions and manifests are kept)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Deleted"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/duplicate":{"post":{"operationId":"duplicateTemplate","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Duplicate a template: the copy starts with a draft of the latest content","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"folderId":{"type":["string","null"],"minLength":1,"maxLength":64}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions":{"get":{"operationId":"listVersions","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Version history (draft first, then newest to oldest)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Versions","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"$ref":"#/components/schemas/VersionSummary"}}},"required":["versions"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/draft":{"put":{"operationId":"saveDraft","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Create or replace the single draft of a template","description":"The response carries the `ETag` of the saved draft. With `If-Match`, a draft changed since it was read is not overwritten: 409 `draft.conflict` with the current draft in `current`.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft"},"required":false,"description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft","name":"if-match","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ir":{"type":"object","additionalProperties":{}},"dataSchema":{"type":["object","null"],"additionalProperties":{}},"samples":{"type":"array","items":{"$ref":"#/components/schemas/Sample"},"maxItems":50}},"required":["ir"]}}}},"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Version"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The draft changed since it was read (`If-Match`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftConflict"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchDraft","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Incremental save: JSON Patch (RFC 6902) operations on the IR of the draft","description":"Paths are JSON Pointers into the SDM document (`/body/2/runs/0`). `If-Match` is required (428 without it). The operations apply in order; a failing one (`test` included) or an invalid result changes nothing (422 with the index of the operation or the paths of the model). At most 1000 operations.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft"},"required":false,"description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft","name":"if-match","in":"header"}],"requestBody":{"required":true,"content":{"application/json-patch+json":{"schema":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["add"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"},"value":{}},"required":["op","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["remove"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"}},"required":["op","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["replace"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"},"value":{}},"required":["op","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["move"]},"from":{"type":"string","pattern":"^(\\/[^/]*)*$"},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"}},"required":["op","from","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["copy"]},"from":{"type":"string","pattern":"^(\\/[^/]*)*$"},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"}},"required":["op","from","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["test"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"},"value":{}},"required":["op","path"]}]},"maxItems":1000}},"application/json":{"schema":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["add"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"},"value":{}},"required":["op","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["remove"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"}},"required":["op","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["replace"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"},"value":{}},"required":["op","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["move"]},"from":{"type":"string","pattern":"^(\\/[^/]*)*$"},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"}},"required":["op","from","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["copy"]},"from":{"type":"string","pattern":"^(\\/[^/]*)*$"},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"}},"required":["op","from","path"]},{"type":"object","properties":{"op":{"type":"string","enum":["test"]},"path":{"type":"string","pattern":"^(\\/[^/]*)*$"},"value":{}},"required":["op","path"]}]},"maxItems":1000}}}},"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Version"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The draft changed since it was read (`If-Match`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftConflict"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"428":{"description":"`If-Match` is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteDraft","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Discard the draft","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Discarded"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/draft/lock":{"post":{"operationId":"lockDraft","tags":["Versions"],"security":[{"session":[]}],"summary":"Announce that you edit the draft (soft lock, information only)","description":"A soft lock never blocks a save: it tells the other editors who is editing. It expires after 120 s without heartbeat. `lock` takes it when free, expired or already yours (`force: true` takes it from another editor); `heartbeat` renews it only if you hold it.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"force":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Lock state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftLockState"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/draft/heartbeat":{"post":{"operationId":"heartbeatDraft","tags":["Versions"],"security":[{"session":[]}],"summary":"Renew the edit lock you hold","description":"A soft lock never blocks a save: it tells the other editors who is editing. It expires after 120 s without heartbeat. `lock` takes it when free, expired or already yours (`force: true` takes it from another editor); `heartbeat` renews it only if you hold it.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Lock state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftLockState"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/draft/unlock":{"post":{"operationId":"unlockDraft","tags":["Versions"],"security":[{"session":[]}],"summary":"Release the edit lock you hold","description":"A soft lock never blocks a save: it tells the other editors who is editing. It expires after 120 s without heartbeat. `lock` takes it when free, expired or already yours (`force: true` takes it from another editor); `heartbeat` renews it only if you hold it.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Lock state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftLockState"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/draft/publish":{"post":{"operationId":"publishDraft","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Publish the draft as the next immutable version","description":"Checks: valid SDM document, at least one sample, includes pinned by version and hash, assets resolved, data schema covering every path the template uses, samples valid against the schema. All issues are reported at once (422). Font families are resolved against the organization depot, then the platform depot; a family in neither is substituted by a platform family, pinned in the version and reported in `warnings`.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"changelog":{"type":"string","minLength":1,"maxLength":4000,"description":"Mandatory at publication"}},"required":["changelog"]}}}},"responses":{"201":{"description":"Published","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishedVersion"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/rollback":{"post":{"operationId":"rollback","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Rollback = republish the content of an old version as a new version","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer","exclusiveMinimum":0},"changelog":{"type":"string","minLength":1,"maxLength":4000,"description":"Mandatory at publication"}},"required":["version","changelog"]}}}},"responses":{"201":{"description":"Published","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishedVersion"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/diff":{"get":{"operationId":"diffVersions","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Structural diff of the IR (by node id) and diff of the data schema between two versions","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string"},"required":true,"name":"from","in":"query"},{"schema":{"type":"string"},"required":true,"name":"to","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Diff","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionDiff"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/check":{"post":{"operationId":"checkPublication","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Dry run of a publication: inline content checked like the draft at publication, and diffed","description":"Templates as code (pull requests): the content is checked exactly like `POST …/versions/draft/publish` would check the draft (all issues at once, in `issues`), nothing is stored, and it is diffed against `against` (`latest` by default). The template may not exist yet: `against` and `diff` are then null. Assets and fonts must already be deposited (content-addressed).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ir":{"type":"object","additionalProperties":{}},"dataSchema":{"type":["object","null"],"additionalProperties":{}},"samples":{"type":"array","items":{"$ref":"#/components/schemas/Sample"},"maxItems":50},"against":{"type":"string","default":"latest","description":"Version number or `latest`","example":"latest"}},"required":["ir"]}}}},"responses":{"200":{"description":"Check","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicationCheck"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}":{"get":{"operationId":"getVersion","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Get a version with its content","description":"`draft`: the response carries the `ETag` to send in `If-Match` with the next save, and the soft edit lock (`lock`).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"latest"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Version"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}/schema":{"get":{"operationId":"getVersionSchema","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Data contract of a version (JSON Schema 2020-12)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"latest"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"JSON Schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSchema"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/draft/schema":{"put":{"operationId":"putDraftSchema","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Set the author's data schema of the draft","description":"`dataSchema` (JSON Schema 2020-12) completes the schema derived from the template: titles, descriptions, formats, `required`, examples; it must declare every path the template uses (checked at publication and by `POST …/check`). `null` goes back to the derived schema. The response carries the new `ETag` of the draft; with `If-Match`, a draft changed since it was read is not overwritten (409 `draft.conflict`).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft"},"required":false,"description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft","name":"if-match","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dataSchema":{"type":["object","null"],"additionalProperties":{}}},"required":["dataSchema"]}}}},"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Version"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The draft changed since it was read (`If-Match`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftConflict"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}/samples":{"get":{"operationId":"listSamples","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Samples of a version (named data sets: preview, tests, documentation, `sample` of renders)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"latest"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Samples","content":{"application/json":{"schema":{"type":"object","properties":{"samples":{"type":"array","items":{"$ref":"#/components/schemas/Sample"}}},"required":["samples"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}/samples/{sample}":{"get":{"operationId":"getSample","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"One sample of a version","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"latest"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^/\\\\]+$","example":"facture-standard"},"required":true,"name":"sample","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Sample","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sample"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/draft/samples/{sample}":{"put":{"operationId":"putDraftSample","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Add a sample to the draft, or replace the data of the sample of that name","description":"At most 50 samples. Samples are checked against the data schema at publication.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^/\\\\]+$","example":"facture-standard"},"required":true,"name":"sample","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft"},"required":false,"description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft","name":"if-match","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"JSON data set"}}}}}},"responses":{"200":{"description":"Replaced","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sample"}}}},"201":{"description":"Added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sample"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The draft changed since it was read (`If-Match`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftConflict"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"renameDraftSample","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Rename a sample of the draft","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^/\\\\]+$","example":"facture-standard"},"required":true,"name":"sample","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft"},"required":false,"description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft","name":"if-match","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^/\\\\]+$","example":"facture-standard"}},"required":["name"]}}}},"responses":{"200":{"description":"Renamed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sample"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The draft changed since it was read (`If-Match`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftConflict"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteDraftSample","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Remove a sample from the draft","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^/\\\\]+$","example":"facture-standard"},"required":true,"name":"sample","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft"},"required":false,"description":"ETag of the draft as last read (`GET …/versions/draft`, previous save): the write is refused with 409 and the current draft if it changed since; `*` = any existing draft","name":"if-match","in":"header"}],"responses":{"204":{"description":"Removed"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The draft changed since it was read (`If-Match`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftConflict"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}/deprecate":{"post":{"operationId":"deprecateVersion","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Deprecate a published version (still renderable, no longer `latest`)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"latest"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionSummary"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}/archive":{"post":{"operationId":"archiveVersion","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Archive a version (no longer renderable; kept for audit)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"latest"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionSummary"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}/docs":{"get":{"operationId":"getVersionDocs","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Generated documentation of a version: changelog, output profile, data contract, samples, calls","description":"JSON by default; `format=html` (or `Accept: text/html`) returns a standalone HTML page in French or English (`lang`), with the first page of each sample rendered by the engine and embedded. The thumbnails of a published version are cached; `GET …/samples/{sample}/preview.png` serves them one by one.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"3"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","enum":["json","html"]},"required":false,"name":"format","in":"query"},{"schema":{"type":"string","enum":["fr","en"],"default":"fr"},"required":false,"name":"lang","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Documentation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionDocs"}},"text/html":{"schema":{"type":"string"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/{template}/versions/{version}/samples/{sample}/preview.png":{"get":{"operationId":"getSamplePreview","tags":["Versions"],"security":[{"session":[]},{"apiKey":[]}],"summary":"First page of a sample rendered by the engine, as PNG (cached for published versions)","description":"Rendering a thumbnail requires the `render:create` permission; read-only members get the cached thumbnails of published versions only (403 otherwise).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":true,"description":"Template id or slug","name":"template","in":"path"},{"schema":{"type":"string","description":"Version number, `latest` or `draft`","example":"3"},"required":true,"description":"Version number, `latest` or `draft`","name":"version","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":120},"required":true,"name":"sample","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"PNG","content":{"image/png":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The version is archived","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/assets":{"get":{"operationId":"listAssets","tags":["Assets"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Assets visible to the organization (its own and the platform ones)","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Assets","content":{"application/json":{"schema":{"type":"object","properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/Asset"}}},"required":["assets"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createAsset","tags":["Assets"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Upload an asset (content-addressed: the same bytes are stored once)","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"mime":{"type":"string","enum":["image/png","image/jpeg","image/svg+xml","image/gif","image/webp","application/pdf"]},"content":{"type":"string","minLength":1,"description":"Base64, at most 20971520 bytes decoded"}},"required":["name","mime","content"]}}}},"responses":{"201":{"description":"Stored","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asset"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/fonts":{"get":{"operationId":"listFonts","tags":["Fonts"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Fonts a template may name: organization depot, then platform depot (ADR-013)","description":"`families` lists each family once, with the scope that provides it at publication (an organization font shadows a platform family of the same name). A family in neither depot is substituted by a platform family at publication, and reported.","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Fonts","content":{"application/json":{"schema":{"type":"object","properties":{"fonts":{"type":"array","items":{"$ref":"#/components/schemas/Font"}},"families":{"type":"array","items":{"$ref":"#/components/schemas/FontFamily"}}},"required":["fonts","families"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createFont","tags":["Fonts"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Deposit a font of the organization (TTF, OTF or TTC; content-addressed)","description":"The organization holds the license of the fonts it deposits (ADR-013): `fsType` and the license mention are recorded as information, never as a refusal. Depositing the same bytes again returns the existing font (200).","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"example":"Corporate-Regular.ttf"},"content":{"type":"string","minLength":1,"description":"Base64, at most 20971520 bytes decoded"},"license":{"type":"string","minLength":1,"maxLength":200,"example":"proprietary"}},"required":["name","content"]}}}},"responses":{"200":{"description":"Already deposited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Font"}}}},"201":{"description":"Deposited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Font"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/fonts/{fontId}":{"delete":{"operationId":"deleteFont","tags":["Fonts"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Remove a font of the organization, unless a published version is closed over it (409)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"fontId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Removed"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/renders":{"post":{"operationId":"createRender","tags":["Renders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Render a document synchronously (light limits)","description":"Validates `data` against the schema of the version, renders in an isolated engine process, stores the PDF and its manifest. Returns the PDF by default, or JSON (render + signed URL) with `Accept: application/json`. Documents beyond the light limits go through POST /jobs.","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","maxLength":255,"description":"Replays return the first result"},"required":false,"description":"Replays return the first result","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderRequest"}}}},"responses":{"200":{"description":"PDF (default) or render description","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"type":"object","properties":{"render":{"$ref":"#/components/schemas/Render"},"document":{"$ref":"#/components/schemas/Document"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/Warning"},"description":"`version.latest`: an API key asked for `latest`; pin a version number in production"}},"required":["render","document","warnings"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The version is archived","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit or quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listRenders","tags":["Renders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Render journal of the organization","description":"Every render, successful or not, newest first by default. Filters combine; pages follow `nextCursor` (null on the last page).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":false,"description":"Template id or slug","name":"template","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0},"required":false,"name":"version","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created at or after (inclusive)"},"required":false,"description":"Created at or after (inclusive)","name":"from","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created before (exclusive)"},"required":false,"description":"Created before (exclusive)","name":"to","in":"query"},{"schema":{"type":"string","enum":["user","api_key"]},"required":false,"name":"callerType","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":64,"description":"API key id or user id"},"required":false,"description":"API key id or user id","name":"callerId","in":"query"},{"schema":{"type":"string","enum":["standard","archive","accessible"]},"required":false,"name":"profile","in":"query"},{"schema":{"type":"string","maxLength":255},"required":false,"name":"idempotencyKey","in":"query"},{"schema":{"type":"string","enum":["desc","asc"],"default":"desc","description":"By creation date"},"required":false,"description":"By creation date","name":"order","in":"query"},{"schema":{"type":"string","enum":["succeeded","failed","expired"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","maxLength":500,"description":"`nextCursor` of the previous page"},"required":false,"description":"`nextCursor` of the previous page","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"A page of the journal","content":{"application/json":{"schema":{"type":"object","properties":{"renders":{"type":"array","items":{"$ref":"#/components/schemas/Render"}},"nextCursor":{"type":["string","null"]}},"required":["renders","nextCursor"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/renders/export":{"get":{"operationId":"exportRenders","tags":["Renders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Render journal as CSV (same filters as GET /renders)","description":"UTF-8 with BOM, one line per render, 100000 lines at most; separator: `delimiter`, else the setting of the organization.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":false,"description":"Template id or slug","name":"template","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0},"required":false,"name":"version","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created at or after (inclusive)"},"required":false,"description":"Created at or after (inclusive)","name":"from","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created before (exclusive)"},"required":false,"description":"Created before (exclusive)","name":"to","in":"query"},{"schema":{"type":"string","enum":["user","api_key"]},"required":false,"name":"callerType","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":64,"description":"API key id or user id"},"required":false,"description":"API key id or user id","name":"callerId","in":"query"},{"schema":{"type":"string","enum":["standard","archive","accessible"]},"required":false,"name":"profile","in":"query"},{"schema":{"type":"string","maxLength":255},"required":false,"name":"idempotencyKey","in":"query"},{"schema":{"type":"string","enum":["desc","asc"],"default":"desc","description":"By creation date"},"required":false,"description":"By creation date","name":"order","in":"query"},{"schema":{"type":"string","enum":["succeeded","failed","expired"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["comma","semicolon"],"description":"Separator of this export; default: the setting of the organization (`exports.csvDelimiter`)"},"required":false,"description":"Separator of this export; default: the setting of the organization (`exports.csvDelimiter`)","name":"delimiter","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"CSV","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/renders/{renderId}":{"get":{"operationId":"getRender","tags":["Renders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"A render: manifest, hashes, download link, post-processing chain, seal","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"renderId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Render","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderDetail"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/renders/{renderId}/verify":{"post":{"operationId":"verifyRender","tags":["Renders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Control re-render: same version, same data, same creation date → PDF hashes compared","description":"Renders again from the snapshot of the version (light limits), with the data of the render: kept by the organization (`keepRenderData`), still held by its job, or sent in `data` (checked against the recorded hash). A sealed document is compared before its seal. Nothing is stored.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"renderId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"Data of the render, when the organization does not keep them"}}}}}},"responses":{"200":{"description":"Comparison","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Verification"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents/{documentId}":{"get":{"operationId":"getDocument","tags":["Renders"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Signed URL of a stored PDF (the document id is the render id)","description":"`410 document.expired` once the retention of the organization has deleted it; `409 document.intermediate` for an item of a sealed merged batch (only the sealed merged document is handed out).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"documentId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Document","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Deleted by the retention","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs":{"post":{"operationId":"createJob","tags":["Jobs"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Render asynchronously, one document or a batch; poll GET /jobs/{id} or give a `callbackUrl`","description":"One document (`data` or `sample`), or a batch (`items`, 1 000 at most): every item is validated at submission (422 with the paths of the faulty items), then rendered in parallel within the quotas of the organization, one render and one manifest each; `output` says what the batch delivers (GET /jobs/{id}/output). Queue `light` when the template bounds its pages within the light limits (`meta.limits.maxPages`), `heavy` otherwise. With `Idempotency-Key`, the first response is replayed for 24 hours to the same request; the same key with another request is a 409.","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"},{"schema":{"type":"string","maxLength":255,"description":"Replays return the first result"},"required":false,"description":"Replays return the first result","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobRequest"}}}},"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobAccepted"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit or quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listJobs","tags":["Jobs"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Jobs of the organization","description":"Newest first by default; same filters as the render journal; pages follow `nextCursor`.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":false,"description":"Template id or slug","name":"template","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0},"required":false,"name":"version","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created at or after (inclusive)"},"required":false,"description":"Created at or after (inclusive)","name":"from","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created before (exclusive)"},"required":false,"description":"Created before (exclusive)","name":"to","in":"query"},{"schema":{"type":"string","enum":["user","api_key"]},"required":false,"name":"callerType","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":64,"description":"API key id or user id"},"required":false,"description":"API key id or user id","name":"callerId","in":"query"},{"schema":{"type":"string","enum":["standard","archive","accessible"]},"required":false,"name":"profile","in":"query"},{"schema":{"type":"string","maxLength":255},"required":false,"name":"idempotencyKey","in":"query"},{"schema":{"type":"string","enum":["desc","asc"],"default":"desc","description":"By creation date"},"required":false,"description":"By creation date","name":"order","in":"query"},{"schema":{"type":"string","enum":["queued","running","succeeded","failed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","maxLength":500,"description":"`nextCursor` of the previous page"},"required":false,"description":"`nextCursor` of the previous page","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Jobs","content":{"application/json":{"schema":{"type":"object","properties":{"jobs":{"type":"array","items":{"$ref":"#/components/schemas/Job"}},"nextCursor":{"type":["string","null"]}},"required":["jobs","nextCursor"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/export":{"get":{"operationId":"exportJobs","tags":["Jobs"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Jobs as CSV (same filters as GET /jobs)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Template id or slug"},"required":false,"description":"Template id or slug","name":"template","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0},"required":false,"name":"version","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created at or after (inclusive)"},"required":false,"description":"Created at or after (inclusive)","name":"from","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Created before (exclusive)"},"required":false,"description":"Created before (exclusive)","name":"to","in":"query"},{"schema":{"type":"string","enum":["user","api_key"]},"required":false,"name":"callerType","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":64,"description":"API key id or user id"},"required":false,"description":"API key id or user id","name":"callerId","in":"query"},{"schema":{"type":"string","enum":["standard","archive","accessible"]},"required":false,"name":"profile","in":"query"},{"schema":{"type":"string","maxLength":255},"required":false,"name":"idempotencyKey","in":"query"},{"schema":{"type":"string","enum":["desc","asc"],"default":"desc","description":"By creation date"},"required":false,"description":"By creation date","name":"order","in":"query"},{"schema":{"type":"string","enum":["queued","running","succeeded","failed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["comma","semicolon"],"description":"Separator of this export; default: the setting of the organization (`exports.csvDelimiter`)"},"required":false,"description":"Separator of this export; default: the setting of the organization (`exports.csvDelimiter`)","name":"delimiter","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"CSV","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{jobId}":{"get":{"operationId":"getJob","tags":["Jobs"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Job status; `renderId` names the render (and the document) once succeeded","description":"A batch reports the progress of its items (`progress`); its documents are listed by GET /jobs/{id}/items, its archive or merged PDF is given by GET /jobs/{id}/output.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"jobId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{jobId}/items":{"get":{"operationId":"listJobItems","tags":["Jobs"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Items of a batch, in the order of the request, with their render and their error","description":"A succeeded item names its render (`renderId`, GET /renders/{id}) and its document (GET /documents/{id}); a failed item carries its error. Pages follow `nextCursor`.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"jobId","in":"path"},{"schema":{"type":"string","enum":["queued","running","succeeded","failed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","maxLength":10,"pattern":"^\\d+$","description":"`nextCursor` of the previous page"},"required":false,"description":"`nextCursor` of the previous page","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Items","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/JobItem"}},"nextCursor":{"type":["string","null"]}},"required":["items","nextCursor"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{jobId}/output":{"get":{"operationId":"getJobOutput","tags":["Jobs"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Signed URL of the archive (`zip`) or of the merged PDF (`merged`) of a succeeded batch","description":"`410 document.expired` once the retention of the organization has deleted it.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"jobId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Output","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobOutput"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Deleted by the retention","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{jobId}/deliveries":{"get":{"operationId":"listJobDeliveries","tags":["Jobs"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Notifications of the `callbackUrl` of a job, with their attempts","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"jobId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Deliveries","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}},"required":["deliveries"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/previews":{"post":{"operationId":"createPreview","tags":["Previews"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Real engine preview: the asked pages in SVG or PNG, and the boxes of the nodes in mm","description":"Compiled with the `preview` profile of the compiler (never used in production renders) and laid out by the engine of the renders. The template is a stored version (`template`, `version`), or the unsaved state of the editor (`ir`, signed-in authors): its data are `data`, or `sample` of the version `version` of `template` (`version: draft` for the samples being edited). Boxes: one per node instance and per page fragment, in mm from the top-left corner of the page, keyed by node id. `overflows`: frames of fixed size (zones, places with a height) whose content does not fit. Nothing is stored; the assets of a draft are kept by the preview service between two previews. Rate: `PREVIEW_RATE_PER_MINUTE` per session or API key (429 with `retryAfter`).","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewRequest"}}}},"responses":{"200":{"description":"Preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Preview"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit or quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/validate":{"post":{"operationId":"validate","tags":["Previews"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Dry run: validate an inline template, or data against the schema of a version","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"template":{"type":"string","minLength":1,"maxLength":100},"version":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"string","enum":["latest","draft"]}],"default":"latest","description":"Pin a number in production; `latest` = highest published version"},"ir":{"type":"object","additionalProperties":{},"description":"Inline SDM document (unsaved editor state); signed-in users only"},"data":{},"sample":{"type":"string","minLength":1,"maxLength":120,"description":"Name of a sample of the version, rendered instead of `data` (exclusive with `data`)"},"locale":{"type":"string","maxLength":35}}}}}},"responses":{"200":{"description":"Validation report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Validation"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"post":{"operationId":"createWebhook","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Subscribe a receiver to events of the organization","description":"Events: `job.completed`, `job.failed`, `job.lost`, `version.published`, `version.deprecated`. Each delivery is a POST of a JSON envelope `{ id, type, createdAt, organizationId, data }` with `X-Sculdoc-Signature: t=<unix seconds>,v1=<hex>` (HMAC-SHA256 of `<t>.<body>` with the secret), `X-Sculdoc-Event`, `X-Sculdoc-Event-Id` and `X-Sculdoc-Delivery`. Receivers check the signature, refuse a timestamp older than 5 minutes and dedupe on the event id. Any non-2xx answer is retried with exponential backoff for 24 hours.","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri","description":"https receiver, on a public address"},"events":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEvent"},"minItems":1},"description":{"type":"string","maxLength":500},"active":{"type":"boolean"}},"required":["url","events"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreated"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listWebhooks","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Webhooks of the organization","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Webhooks","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["webhooks"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/callback-secret":{"get":{"operationId":"getCallbackSecret","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Secret signing the `callbackUrl` notifications of jobs (created on first use)","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Secret","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string","description":"HMAC-SHA256 key of the signatures (`whsec_…`), shown at creation and rotation only"}},"required":["secret"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/callback-secret/rotate":{"post":{"operationId":"rotateCallbackSecret","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Replace the callback secret (notifications already queued are signed with the new one)","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"New secret","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string","description":"HMAC-SHA256 key of the signatures (`whsec_…`), shown at creation and rotation only"}},"required":["secret"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{webhookId}":{"get":{"operationId":"getWebhook","tags":["Webhooks"],"security":[{"session":[]}],"summary":"A webhook","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"webhookId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Webhook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateWebhook","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Update a webhook (URL, events, activation) or rotate its secret","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"webhookId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri","description":"https receiver, on a public address"},"events":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEvent"},"minItems":1},"description":{"type":"string","maxLength":500},"active":{"type":"boolean"},"rotateSecret":{"type":"boolean","description":"The new secret is returned"}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookUpdated"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Delete a webhook and its delivery journal","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"webhookId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Deleted"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{webhookId}/deliveries":{"get":{"operationId":"listWebhookDeliveries","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Delivery journal of a webhook, newest first","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"webhookId","in":"path"},{"schema":{"type":"string","enum":["pending","succeeded","failed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","maxLength":50},"required":false,"name":"event","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","maxLength":500},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Deliveries","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"nextCursor":{"type":["string","null"]}},"required":["deliveries","nextCursor"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{webhookId}/deliveries/{deliveryId}/redeliver":{"post":{"operationId":"redeliverWebhookDelivery","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Deliver an event again (new delivery, same event id), to the current URL of the webhook","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"webhookId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"deliveryId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"202":{"description":"Queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{webhookId}/ping":{"post":{"operationId":"pingWebhook","tags":["Webhooks"],"security":[{"session":[]}],"summary":"Test the receiver: a signed `ping` event delivered now, once (journaled)","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"webhookId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Outcome of the delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api-keys":{"get":{"operationId":"listApiKeys","tags":["API keys"],"security":[{"session":[]}],"summary":"API keys of the organization (secrets are never returned)","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"API keys","content":{"application/json":{"schema":{"type":"object","properties":{"apiKeys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}},"required":["apiKeys"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createApiKey","tags":["API keys"],"security":[{"session":[]}],"summary":"Create an API key; the plaintext key is returned once","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"folderId":{"type":["string","null"],"minLength":1,"maxLength":64},"access":{"type":"string","enum":["render","publish"],"default":"render","description":"`render`: reads published contracts and renders. `publish`: also saves drafts, uploads assets and publishes (templates as code from a CI); publications are attributed to the creator of the key"},"expiresInDays":{"type":"integer","minimum":1,"maximum":3650},"rateLimit":{"type":"object","properties":{"max":{"type":"integer","minimum":1},"windowSeconds":{"type":"integer","minimum":1,"maximum":86400}},"required":["max","windowSeconds"],"description":"Default: 600 requests per minute"},"quota":{"type":"object","properties":{"remaining":{"type":"integer","minimum":0},"refillAmount":{"type":"integer","minimum":1},"refillIntervalDays":{"type":"integer","minimum":1,"maximum":366}},"required":["remaining"],"description":"Request budget, optionally refilled (e.g. monthly plan quota)"}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api-keys/{keyId}/rotate":{"post":{"operationId":"rotateApiKey","tags":["API keys"],"security":[{"session":[]}],"summary":"Rotate: new secret, same settings; the old key stops working immediately","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"keyId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"201":{"description":"Rotated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api-keys/{keyId}":{"delete":{"operationId":"revokeApiKey","tags":["API keys"],"security":[{"session":[]}],"summary":"Revoke an API key","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"keyId","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"204":{"description":"Revoked"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/invitations":{"post":{"operationId":"createInvitation","tags":["Invitations"],"security":[{"session":[]}],"summary":"Invite an e-mail address into the current organization","description":"The invitation is e-mailed (with a link to the web application) and expires after 7 days. The person signs in with an OIDC provider under that address, then accepts it (POST /invitations/{id}/accept). Only an owner invites an owner. `emailSent: false`: the invitation exists but the e-mail could not be sent (share the link).","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"role":{"type":"string","enum":["owner","admin","editor","viewer"],"default":"editor"}},"required":["email"]}}}},"responses":{"201":{"description":"Invitation","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Invitation"},{"type":"object","properties":{"emailSent":{"type":"boolean"},"url":{"type":"string"}},"required":["emailSent","url"]}]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listInvitations","tags":["Invitations"],"security":[{"session":[]}],"summary":"Invitations of the current organization (newest first)","parameters":[{"schema":{"type":"string","enum":["pending","accepted","rejected","canceled"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Invitations","content":{"application/json":{"schema":{"type":"object","properties":{"invitations":{"type":"array","items":{"$ref":"#/components/schemas/Invitation"}}},"required":["invitations"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/invitations/{id}":{"delete":{"operationId":"revokeInvitation","tags":["Invitations"],"security":[{"session":[]}],"summary":"Revoke a pending invitation","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/me/invitations":{"get":{"operationId":"listMyInvitations","tags":["Invitations"],"security":[{"session":[]}],"summary":"Pending invitations addressed to the e-mail of the signed-in user (verified by the provider)","responses":{"200":{"description":"Invitations","content":{"application/json":{"schema":{"type":"object","properties":{"invitations":{"type":"array","items":{"$ref":"#/components/schemas/Invitation"}}},"required":["invitations"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invitations/{id}/accept":{"post":{"operationId":"acceptInvitation","tags":["Invitations"],"security":[{"session":[]}],"summary":"Accept an invitation: join its organization with its role","description":"The invitation must be addressed to the e-mail of the signed-in user (404 otherwise), as verified by the sign-in provider (403 `invitation.email_unverified`), pending and not expired (409).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invitations/{id}/reject":{"post":{"operationId":"rejectInvitation","tags":["Invitations"],"security":[{"session":[]}],"summary":"Decline an invitation","description":"The invitation must be addressed to the e-mail of the signed-in user (404 otherwise), as verified by the sign-in provider (403 `invitation.email_unverified`), pending and not expired (409).","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Declined","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/organization/activity":{"get":{"operationId":"getActivity","tags":["Organizations"],"security":[{"session":[]}],"summary":"Latest events of the organization: publications, renders, members, invitations","description":"Newest first. `before` (ISO 8601, exclusive) pages backwards: pass the `at` of the last event received. `types` restricts the kinds of events (comma-separated). `invitation.sent` is shown to the managers of the organization only.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"before","in":"query"},{"schema":{"type":"string","description":"Comma-separated: version.published, version.deprecated, version.archived, render.succeeded, render.failed, member.joined, invitation.sent"},"required":false,"description":"Comma-separated: version.published, version.deprecated, version.archived, render.succeeded, render.failed, member.joined, invitation.sent","name":"types","in":"query"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/ActivityEvent"}}},"required":["events"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/starters":{"get":{"operationId":"listStarters","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Starter templates of the platform (POST /templates with `fromStarter`)","description":"An invoice, a bilingual calibration certificate, an expense claim and a letter, without any brand. A template created from a starter receives its content and samples as draft.","parameters":[{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"Starters","content":{"application/json":{"schema":{"type":"object","properties":{"starters":{"type":"array","items":{"$ref":"#/components/schemas/Starter"}}},"required":["starters"]}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/starters/{starter}/preview.png":{"get":{"operationId":"getStarterPreview","tags":["Templates"],"security":[{"session":[]},{"apiKey":[]}],"summary":"First page of a starter with its first sample, rendered by the engine","parameters":[{"schema":{"type":"string","maxLength":60},"required":true,"name":"starter","in":"path"},{"schema":{"type":"string","description":"Organization id or slug (signed-in users with several organizations)"},"required":false,"description":"Organization id or slug (signed-in users with several organizations)","name":"x-sculdoc-organization","in":"header"}],"responses":{"200":{"description":"PNG","content":{"image/png":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/model":{"get":{"operationId":"getModel","tags":["Model"],"security":[{"session":[]},{"apiKey":[]}],"summary":"The document model for editors: JSON Schema of the IR and catalog of nodes and properties","description":"Derived from the Zod schema of `packages/model`: node types with plain-language labels (FR/EN), category, icon, minimal node of the palette, and per property its label, optionality, options, bounds, compiler default and suggested editor control. Same for every organization; `ETag` for caching.","responses":{"200":{"description":"Model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model"}}}},"304":{"description":"Not modified"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/model/filters":{"get":{"operationId":"getModelFilters","tags":["Model"],"security":[{"session":[]},{"apiKey":[]}],"summary":"Filters and functions of the expression language, with signatures and checked examples","description":"Derived from `packages/expr`: every filter and function, its category, parameters, result type, FR/EN wording and examples whose results the tests check against `exampleScope`.","responses":{"200":{"description":"Expression language","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpressionLanguage"}}}},"304":{"description":"Not modified"},"400":{"description":"Malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict with the current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed (issues carry JSON paths)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}