{
  "openapi": "3.1.0",
  "info": {
    "title": "Snapfile API",
    "version": "1.0 (engine 1.1.0)",
    "description": "Snapfile: template editor backend and document render service.\n\n* `/api/v1` — public API for client services (API key: `Authorization: Bearer vk_live_…`).\n* `/internal/v1` — editor API (editor JWT from SSO handoff); also served as `/api/editor/v1`.\n* `/admin/v1` — super-admin API (session cookie); also served as `/api/admin/v1`.\n\nErrors use the envelope `{\"error\": {\"code\", \"message\", \"details\", \"request_id\"}}`."
  },
  "paths": {
    "/api/v1/project": {
      "get": {
        "operationId": "snapfile_integration_api_get_project",
        "summary": "A1. Project info, limits, output settings",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/templates": {
      "get": {
        "operationId": "snapfile_integration_api_list_templates",
        "summary": "A2. List templates",
        "parameters": [
          {
            "in": "query",
            "name": "tag",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tag"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "published",
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Published"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/templates/{key}": {
      "get": {
        "operationId": "snapfile_integration_api_get_template",
        "summary": "A3. Template card",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "title": "Key",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "lang",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Lang"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/templates/{key}/schema": {
      "get": {
        "operationId": "snapfile_integration_api_get_schema",
        "summary": "A4. Variable schema (JSON Schema or variable list)",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "title": "Key",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "default": "jsonschema",
              "title": "Format",
              "type": "string"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "default": "current",
              "title": "Version",
              "type": "string"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "lang",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Lang"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/templates/{key}/sample": {
      "get": {
        "operationId": "snapfile_integration_api_get_sample",
        "summary": "A5. Sample data",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "title": "Key",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "lang",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Lang"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/templates/{key}/render": {
      "post": {
        "operationId": "snapfile_integration_api_render",
        "summary": "A6. Render a document (sync / async)",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "title": "Key",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobEnvelope"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorOut"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorOut"
                }
              }
            }
          },
          "504": {
            "description": "Gateway Timeout",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorOut"
                }
              }
            }
          }
        },
        "tags": [
          "public"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/templates/{key}/validate": {
      "post": {
        "operationId": "snapfile_integration_api_validate",
        "summary": "A7. Validate data without rendering",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "title": "Key",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/templates/{key}/preview": {
      "post": {
        "operationId": "snapfile_integration_api_preview",
        "summary": "A8. Quick preview (PNG of the first pages, not stored long)",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "title": "Key",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/jobs/{job_id}": {
      "get": {
        "operationId": "snapfile_integration_api_get_job",
        "summary": "A10. Job status (long poll: ?wait=10)",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "schema": {
              "title": "Job Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 0,
              "title": "Wait",
              "type": "integer"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobEnvelope"
                }
              }
            }
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "snapfile_integration_api_delete",
        "summary": "A13. Delete a job and its files",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "schema": {
              "title": "Job Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/jobs": {
      "get": {
        "operationId": "snapfile_integration_api_list_jobs",
        "summary": "A11. List jobs",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "template",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Template"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "external_ref",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "External Ref"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "title": "Limit",
              "type": "integer"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobList"
                }
              }
            }
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/jobs/{job_id}/cancel": {
      "post": {
        "operationId": "snapfile_integration_api_cancel",
        "summary": "A12. Cancel a job",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "schema": {
              "title": "Job Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobEnvelope"
                }
              }
            }
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/jobs/{job_id}/files/{file_id}": {
      "get": {
        "operationId": "snapfile_integration_api_job_file",
        "summary": "A14. Download a file (302 to a signed URL)",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "schema": {
              "title": "Job Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "file_id",
            "schema": {
              "title": "File Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/edit-sessions": {
      "post": {
        "operationId": "snapfile_integration_api_create_edit_session",
        "summary": "A16. Issue a one-time editor link",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EditSessionEnvelope"
                }
              }
            }
          }
        },
        "tags": [
          "public"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditSessionIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/edit-sessions/revoke-user": {
      "post": {
        "operationId": "snapfile_integration_api_revoke_user_sessions",
        "summary": "A18. Revoke all sessions of a user",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeUserIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/edit-sessions/{session_id}": {
      "delete": {
        "operationId": "snapfile_integration_api_revoke_session",
        "summary": "A17. Revoke an editor session",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "schema": {
              "title": "Session Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/webhooks/deliveries": {
      "get": {
        "operationId": "snapfile_integration_api_deliveries",
        "summary": "A19. Webhook delivery log",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "title": "Limit",
              "type": "integer"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/webhooks/deliveries/{delivery_id}/redeliver": {
      "post": {
        "operationId": "snapfile_integration_api_redeliver",
        "summary": "A20. Redeliver a webhook",
        "parameters": [
          {
            "in": "path",
            "name": "delivery_id",
            "schema": {
              "title": "Delivery Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/webhooks/config": {
      "put": {
        "operationId": "snapfile_integration_api_webhook_config",
        "summary": "A21. Webhook URL and secret",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "public"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookConfigIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/internal/v1/auth/exchange": {
      "post": {
        "operationId": "snapfile_auth_sso_api_exchange",
        "summary": "Exchange a one-time SSO token for an access JWT",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: auth"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeIn"
              }
            }
          },
          "required": true
        }
      }
    },
    "/internal/v1/auth/refresh": {
      "post": {
        "operationId": "snapfile_auth_sso_api_refresh_token",
        "summary": "I1. Refresh the access JWT (refresh cookie, rotated)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: auth"
        ]
      }
    },
    "/internal/v1/auth/logout": {
      "post": {
        "operationId": "snapfile_auth_sso_api_logout",
        "summary": "I2. Logout (revokes the session)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: auth"
        ]
      }
    },
    "/internal/v1/me": {
      "get": {
        "operationId": "snapfile_auth_sso_api_me",
        "summary": "I3. Current user, role, permissions, project",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: auth"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/project": {
      "get": {
        "operationId": "snapfile_projects_api_get_project",
        "summary": "I4. Project settings, limits and dashboard stats",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: project"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/project/settings": {
      "patch": {
        "operationId": "snapfile_projects_api_patch_settings",
        "summary": "I5. Update project settings (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: project"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingsPatch"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/variables": {
      "get": {
        "operationId": "snapfile_projects_api_get_variables",
        "summary": "I26. Project variable schema (tree)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: project"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "put": {
        "operationId": "snapfile_projects_api_put_variables",
        "summary": "I27. Replace the variable schema (revision-checked)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: project"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VariablesPut"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates": {
      "get": {
        "operationId": "snapfile_doctemplates_api_list_templates",
        "summary": "I6. List templates",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "title": "Limit",
              "type": "integer"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "post": {
        "operationId": "snapfile_doctemplates_api_create_template",
        "summary": "I7. Create a template (blank, copy or import)",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateCreate"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}": {
      "get": {
        "operationId": "snapfile_doctemplates_api_get_template",
        "summary": "I8. Template with draft",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "patch": {
        "operationId": "snapfile_doctemplates_api_patch_template",
        "summary": "I9. Update metadata / sample data",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplatePatch"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "snapfile_doctemplates_api_delete_template",
        "summary": "I10. Delete (admin): soft by default; permanent=true removes an archived template with its generations",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "permanent",
            "schema": {
              "default": false,
              "title": "Permanent",
              "type": "boolean"
            },
            "required": false
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/duplicate": {
      "post": {
        "operationId": "snapfile_doctemplates_api_duplicate",
        "summary": "I11. Duplicate",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DuplicateIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/draft": {
      "put": {
        "operationId": "snapfile_doctemplates_api_put_draft",
        "summary": "I12. Autosave (full document, optimistic lock)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "If-Match"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DraftPut"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "patch": {
        "operationId": "snapfile_doctemplates_api_patch_draft",
        "summary": "I13. Autosave (RFC 6902 JSON Patch)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "If-Match"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DraftPatch"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/lock": {
      "post": {
        "operationId": "snapfile_doctemplates_api_lock",
        "summary": "I14. Take/extend the soft lock (TTL 90 s)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LockIn"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "required": false
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "snapfile_doctemplates_api_unlock",
        "summary": "I15. Release the lock",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/lock/heartbeat": {
      "post": {
        "operationId": "snapfile_doctemplates_api_lock_heartbeat",
        "summary": "Lock heartbeat (every 30 s)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/lock/takeover": {
      "post": {
        "operationId": "snapfile_doctemplates_api_lock_takeover",
        "summary": "Take over the lock (admin)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/validate": {
      "post": {
        "operationId": "snapfile_doctemplates_api_validate",
        "summary": "I16. Validate the draft",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/schema": {
      "get": {
        "operationId": "snapfile_doctemplates_api_schema",
        "summary": "Effective variables (project + template) and JSON Schema",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/sample-data": {
      "get": {
        "operationId": "snapfile_doctemplates_api_get_sample",
        "summary": "Sample (test) data of the template",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "put": {
        "operationId": "snapfile_doctemplates_api_put_sample",
        "summary": "Replace sample (test) data",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SampleDataIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/thumbnail": {
      "get": {
        "operationId": "snapfile_doctemplates_api_thumbnail",
        "summary": "PNG thumbnail of the first sheet of the draft (rendered lazily, cached by draft hash)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "h",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "H"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/variables/usage": {
      "get": {
        "operationId": "snapfile_doctemplates_api_variables_usage",
        "summary": "I29. Where variables are used (templates and node counts)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/preview": {
      "post": {
        "operationId": "snapfile_doctemplates_api_preview",
        "summary": "I17. Render the draft with test data (PDF or PNG)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/publish": {
      "post": {
        "operationId": "snapfile_doctemplates_api_publish",
        "summary": "I18. Publish the draft",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: templates"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/versions": {
      "get": {
        "operationId": "snapfile_doctemplates_api_versions",
        "summary": "I19. Versions",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/versions/{number}": {
      "get": {
        "operationId": "snapfile_doctemplates_api_version",
        "summary": "I20. Version document",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "number",
            "schema": {
              "title": "Number",
              "type": "integer"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/versions/{number}/activate": {
      "post": {
        "operationId": "snapfile_doctemplates_api_activate",
        "summary": "I21. Make a version current (admin)",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "number",
            "schema": {
              "title": "Number",
              "type": "integer"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/templates/{template_id}/versions/{number}/restore": {
      "post": {
        "operationId": "snapfile_doctemplates_api_restore",
        "summary": "I22. Copy a version into the draft",
        "parameters": [
          {
            "in": "path",
            "name": "template_id",
            "schema": {
              "title": "Template Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "number",
            "schema": {
              "title": "Number",
              "type": "integer"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: templates"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/assets": {
      "get": {
        "operationId": "snapfile_assets_api_list_assets",
        "summary": "I30. Asset library",
        "parameters": [
          {
            "in": "query",
            "name": "folder",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Folder"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "title": "Limit",
              "type": "integer"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "post": {
        "operationId": "snapfile_assets_api_upload_assets",
        "summary": "I31. Upload images (multipart files[], up to 20)",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "files": {
                    "items": {
                      "format": "binary",
                      "type": "string"
                    },
                    "title": "Files",
                    "type": "array"
                  },
                  "folder": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "title": "Folder"
                  }
                },
                "required": [
                  "files"
                ],
                "title": "MultiPartBodyParams",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/assets/from-url": {
      "post": {
        "operationId": "snapfile_assets_api_upload_from_url",
        "summary": "I32. Upload an image by URL (SSRF-protected)",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FromUrlIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/assets/clipboard": {
      "post": {
        "operationId": "snapfile_assets_api_clipboard_token",
        "summary": "Copy layers: a signed token for the images and fonts they use",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "description": "Layers copied in one project and pasted in another bring their files along: the token names this project's\nassets and fonts, POST assets/import in the other project copies them there. Signed, valid for a week.",
        "tags": [
          "internal: assets & fonts"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClipboardIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/assets/import": {
      "post": {
        "operationId": "snapfile_assets_api_clipboard_import",
        "summary": "Paste layers: copy the images and fonts of a clipboard token into this project",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/assets/{asset_id}": {
      "patch": {
        "operationId": "snapfile_assets_api_patch_asset",
        "summary": "I33. Rename / move to folder",
        "parameters": [
          {
            "in": "path",
            "name": "asset_id",
            "schema": {
              "title": "Asset Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssetPatch"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "snapfile_assets_api_delete_asset",
        "summary": "I34. Delete (409 ASSET_IN_USE when referenced)",
        "parameters": [
          {
            "in": "path",
            "name": "asset_id",
            "schema": {
              "title": "Asset Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "force",
            "schema": {
              "default": false,
              "title": "Force",
              "type": "boolean"
            },
            "required": false
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/assets/{asset_id}/file": {
      "get": {
        "operationId": "snapfile_assets_api_asset_file",
        "summary": "I35. Asset file (original or thumb)",
        "parameters": [
          {
            "in": "path",
            "name": "asset_id",
            "schema": {
              "title": "Asset Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "variant",
            "schema": {
              "default": "original",
              "title": "Variant",
              "type": "string"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/fonts": {
      "get": {
        "operationId": "snapfile_assets_api_list_fonts",
        "summary": "I36. Project + system fonts",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "post": {
        "operationId": "snapfile_assets_api_upload_fonts",
        "summary": "I37. Upload TTF/OTF/WOFF/WOFF2 (OTF->TTF, metrics.json)",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "files": {
                    "items": {
                      "format": "binary",
                      "type": "string"
                    },
                    "title": "Files",
                    "type": "array"
                  }
                },
                "required": [
                  "files"
                ],
                "title": "FileParams",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/fonts/{font_id}": {
      "delete": {
        "operationId": "snapfile_assets_api_delete_font",
        "summary": "I38. Delete a project font (admin)",
        "parameters": [
          {
            "in": "path",
            "name": "font_id",
            "schema": {
              "title": "Font Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/fonts/{font_id}/file": {
      "get": {
        "operationId": "snapfile_assets_api_font_file",
        "summary": "I39. Font file for the editor (WOFF2 or TTF)",
        "parameters": [
          {
            "in": "path",
            "name": "font_id",
            "schema": {
              "title": "Font Id",
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "default": "woff2",
              "title": "Format",
              "type": "string"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/fonts/{font_id}/metrics": {
      "get": {
        "operationId": "snapfile_assets_api_font_metrics",
        "summary": "I40. metrics.json (spec/text-layout.md section 4)",
        "parameters": [
          {
            "in": "path",
            "name": "font_id",
            "schema": {
              "title": "Font Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: assets & fonts"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/jobs": {
      "get": {
        "operationId": "snapfile_jobs_api_list_jobs",
        "summary": "I42. Generation history (render + preview)",
        "parameters": [
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "template",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Template"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "title": "Limit",
              "type": "integer"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: jobs"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/jobs/stats": {
      "get": {
        "operationId": "snapfile_jobs_api_jobs_stats",
        "summary": "Generation statistics per day (count, failures, p95 duration)",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "schema": {
              "default": 7,
              "title": "Days",
              "type": "integer"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": "render",
              "title": "Kind"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: jobs"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/preview-jobs/{job_id}": {
      "get": {
        "operationId": "snapfile_jobs_api_preview_job",
        "summary": "Preview job status (editor polling)",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "schema": {
              "title": "Job Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: jobs"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/api-keys": {
      "get": {
        "operationId": "snapfile_integration_internal_api_list_keys",
        "summary": "API keys of the project (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "post": {
        "operationId": "snapfile_integration_internal_api_create_key",
        "summary": "Create an API key (secret shown once, admin)",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: integration"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyCreateIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/service-key": {
      "post": {
        "operationId": "snapfile_integration_internal_api_issue_service_key",
        "summary": "Generate a key of the service (admin)",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "description": "The newest key signs the connector requests and the webhooks. The other keys work until they are revoked.",
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/api-keys/{key_id}/purge": {
      "delete": {
        "operationId": "snapfile_integration_internal_api_purge_key",
        "summary": "Delete a revoked or expired key",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "schema": {
              "title": "Key Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/api-keys/{key_id}/rotate": {
      "post": {
        "operationId": "snapfile_integration_internal_api_rotate",
        "summary": "Rotate a key (admin)",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "schema": {
              "title": "Key Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/api-keys/{key_id}": {
      "delete": {
        "operationId": "snapfile_integration_internal_api_revoke",
        "summary": "Revoke a key (admin)",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "schema": {
              "title": "Key Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/webhook": {
      "get": {
        "operationId": "snapfile_integration_internal_api_get_webhook",
        "summary": "Project webhook settings (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "put": {
        "operationId": "snapfile_integration_internal_api_put_webhook",
        "summary": "Update the project webhook: URL, events, on/off, secret (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/webhook/test": {
      "post": {
        "operationId": "snapfile_integration_internal_api_test_webhook",
        "summary": "Send a signed webhook.test event now (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/service": {
      "get": {
        "operationId": "snapfile_integration_internal_api_get_service_connector",
        "summary": "Client service connector (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      },
      "put": {
        "operationId": "snapfile_integration_internal_api_put_service_connector",
        "summary": "Set the client service connector; a new secret is shown once (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceConnectorIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/integration/service/test": {
      "post": {
        "operationId": "snapfile_integration_internal_api_test_service_connector",
        "summary": "Ask the service for its lists now (admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/service/languages": {
      "get": {
        "operationId": "snapfile_integration_internal_api_service_languages",
        "summary": "Languages of the client service",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/internal/v1/service/users": {
      "get": {
        "operationId": "snapfile_integration_internal_api_service_users",
        "summary": "Users of the client service (admin), filtered by q",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "internal: integration"
        ],
        "security": [
          {
            "EditorJwtAuth": []
          }
        ]
      }
    },
    "/admin/v1/login": {
      "post": {
        "operationId": "snapfile_core_admin_api_login",
        "summary": "Super-admin login (.env credentials) -> session cookie",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginIn"
              }
            }
          },
          "required": true
        }
      }
    },
    "/admin/v1/logout": {
      "post": {
        "operationId": "snapfile_core_admin_api_logout",
        "summary": "Logout",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/me": {
      "get": {
        "operationId": "snapfile_core_admin_api_me",
        "summary": "Current super-admin",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/projects": {
      "get": {
        "operationId": "snapfile_core_admin_api_list_projects",
        "summary": "List projects",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      },
      "post": {
        "operationId": "snapfile_core_admin_api_create_project",
        "summary": "Create a project",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "admin"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/projects/{project_id}": {
      "get": {
        "operationId": "snapfile_core_admin_api_get_project",
        "summary": "Project details",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "schema": {
              "title": "Project Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      },
      "patch": {
        "operationId": "snapfile_core_admin_api_patch_project",
        "summary": "Update a project (suspend, limits, origins, ...)",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "schema": {
              "title": "Project Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectPatch"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "snapfile_core_admin_api_delete_project",
        "summary": "Soft-delete a project",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "schema": {
              "title": "Project Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/projects/{project_id}/api-keys": {
      "get": {
        "operationId": "snapfile_core_admin_api_list_keys",
        "summary": "List API keys of a project",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "schema": {
              "title": "Project Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      },
      "post": {
        "operationId": "snapfile_core_admin_api_create_key",
        "summary": "Create an API key (secret shown once)",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "schema": {
              "title": "Project Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "admin"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyIn"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/api-keys/{key_id}/rotate": {
      "post": {
        "operationId": "snapfile_core_admin_api_rotate",
        "summary": "Rotate a key (old one valid for 7 days)",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "schema": {
              "title": "Key Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response",
                  "type": "object"
                }
              }
            }
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/api-keys/{key_id}": {
      "delete": {
        "operationId": "snapfile_core_admin_api_revoke_key",
        "summary": "Revoke a key",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "schema": {
              "title": "Key Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/projects/{project_id}/editor-session": {
      "post": {
        "operationId": "snapfile_core_admin_api_editor_session",
        "summary": "Enter the editor of a project as super-admin",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "schema": {
              "title": "Project Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/EditorSessionIn"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "required": false
        },
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/system": {
      "get": {
        "operationId": "snapfile_core_admin_api_system",
        "summary": "Environment diagnostics (like snapfile_doctor)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/jobs": {
      "get": {
        "operationId": "snapfile_core_admin_api_list_jobs",
        "summary": "Generations across projects (newest first), e.g. status=failed",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "project",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "title": "Limit",
              "type": "integer"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/audit": {
      "get": {
        "operationId": "snapfile_core_admin_api_audit_log",
        "summary": "Audit log (newest first), optionally for one project",
        "parameters": [
          {
            "in": "query",
            "name": "project",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "title": "Limit",
              "type": "integer"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    },
    "/admin/v1/jobs/{job_id}/requeue": {
      "post": {
        "operationId": "snapfile_core_admin_api_requeue",
        "summary": "Requeue a failed job",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "schema": {
              "title": "Job Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "admin"
        ],
        "security": [
          {
            "SuperAdminAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "FileOut": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "filename": {
            "title": "Filename",
            "type": "string"
          },
          "mime": {
            "title": "Mime",
            "type": "string"
          },
          "size_bytes": {
            "title": "Size Bytes",
            "type": "integer"
          },
          "sha256": {
            "title": "Sha256",
            "type": "string"
          },
          "page": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Page"
          },
          "width_px": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Width Px"
          },
          "height_px": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Height Px"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          },
          "expires_at": {
            "title": "Expires At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "filename",
          "mime",
          "size_bytes",
          "sha256",
          "expires_at"
        ],
        "title": "FileOut",
        "type": "object"
      },
      "JobEnvelope": {
        "properties": {
          "job": {
            "$ref": "#/components/schemas/JobOut"
          }
        },
        "required": [
          "job"
        ],
        "title": "JobEnvelope",
        "type": "object"
      },
      "JobError": {
        "properties": {
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code"
          },
          "message": {
            "title": "Message",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "title": "JobError",
        "type": "object"
      },
      "JobOut": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "canceled",
              "expired"
            ],
            "title": "Status",
            "type": "string"
          },
          "mode": {
            "title": "Mode",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "attempts": {
            "title": "Attempts",
            "type": "integer"
          },
          "template": {
            "$ref": "#/components/schemas/JobTemplateRef"
          },
          "pages": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pages"
          },
          "files": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/FileOut"
            },
            "title": "Files",
            "type": "array"
          },
          "warnings": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Warnings",
            "type": "array"
          },
          "timings": {
            "additionalProperties": true,
            "default": {},
            "title": "Timings",
            "type": "object"
          },
          "external_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Ref"
          },
          "status_url": {
            "title": "Status Url",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "queued_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Queued At"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "finished_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/JobError"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status",
          "mode",
          "kind",
          "attempts",
          "template",
          "status_url",
          "created_at"
        ],
        "title": "JobOut",
        "type": "object"
      },
      "JobTemplateRef": {
        "properties": {
          "key": {
            "title": "Key",
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version"
          }
        },
        "required": [
          "key",
          "version"
        ],
        "title": "JobTemplateRef",
        "type": "object"
      },
      "ErrorItem": {
        "properties": {
          "code": {
            "title": "Code",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "details": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Details",
            "type": "array"
          },
          "request_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Request Id"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "title": "ErrorItem",
        "type": "object"
      },
      "ErrorOut": {
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorItem"
          }
        },
        "required": [
          "error"
        ],
        "title": "ErrorOut",
        "type": "object"
      },
      "OutputIn": {
        "properties": {
          "format": {
            "default": "pdf",
            "enum": [
              "pdf",
              "png",
              "jpg"
            ],
            "title": "Format",
            "type": "string"
          },
          "dpi": {
            "default": 150,
            "maximum": 600,
            "minimum": 36,
            "title": "Dpi",
            "type": "integer"
          },
          "quality": {
            "default": 85,
            "maximum": 100,
            "minimum": 1,
            "title": "Quality",
            "type": "integer"
          },
          "split": {
            "anyOf": [
              {
                "enum": [
                  "per_sheet",
                  "zip",
                  "first"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Split"
          },
          "pages": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Page ranges, e.g. \"1-3,5\"",
            "title": "Pages"
          },
          "background": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Background"
          },
          "pdfa": {
            "anyOf": [
              {
                "enum": [
                  "1b",
                  "2b"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pdfa"
          },
          "store": {
            "default": true,
            "title": "Store",
            "type": "boolean"
          },
          "ttl_hours": {
            "anyOf": [
              {
                "maximum": 720,
                "minimum": 1,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ttl Hours"
          },
          "filename": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "locale": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Formatting locale; default data.lang, then project",
            "title": "Locale"
          }
        },
        "title": "OutputIn",
        "type": "object"
      },
      "RenderIn": {
        "properties": {
          "version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "const": "current",
                "type": "string"
              }
            ],
            "default": "current",
            "title": "Version"
          },
          "lang": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Language: picks the group's default template for it (key = group key); default data.lang",
            "title": "Lang"
          },
          "mode": {
            "default": "auto",
            "enum": [
              "sync",
              "async",
              "auto"
            ],
            "title": "Mode",
            "type": "string"
          },
          "data": {
            "additionalProperties": true,
            "title": "Data",
            "type": "object"
          },
          "output": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OutputIn"
              }
            ]
          },
          "validation": {
            "default": "strict",
            "enum": [
              "strict",
              "lenient"
            ],
            "title": "Validation",
            "type": "string"
          },
          "external_ref": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Ref"
          },
          "webhook_url": {
            "anyOf": [
              {
                "maxLength": 512,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url"
          },
          "deterministic": {
            "default": false,
            "title": "Deterministic",
            "type": "boolean"
          }
        },
        "title": "RenderIn",
        "type": "object"
      },
      "ValidateIn": {
        "properties": {
          "version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "const": "current",
                "type": "string"
              }
            ],
            "default": "current",
            "title": "Version"
          },
          "lang": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Language, as in render; default data.lang",
            "title": "Lang"
          },
          "data": {
            "additionalProperties": true,
            "title": "Data",
            "type": "object"
          },
          "validation": {
            "default": "strict",
            "enum": [
              "strict",
              "lenient"
            ],
            "title": "Validation",
            "type": "string"
          }
        },
        "title": "ValidateIn",
        "type": "object"
      },
      "PreviewIn": {
        "properties": {
          "data": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          },
          "format": {
            "default": "png",
            "enum": [
              "pdf",
              "png",
              "jpg"
            ],
            "title": "Format",
            "type": "string"
          },
          "pages": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "integer"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pages"
          },
          "dpi": {
            "default": 110,
            "maximum": 300,
            "minimum": 36,
            "title": "Dpi",
            "type": "integer"
          },
          "highlightMissing": {
            "default": false,
            "title": "Highlightmissing",
            "type": "boolean"
          },
          "version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Render a published version instead of the draft",
            "title": "Version"
          }
        },
        "title": "PreviewIn",
        "type": "object"
      },
      "JobList": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/JobOut"
            },
            "title": "Data",
            "type": "array"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor"
          }
        },
        "required": [
          "data",
          "next_cursor"
        ],
        "title": "JobList",
        "type": "object"
      },
      "EditSessionEnvelope": {
        "properties": {
          "session": {
            "$ref": "#/components/schemas/EditSessionOut"
          }
        },
        "required": [
          "session"
        ],
        "title": "EditSessionEnvelope",
        "type": "object"
      },
      "EditSessionOut": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          },
          "sso_url": {
            "title": "Sso Url",
            "type": "string"
          },
          "handoff_expires_at": {
            "title": "Handoff Expires At",
            "type": "string"
          },
          "expires_at": {
            "title": "Expires At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "sso_url",
          "handoff_expires_at",
          "expires_at"
        ],
        "title": "EditSessionOut",
        "type": "object"
      },
      "EditSessionIn": {
        "properties": {
          "user": {
            "$ref": "#/components/schemas/EditUser"
          },
          "role": {
            "default": "editor",
            "enum": [
              "viewer",
              "editor",
              "admin"
            ],
            "title": "Role",
            "type": "string"
          },
          "permissions": {
            "additionalProperties": {
              "type": "boolean"
            },
            "title": "Permissions",
            "type": "object"
          },
          "templates": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Templates"
          },
          "open": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Open"
          },
          "locale": {
            "anyOf": [
              {
                "enum": [
                  "ru",
                  "en"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Locale"
          },
          "return_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Return Url"
          },
          "client_session_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Session Ref"
          },
          "ttl_minutes": {
            "default": 480,
            "maximum": 1440,
            "minimum": 5,
            "title": "Ttl Minutes",
            "type": "integer"
          }
        },
        "required": [
          "user"
        ],
        "title": "EditSessionIn",
        "type": "object"
      },
      "EditUser": {
        "properties": {
          "id": {
            "maxLength": 191,
            "title": "Id",
            "type": "string"
          },
          "name": {
            "maxLength": 255,
            "title": "Name",
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Url"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "title": "EditUser",
        "type": "object"
      },
      "RevokeUserIn": {
        "properties": {
          "external_user_id": {
            "title": "External User Id",
            "type": "string"
          }
        },
        "required": [
          "external_user_id"
        ],
        "title": "RevokeUserIn",
        "type": "object"
      },
      "WebhookConfigIn": {
        "properties": {
          "url": {
            "anyOf": [
              {
                "maxLength": 512,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          },
          "rotate_secret": {
            "default": false,
            "title": "Rotate Secret",
            "type": "boolean"
          }
        },
        "title": "WebhookConfigIn",
        "type": "object"
      },
      "ExchangeIn": {
        "properties": {
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "title": "ExchangeIn",
        "type": "object"
      },
      "SettingsPatch": {
        "properties": {
          "settings": {
            "additionalProperties": true,
            "title": "Settings",
            "type": "object"
          }
        },
        "required": [
          "settings"
        ],
        "title": "SettingsPatch",
        "type": "object"
      },
      "VariablesPut": {
        "properties": {
          "base_revision": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Revision"
          },
          "variables": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Variables",
            "type": "array"
          }
        },
        "title": "VariablesPut",
        "type": "object"
      },
      "TemplateCreate": {
        "properties": {
          "key": {
            "maxLength": 64,
            "title": "Key",
            "type": "string"
          },
          "name": {
            "maxLength": 255,
            "title": "Name",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags"
          },
          "format": {
            "default": "A4",
            "enum": [
              "A3",
              "A4",
              "A5",
              "Letter",
              "Legal"
            ],
            "title": "Format",
            "type": "string"
          },
          "orientation": {
            "default": "portrait",
            "enum": [
              "portrait",
              "landscape"
            ],
            "title": "Orientation",
            "type": "string"
          },
          "document": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Import an existing scene graph",
            "title": "Document"
          },
          "from_template_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Create as a copy of another template",
            "title": "From Template Id"
          },
          "sample_data": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Data"
          }
        },
        "required": [
          "key",
          "name"
        ],
        "title": "TemplateCreate",
        "type": "object"
      },
      "TemplatePatch": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "language": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Language code; \"\" clears it",
            "title": "Language"
          },
          "archived": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Archive (switch off for the API) or bring back; admin only",
            "title": "Archived"
          },
          "group_key": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "API group key, e.g. \"aga-proposal\"; \"\" clears it",
            "title": "Group Key"
          },
          "is_default": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Default template of its language within the group",
            "title": "Is Default"
          },
          "allowed_users": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "[{\"id\": external user id, \"name\": snapshot}]; empty = everyone in the project",
            "title": "Allowed Users"
          },
          "default_format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Format"
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags"
          },
          "output_defaults": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Output Defaults"
          },
          "sample_data": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Data"
          },
          "test_data_sets": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Named test data sets [{\"id\", \"name\", \"data\"}]; the set with id \"sample\" is sample_data",
            "title": "Test Data Sets"
          },
          "variables_override": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Variables Override"
          }
        },
        "title": "TemplatePatch",
        "type": "object"
      },
      "DuplicateIn": {
        "properties": {
          "key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "language": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Language"
          },
          "as_variant": {
            "default": false,
            "title": "As Variant",
            "type": "boolean"
          }
        },
        "title": "DuplicateIn",
        "type": "object"
      },
      "DraftPut": {
        "properties": {
          "base_revision": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Revision"
          },
          "baseVersion": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Baseversion"
          },
          "document": {
            "additionalProperties": true,
            "title": "Document",
            "type": "object"
          },
          "client_ts": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Ts"
          }
        },
        "required": [
          "document"
        ],
        "title": "DraftPut",
        "type": "object"
      },
      "DraftPatch": {
        "properties": {
          "base_revision": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Revision"
          },
          "baseVersion": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Baseversion"
          },
          "ops": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Ops",
            "type": "array"
          }
        },
        "required": [
          "ops"
        ],
        "title": "DraftPatch",
        "type": "object"
      },
      "LockIn": {
        "properties": {
          "takeover": {
            "default": false,
            "title": "Takeover",
            "type": "boolean"
          }
        },
        "title": "LockIn",
        "type": "object"
      },
      "SampleDataIn": {
        "properties": {
          "sample_data": {
            "additionalProperties": true,
            "title": "Sample Data",
            "type": "object"
          }
        },
        "required": [
          "sample_data"
        ],
        "title": "SampleDataIn",
        "type": "object"
      },
      "PublishIn": {
        "properties": {
          "base_revision": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Revision"
          },
          "comment": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Comment"
          },
          "check_render": {
            "default": true,
            "title": "Check Render",
            "type": "boolean"
          },
          "acknowledge_warnings": {
            "items": {
              "type": "string"
            },
            "title": "Acknowledge Warnings",
            "type": "array"
          }
        },
        "title": "PublishIn",
        "type": "object"
      },
      "FromUrlIn": {
        "properties": {
          "url": {
            "title": "Url",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "folder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Folder"
          }
        },
        "required": [
          "url"
        ],
        "title": "FromUrlIn",
        "type": "object"
      },
      "ClipboardIn": {
        "properties": {
          "assets": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Assets",
            "type": "array"
          },
          "fonts": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Fonts",
            "type": "array"
          }
        },
        "title": "ClipboardIn",
        "type": "object"
      },
      "ImportIn": {
        "properties": {
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "title": "ImportIn",
        "type": "object"
      },
      "AssetPatch": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "folder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Folder"
          }
        },
        "title": "AssetPatch",
        "type": "object"
      },
      "KeyCreateIn": {
        "properties": {
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "env": {
            "default": "live",
            "enum": [
              "live",
              "test"
            ],
            "title": "Env",
            "type": "string"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "name"
        ],
        "title": "KeyCreateIn",
        "type": "object"
      },
      "WebhookIn": {
        "properties": {
          "url": {
            "anyOf": [
              {
                "maxLength": 512,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          },
          "events": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Events"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "rotate_secret": {
            "default": false,
            "title": "Rotate Secret",
            "type": "boolean"
          }
        },
        "title": "WebhookIn",
        "type": "object"
      },
      "ServiceConnectorIn": {
        "properties": {
          "base_url": {
            "anyOf": [
              {
                "maxLength": 512,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Empty string disconnects the service",
            "title": "Base Url"
          },
          "secret": {
            "anyOf": [
              {
                "maxLength": 255,
                "minLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secret"
          },
          "rotate_secret": {
            "default": false,
            "title": "Rotate Secret",
            "type": "boolean"
          }
        },
        "title": "ServiceConnectorIn",
        "type": "object"
      },
      "LoginIn": {
        "properties": {
          "login": {
            "title": "Login",
            "type": "string"
          },
          "password": {
            "title": "Password",
            "type": "string"
          },
          "totp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Totp"
          }
        },
        "required": [
          "login",
          "password"
        ],
        "title": "LoginIn",
        "type": "object"
      },
      "ProjectIn": {
        "properties": {
          "slug": {
            "maxLength": 64,
            "title": "Slug",
            "type": "string"
          },
          "name": {
            "maxLength": 255,
            "title": "Name",
            "type": "string"
          },
          "client_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Name"
          },
          "client_base_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Base Url"
          },
          "introspection_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Introspection Url"
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url"
          },
          "allowed_origins": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Origins"
          },
          "settings": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Settings"
          }
        },
        "required": [
          "slug",
          "name"
        ],
        "title": "ProjectIn",
        "type": "object"
      },
      "ProjectPatch": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "client_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Name"
          },
          "client_base_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Base Url"
          },
          "introspection_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Introspection Url"
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url"
          },
          "allowed_origins": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Origins"
          },
          "settings": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Settings"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          }
        },
        "title": "ProjectPatch",
        "type": "object"
      },
      "KeyIn": {
        "properties": {
          "name": {
            "maxLength": 128,
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scopes"
          },
          "env": {
            "default": "live",
            "title": "Env",
            "type": "string"
          },
          "require_signature": {
            "default": false,
            "title": "Require Signature",
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ],
        "title": "KeyIn",
        "type": "object"
      },
      "EditorSessionIn": {
        "properties": {
          "template": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Template"
          }
        },
        "title": "EditorSessionIn",
        "type": "object"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "EditorJwtAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "SuperAdminAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "sessionid"
      }
    }
  },
  "servers": []
}
