{
  "openapi": "3.0.3",
  "info": {
    "title": "LF Drive API",
    "version": "1.0.0",
    "description": "Server-to-server API. Requires active Pro or Studio and a verified email. Studio-only operations keep their plan restrictions. Mutation requests require Idempotency-Key."
  },
  "servers": [
    {
      "url": "https://lfdrive.ru/api/v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/account": {
      "get": {
        "operationId": "account",
        "summary": "Аккаунт, тариф, лимиты и права токена",
        "description": "Scope: account:read. Pro and Studio. ",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Account"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "email": "owner@example.ru",
                    "plan": "pro",
                    "subscription_status": "active",
                    "scopes": [
                      "account:read",
                      "files:read"
                    ],
                    "storage": {
                      "used_bytes": 102400,
                      "reserved_bytes": 0,
                      "limit_bytes": 5368709120
                    },
                    "traffic": {
                      "used_bytes": 0,
                      "limit_bytes": 500000000000,
                      "unlimited": false
                    },
                    "limits": {
                      "requests_per_minute": 120,
                      "uploads_per_minute": 10
                    },
                    "capabilities": {
                      "api": true,
                      "branding": false,
                      "domains": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/files": {
      "get": {
        "operationId": "files_list",
        "summary": "Список файлов",
        "description": "Scope: files:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/FilePage"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "name": "guide.pdf",
                        "mime_type": "application/pdf",
                        "size_bytes": 102400,
                        "category": "pdf",
                        "project_id": null,
                        "status": "active",
                        "url": "https://lfdrive.ru/f/Example1.pdf",
                        "access": {
                          "password_enabled": false,
                          "allowed_domains": [],
                          "expires_at": null,
                          "one_time": false,
                          "consumed_at": null,
                          "pdf_protected": false,
                          "force_download": false
                        }
                      }
                    ],
                    "next_before_id": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "files_upload",
        "summary": "Загрузить файл",
        "description": "Scope: files:write. Pro and Studio. Файл проходит штатную проверку типов, антивирус и резервирование хранилища. Лимит зависит от PHP и тарифа.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Один файл"
                  },
                  "project_id": {
                    "type": "integer",
                    "description": "ID проекта; можно не передавать",
                    "minimum": 1
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        }
      }
    },
    "/files/{id}": {
      "get": {
        "operationId": "files_get",
        "summary": "Файл и публичная ссылка",
        "description": "Scope: files:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "files_patch",
        "summary": "Переименовать или переместить файл",
        "description": "Scope: files:write. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Имя с прежним расширением",
                    "maxLength": 200
                  },
                  "project_id": {
                    "type": "integer",
                    "description": "ID проекта; null — убрать из проекта",
                    "minimum": 1,
                    "nullable": true
                  }
                }
              },
              "example": {
                "name": "guide.pdf",
                "project_id": null
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "files_delete",
        "summary": "Удалить файл и историю",
        "description": "Scope: files:delete. Pro and Studio. Удаление необратимо. Штатная функция запрещает удаление файлов с действующими покупками.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/files/{id}/replace": {
      "post": {
        "operationId": "files_replace",
        "summary": "Заменить файл с сохранением кода ссылки",
        "description": "Scope: files:write. Pro and Studio. При смене расширения изменится суффикс рекомендуемого URL, публичный код останется прежним. Действующие покупки сохраняют свой снимок по правилам LF Drive.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "without_history": {
                    "type": "string",
                    "enum": [
                      "true",
                      "false"
                    ],
                    "description": "По умолчанию false; true не сохраняет текущий файл в историю"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        }
      }
    },
    "/files/{id}/link": {
      "get": {
        "operationId": "links_get",
        "summary": "Настройки доступа ссылки",
        "description": "Scope: files:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/FileAccess"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "password_enabled": true,
                    "allowed_domains": [
                      "example.ru"
                    ],
                    "expires_at": null,
                    "one_time": false,
                    "consumed_at": null,
                    "pdf_protected": false,
                    "force_download": false
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "links_patch",
        "summary": "Настроить доступ",
        "description": "Scope: links:write. Pro and Studio. Срок и одноразовость несовместимы. Продажа несовместима с паролем, доменами, одноразовостью и защитой PDF. Пустой PATCH не сбрасывает использование ссылки.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/FileAccess"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "password_enabled": true,
                    "allowed_domains": [
                      "example.ru"
                    ],
                    "expires_at": null,
                    "one_time": false,
                    "consumed_at": null,
                    "pdf_protected": false,
                    "force_download": false
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "password": {
                    "type": "string",
                    "description": "Пароль 1–72 байта UTF-8; null — удалить",
                    "maxLength": 72,
                    "nullable": true
                  },
                  "allowed_domains": {
                    "type": "array",
                    "description": "Массив доменов без протокола; [] — снять ограничение",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expires_at": {
                    "type": "string",
                    "description": "Будущая ISO 8601 дата с часовым поясом; null — без срока",
                    "maxLength": 40,
                    "nullable": true
                  },
                  "one_time": {
                    "type": "boolean",
                    "description": "Одноразовый доступ"
                  },
                  "reset_consumed": {
                    "type": "boolean",
                    "description": "Явно разрешить использовать одноразовую ссылку снова"
                  },
                  "pdf_protected": {
                    "type": "boolean",
                    "description": "Защищённый PDF-ридер"
                  },
                  "force_download": {
                    "type": "boolean",
                    "description": "Принудительное скачивание"
                  }
                }
              },
              "example": {
                "password": null,
                "allowed_domains": [
                  "example.ru"
                ],
                "one_time": false,
                "expires_at": null
              }
            }
          }
        }
      }
    },
    "/files/{id}/versions": {
      "get": {
        "operationId": "versions_list",
        "summary": "История версий",
        "description": "Scope: versions:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/VersionPage"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "orig_name": "guide.pdf",
                        "mime_type": "application/pdf",
                        "size_bytes": 102400,
                        "pinned": 0,
                        "label": "Согласовано"
                      }
                    ],
                    "next_before_id": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/files/{id}/versions/{version_id}/restore": {
      "post": {
        "operationId": "versions_restore",
        "summary": "Восстановить версию",
        "description": "Scope: versions:write. Pro and Studio. Текущая версия попадёт в историю. Применяются текущие правила хранения LF Drive.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "version_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "version_id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/File"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "category": "pdf",
                    "project_id": null,
                    "status": "active",
                    "url": "https://lfdrive.ru/f/Example1.pdf",
                    "access": {
                      "password_enabled": false,
                      "allowed_domains": [],
                      "expires_at": null,
                      "one_time": false,
                      "consumed_at": null,
                      "pdf_protected": false,
                      "force_download": false
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/files/{id}/versions/{version_id}": {
      "patch": {
        "operationId": "versions_patch",
        "summary": "Подпись и закрепление версии",
        "description": "Scope: versions:write. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "version_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "version_id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Version"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "orig_name": "guide.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 102400,
                    "pinned": 0,
                    "label": "Согласовано"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "Подпись",
                    "maxLength": 120
                  },
                  "pinned": {
                    "type": "boolean",
                    "description": "Закрепить; только Studio"
                  }
                }
              },
              "example": {
                "label": "Согласовано"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "versions_delete",
        "summary": "Удалить прошлую версию",
        "description": "Scope: versions:delete. Pro and Studio. Версии, необходимые для действующих покупок, не удаляются.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "version_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "version_id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/projects": {
      "get": {
        "operationId": "projects_list",
        "summary": "Список проектов",
        "description": "Scope: projects:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ProjectPage"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "name": "Материалы сайта",
                        "created_at": "2026-10-14 00:00:00"
                      }
                    ],
                    "next_before_id": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "projects_create",
        "summary": "Создать проект",
        "description": "Scope: projects:write. Pro and Studio. ",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Project"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "Материалы сайта",
                    "created_at": "2026-10-14 00:00:00"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Project"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "Материалы сайта",
                    "created_at": "2026-10-14 00:00:00"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 100
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Материалы сайта"
              }
            }
          }
        }
      }
    },
    "/projects/{id}": {
      "get": {
        "operationId": "projects_get",
        "summary": "Информация о проекте",
        "description": "Scope: projects:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Project"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "Материалы сайта",
                    "created_at": "2026-10-14 00:00:00"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "projects_patch",
        "summary": "Переименовать проект",
        "description": "Scope: projects:write. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Project"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "name": "Материалы сайта",
                    "created_at": "2026-10-14 00:00:00"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 100
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Новый проект"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "projects_delete",
        "summary": "Удалить проект",
        "description": "Scope: projects:delete. Pro and Studio. Файлы сохраняются без проекта.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/statistics": {
      "get": {
        "operationId": "stats_account",
        "summary": "Статистика аккаунта",
        "description": "Scope: stats:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Statistics"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "days": 7,
                    "timezone": "UTC",
                    "totals": {
                      "requests": 12,
                      "unique_opens": 8,
                      "downloads": 6,
                      "video_plays": 0,
                      "audio_plays": 0,
                      "bytes_sent": 102400
                    },
                    "daily": [],
                    "referrers": []
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/files/{id}/statistics": {
      "get": {
        "operationId": "stats_file",
        "summary": "Статистика файла и источники",
        "description": "Scope: stats:read. Pro and Studio. days: 1–90 на Pro, 1–365 на Studio. Данные CDN появляются после импорта логов. unique_opens — сумма суточных значений, а не уникальные люди за период.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Statistics"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "days": 7,
                    "timezone": "UTC",
                    "totals": {
                      "requests": 12,
                      "unique_opens": 8,
                      "downloads": 6,
                      "video_plays": 0,
                      "audio_plays": 0,
                      "bytes_sent": 102400
                    },
                    "daily": [],
                    "referrers": []
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/forms": {
      "get": {
        "operationId": "forms_list",
        "summary": "Список форм",
        "description": "Scope: forms:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/FormPage"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "title": "Пришлите исходники",
                        "status": "active",
                        "url": "https://lfdrive.ru/u/Example1",
                        "max_files": 3,
                        "theme": null
                      }
                    ],
                    "next_before_id": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "forms_create",
        "summary": "Создать форму приёма файлов",
        "description": "Scope: forms:write. Pro and Studio. Создаёт форму с безопасными штатными настройками. Настройте её PATCH-запросом перед публикацией.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Form"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "title": "Пришлите исходники",
                    "status": "active",
                    "url": "https://lfdrive.ru/u/Example1",
                    "max_files": 3,
                    "theme": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Form"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "title": "Пришлите исходники",
                    "status": "active",
                    "url": "https://lfdrive.ru/u/Example1",
                    "max_files": 3,
                    "theme": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 255
                  },
                  "project_id": {
                    "type": "integer",
                    "description": "Проект для полученных файлов",
                    "minimum": 1,
                    "nullable": true
                  }
                },
                "required": [
                  "title"
                ]
              },
              "example": {
                "title": "Пришлите исходники"
              }
            }
          }
        }
      }
    },
    "/forms/{id}": {
      "get": {
        "operationId": "forms_get",
        "summary": "Настройки и ссылка формы",
        "description": "Scope: forms:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Form"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "title": "Пришлите исходники",
                    "status": "active",
                    "url": "https://lfdrive.ru/u/Example1",
                    "max_files": 3,
                    "theme": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "forms_patch",
        "summary": "Настроить форму",
        "description": "Scope: forms:write. Pro and Studio. PATCH сохраняет непереданные настройки. Дизайн и скрытие бренда — Studio. Отправка посетителем идёт через публичную форму с её проверками, а не с API-токеном владельца.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Form"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "title": "Пришлите исходники",
                    "status": "active",
                    "url": "https://lfdrive.ru/u/Example1",
                    "max_files": 3,
                    "theme": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 255
                  },
                  "description": {
                    "type": "string",
                    "description": "Описание",
                    "maxLength": 2000
                  },
                  "success_text": {
                    "type": "string",
                    "description": "Сообщение после отправки",
                    "maxLength": 500
                  },
                  "project_id": {
                    "type": "integer",
                    "description": "Проект; null — без проекта",
                    "minimum": 1,
                    "nullable": true
                  },
                  "allowed_extensions": {
                    "type": "array",
                    "description": "Расширения без точки",
                    "items": {
                      "type": "string"
                    }
                  },
                  "allowed_domains": {
                    "type": "array",
                    "description": "Разрешённые домены",
                    "items": {
                      "type": "string"
                    }
                  },
                  "max_file_bytes": {
                    "type": "integer",
                    "description": "Размер одного файла, байты",
                    "minimum": 1024
                  },
                  "max_files": {
                    "type": "integer",
                    "description": "Файлов за отправку",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "daily_file_limit": {
                    "type": "integer",
                    "description": "Файлов в сутки",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "theme": {
                    "type": "object",
                    "nullable": true,
                    "description": "Studio: частичные настройки дизайна; null сбрасывает тему",
                    "additionalProperties": false,
                    "properties": {
                      "primary_color": {
                        "type": "string",
                        "description": "#RRGGBB"
                      },
                      "background_color": {
                        "type": "string",
                        "description": "#RRGGBB"
                      },
                      "form_background_color": {
                        "type": "string",
                        "description": "#RRGGBB"
                      },
                      "text_color": {
                        "type": "string",
                        "description": "#RRGGBB"
                      },
                      "input_text_color": {
                        "type": "string",
                        "description": "#RRGGBB"
                      },
                      "border_color": {
                        "type": "string",
                        "description": "#RRGGBB"
                      },
                      "logo_url": {
                        "type": "string",
                        "description": "HTTPS-ссылка на логотип; браузер загружает её напрямую",
                        "maxLength": 1000
                      },
                      "button_text": {
                        "type": "string",
                        "description": "Текст отправки",
                        "maxLength": 80
                      },
                      "choose_files_text": {
                        "type": "string",
                        "description": "Текст выбора",
                        "maxLength": 80
                      },
                      "dropzone_text": {
                        "type": "string",
                        "description": "Текст зоны загрузки",
                        "maxLength": 150
                      },
                      "border_radius": {
                        "type": "integer",
                        "description": "Скругление",
                        "minimum": 0,
                        "maximum": 40
                      },
                      "font_family": {
                        "type": "string",
                        "enum": [
                          "system",
                          "Arial",
                          "Inter",
                          "Roboto",
                          "Montserrat"
                        ]
                      }
                    }
                  },
                  "branding_enabled": {
                    "type": "boolean",
                    "description": "Показывать LF Drive; изменение только Studio"
                  },
                  "allow_direct_access": {
                    "type": "boolean",
                    "description": "Открывать форму по прямой ссылке"
                  },
                  "captcha_enabled": {
                    "type": "boolean",
                    "description": "Включить CAPTCHA"
                  },
                  "notify_email": {
                    "type": "boolean",
                    "description": "Уведомления владельцу по почте"
                  },
                  "notify_telegram": {
                    "type": "boolean",
                    "description": "Уведомления в подключённый Telegram"
                  },
                  "sender_name_mode": {
                    "type": "string",
                    "enum": [
                      "off",
                      "optional",
                      "required"
                    ]
                  },
                  "sender_email_mode": {
                    "type": "string",
                    "enum": [
                      "off",
                      "optional",
                      "required"
                    ]
                  },
                  "sender_phone_mode": {
                    "type": "string",
                    "enum": [
                      "off",
                      "optional",
                      "required"
                    ]
                  },
                  "sender_message_mode": {
                    "type": "string",
                    "enum": [
                      "off",
                      "optional",
                      "required"
                    ]
                  }
                }
              },
              "example": {
                "max_files": 3,
                "allowed_extensions": [
                  "pdf",
                  "jpg"
                ],
                "sender_email_mode": "required",
                "captcha_enabled": true
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "forms_delete",
        "summary": "Удалить форму",
        "description": "Scope: forms:delete. Pro and Studio. История отправок удаляется по правилам сервиса. Загруженные файлы остаются в аккаунте.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/forms/{id}/status": {
      "patch": {
        "operationId": "forms_status",
        "summary": "Включить или отключить форму",
        "description": "Scope: forms:write. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Form"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "title": "Пришлите исходники",
                    "status": "active",
                    "url": "https://lfdrive.ru/u/Example1",
                    "max_files": 3,
                    "theme": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  }
                },
                "required": [
                  "status"
                ]
              },
              "example": {
                "status": "disabled"
              }
            }
          }
        }
      }
    },
    "/forms/{id}/link": {
      "patch": {
        "operationId": "forms_link",
        "summary": "Срок и одноразовость формы",
        "description": "Scope: forms:write. Pro and Studio. Требуется allow_direct_access. Срок и одноразовость несовместимы.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Form"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "title": "Пришлите исходники",
                    "status": "active",
                    "url": "https://lfdrive.ru/u/Example1",
                    "max_files": 3,
                    "theme": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "expires_at": {
                    "type": "string",
                    "description": "Будущая ISO 8601 дата с часовым поясом; null — без срока",
                    "maxLength": 40,
                    "nullable": true
                  },
                  "one_time": {
                    "type": "boolean",
                    "description": "Одноразовый доступ"
                  },
                  "reset_consumed": {
                    "type": "boolean",
                    "description": "Явно разрешить использовать одноразовую ссылку снова"
                  }
                }
              },
              "example": {
                "one_time": false,
                "expires_at": null
              }
            }
          }
        }
      }
    },
    "/forms/{id}/fields": {
      "get": {
        "operationId": "fields_list",
        "summary": "Дополнительные поля формы",
        "description": "Scope: forms:read. Studio only. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "field_type": "text",
                        "label": "Номер заказа",
                        "is_required": 1
                      }
                    ],
                    "field_types": [
                      "text",
                      "email",
                      "tel",
                      "number",
                      "textarea",
                      "select",
                      "checkbox"
                    ]
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "fields_create",
        "summary": "Добавить поле формы",
        "description": "Scope: forms:write. Studio only. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "field_type": "text",
                    "label": "Номер заказа",
                    "is_required": 1,
                    "options": []
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "field_type": "text",
                    "label": "Номер заказа",
                    "is_required": 1,
                    "options": []
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "field_type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "textarea",
                      "email",
                      "tel",
                      "number",
                      "select",
                      "checkbox"
                    ]
                  },
                  "label": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 255
                  },
                  "placeholder": {
                    "type": "string",
                    "description": "Подсказка",
                    "maxLength": 255
                  },
                  "help_text": {
                    "type": "string",
                    "description": "Описание",
                    "maxLength": 500
                  },
                  "options": {
                    "type": "array",
                    "description": "Варианты списка: 2–30 для select; строка до 100 символов",
                    "items": {
                      "type": "string"
                    }
                  },
                  "is_required": {
                    "type": "boolean",
                    "description": "Обязательное"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  }
                },
                "required": [
                  "label"
                ]
              },
              "example": {
                "field_type": "text",
                "label": "Номер заказа",
                "is_required": true
              }
            }
          }
        }
      }
    },
    "/forms/{id}/fields/order": {
      "patch": {
        "operationId": "fields_order",
        "summary": "Порядок полей",
        "description": "Scope: forms:write. Studio only. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "sort_order": 10
                      }
                    ]
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "ids": {
                    "type": "array",
                    "description": "Все ID полей в нужном порядке",
                    "items": {
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                },
                "required": [
                  "ids"
                ]
              },
              "example": {
                "ids": [
                  1,
                  2
                ]
              }
            }
          }
        }
      }
    },
    "/forms/{id}/fields/{field_id}": {
      "patch": {
        "operationId": "fields_patch",
        "summary": "Изменить поле формы",
        "description": "Scope: forms:write. Studio only. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "field_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "field_id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "field_type": "text",
                    "label": "Номер заказа",
                    "is_required": 1,
                    "options": []
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "field_type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "textarea",
                      "email",
                      "tel",
                      "number",
                      "select",
                      "checkbox"
                    ]
                  },
                  "label": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 255
                  },
                  "placeholder": {
                    "type": "string",
                    "description": "Подсказка",
                    "maxLength": 255
                  },
                  "help_text": {
                    "type": "string",
                    "description": "Описание",
                    "maxLength": 500
                  },
                  "options": {
                    "type": "array",
                    "description": "Варианты списка: 2–30 для select; строка до 100 символов",
                    "items": {
                      "type": "string"
                    }
                  },
                  "is_required": {
                    "type": "boolean",
                    "description": "Обязательное"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  }
                }
              },
              "example": {
                "label": "Название проекта"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "fields_delete",
        "summary": "Удалить поле формы",
        "description": "Scope: forms:delete. Studio only. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "field_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "field_id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/submissions": {
      "get": {
        "operationId": "submissions_list",
        "summary": "Список заявок",
        "description": "Scope: submissions:read. Pro and Studio. Постраничная навигация page, limit; новые заявки могут сдвигать страницы. Для синхронизации сверяйте ID.",
        "parameters": [
          {
            "name": "form_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "submissions": [],
                    "total": 0,
                    "page": 1,
                    "per_page": 50
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/submissions/{id}": {
      "get": {
        "operationId": "submissions_get",
        "summary": "Заявка с файлами и ответами",
        "description": "Scope: submissions:read. Pro and Studio. Ответ содержит персональные данные отправителя. Разрешайте этот scope только доверенной серверной интеграции.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "uploader_id": 456,
                    "sender_name": "Пример",
                    "sender_email": "sender@example.ru",
                    "custom_fields": [],
                    "files": []
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "submissions_delete",
        "summary": "Удалить заявку и её файлы",
        "description": "Scope: submissions:delete. Pro and Studio. В отличие от удаления формы, удаляет также файлы заявки. Операция может завершиться частично при ошибке внешнего хранилища; проверьте результат перед новым ключом.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/files/{id}/sale": {
      "get": {
        "operationId": "sales_get",
        "summary": "Настройки продажи файла",
        "description": "Scope: sales:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Sale"
                        }
                      ],
                      "nullable": true
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "enabled": true,
                    "price": "990.00",
                    "sale_title": "Гайд",
                    "access_duration_days": 30,
                    "purchases_count": 1,
                    "revenue_total": "990.00"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "sales_patch",
        "summary": "Настроить продажу",
        "description": "Scope: sales:write. Pro and Studio. Оплата проходит через существующую страницу LF Drive. API не принимает данные банковских карт и не меняет статус платежей.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Sale"
                        }
                      ],
                      "nullable": true
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "enabled": true,
                    "price": "990.00",
                    "sale_title": "Гайд",
                    "access_duration_days": 30,
                    "purchases_count": 1,
                    "revenue_total": "990.00"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "Включить продажу"
                  },
                  "price": {
                    "type": "string",
                    "description": "Цена RUB строкой, 1.00–1000000.00"
                  },
                  "sale_title": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 120
                  },
                  "sale_description": {
                    "type": "string",
                    "description": "Описание",
                    "maxLength": 1000
                  },
                  "seller_terms_url": {
                    "type": "string",
                    "description": "Публичные условия продажи и возврата, HTTPS",
                    "maxLength": 2048
                  },
                  "access_duration_days": {
                    "type": "integer",
                    "description": "Доступ после каждой покупки; null — без срока",
                    "minimum": 1,
                    "maximum": 3650,
                    "nullable": true
                  }
                }
              },
              "example": {
                "enabled": true,
                "price": "990.00",
                "sale_title": "Гайд",
                "sale_description": "Практическое руководство",
                "seller_terms_url": "https://example.ru/terms",
                "access_duration_days": 30
              }
            }
          }
        }
      }
    },
    "/merchant": {
      "get": {
        "operationId": "merchant_get",
        "summary": "Статус подключения магазина",
        "description": "Scope: merchant:read. Pro and Studio. Секретный ключ никогда не возвращается.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Merchant"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "connected": false,
                    "shop_id": null,
                    "receipt_enabled": true,
                    "vat_code": 1,
                    "tax_system_code": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "merchant_put",
        "summary": "Подключить или обновить магазин",
        "description": "Scope: merchant:write. Pro and Studio. Проверяет реквизиты read-only запросом к провайдеру. Списаний не создаёт. Ключ шифруется штатной функцией LF Drive. Предпочтительно подключить магазин в кабинете и не выдавать merchant:write обычным интеграциям.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Merchant"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "connected": false,
                    "shop_id": null,
                    "receipt_enabled": true,
                    "vat_code": 1,
                    "tax_system_code": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "shop_id": {
                    "type": "string",
                    "description": "shopId магазина"
                  },
                  "secret_key": {
                    "type": "string",
                    "description": "Секретный ключ; только в HTTPS теле",
                    "maxLength": 150
                  },
                  "receipt_enabled": {
                    "type": "boolean",
                    "description": "Включить чеки"
                  },
                  "vat_code": {
                    "type": "integer",
                    "description": "Код НДС",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "tax_system_code": {
                    "type": "integer",
                    "description": "Система налогообложения; null — из магазина",
                    "minimum": 1,
                    "maximum": 6,
                    "nullable": true
                  }
                },
                "required": [
                  "shop_id",
                  "secret_key"
                ]
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "orders_list",
        "summary": "Покупки файлов",
        "description": "Scope: orders:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "file_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/OrderPage"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "file_id": 456,
                        "order_code": "example-order",
                        "buyer_email": "buyer@example.ru",
                        "amount": "990.00",
                        "status": "succeeded",
                        "access_expires_at": null
                      }
                    ],
                    "next_before_id": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "operationId": "orders_get",
        "summary": "Покупка и срок доступа",
        "description": "Scope: orders:read. Pro and Studio. Ответ содержит email покупателя; токены доступа и платёжные секреты не возвращаются.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "file_id": 456,
                    "order_code": "example-order",
                    "buyer_email": "buyer@example.ru",
                    "amount": "990.00",
                    "status": "succeeded",
                    "access_expires_at": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/blocks": {
      "get": {
        "operationId": "blocks_list",
        "summary": "Платные блоки контента",
        "description": "Scope: blocks:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/BlockPage"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "block_code": "Example1",
                        "content_type": "text",
                        "teaser_title": "Материал",
                        "price": 990,
                        "status": "active",
                        "embed_api_url": "https://lfdrive.ru/block-embed.php?code=Example1"
                      }
                    ],
                    "next_before_id": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "blocks_create",
        "summary": "Создать платный блок",
        "description": "Scope: blocks:write. Pro and Studio. Это отдельная существующая система платных блоков. provider_secret сохраняется штатным способом этой системы; ответ его не содержит. Для новых продаж файлов используйте /files/{id}/sale.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Block"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "block_code": "Example1",
                    "content_type": "text",
                    "teaser_title": "Материал",
                    "price": 990,
                    "status": "active",
                    "embed_api_url": "https://lfdrive.ru/block-embed.php?code=Example1"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Block"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "block_code": "Example1",
                    "content_type": "text",
                    "teaser_title": "Материал",
                    "price": 990,
                    "status": "active",
                    "embed_api_url": "https://lfdrive.ru/block-embed.php?code=Example1"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "audio",
                      "video",
                      "image",
                      "document",
                      "text",
                      "link"
                    ]
                  },
                  "file_id": {
                    "type": "integer",
                    "description": "Свой файл для медиа/документа",
                    "minimum": 1
                  },
                  "content_value": {
                    "type": "string",
                    "description": "Текст или HTTPS-ссылка; для text/link",
                    "maxLength": 10000
                  },
                  "price": {
                    "type": "integer",
                    "description": "Цена целыми рублями",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "duration_days": {
                    "type": "integer",
                    "description": "Срок, 0 — бессрочно",
                    "minimum": 0,
                    "maximum": 3650
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "prodamus",
                      "yookassa"
                    ]
                  },
                  "provider_secret": {
                    "type": "string",
                    "description": "Секрет существующей системы платных блоков",
                    "maxLength": 200
                  },
                  "pay_url": {
                    "type": "string",
                    "description": "HTTPS-ссылка оплаты",
                    "maxLength": 2048
                  },
                  "teaser_title": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 255
                  },
                  "teaser_text": {
                    "type": "string",
                    "description": "Описание",
                    "maxLength": 2000
                  },
                  "page_url": {
                    "type": "string",
                    "description": "HTTPS-адрес страницы размещения",
                    "maxLength": 2048
                  },
                  "brand": {
                    "type": "object",
                    "description": "Частичные настройки заглушки; Studio",
                    "additionalProperties": false,
                    "properties": {
                      "bg_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "card_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "text_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "accent_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "btn_text": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "input_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "input_border": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "input_text": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "placeholder_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "btn_radius": {
                        "type": "integer",
                        "description": "Скругление кнопки",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "input_radius": {
                        "type": "integer",
                        "description": "Скругление поля",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "hide_brand": {
                        "type": "boolean",
                        "description": "Скрыть LF Drive"
                      },
                      "title": {
                        "type": "string",
                        "description": "Заголовок заглушки",
                        "maxLength": 120
                      },
                      "text": {
                        "type": "string",
                        "description": "Текст",
                        "maxLength": 400
                      },
                      "card_radius": {
                        "type": "integer",
                        "description": "Скругление карточки",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "terms_checkbox_radius": {
                        "type": "integer",
                        "description": "Скругление чекбокса условий",
                        "minimum": 0,
                        "maximum": 20
                      },
                      "terms_checkbox_bg": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_checkbox_border": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_checkbox_fill": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_checkbox_tick": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_link_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      }
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  }
                },
                "required": [
                  "content_type"
                ]
              },
              "example": {
                "content_type": "text",
                "content_value": "Закрытый материал",
                "teaser_title": "Материал",
                "price": 990,
                "provider": "prodamus",
                "pay_url": "https://example.ru/pay"
              }
            }
          }
        }
      }
    },
    "/blocks/{id}": {
      "get": {
        "operationId": "blocks_get",
        "summary": "Информация о платном блоке",
        "description": "Scope: blocks:read. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Block"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "block_code": "Example1",
                    "content_type": "text",
                    "teaser_title": "Материал",
                    "price": 990,
                    "status": "active",
                    "embed_api_url": "https://lfdrive.ru/block-embed.php?code=Example1"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "blocks_patch",
        "summary": "Изменить платный блок",
        "description": "Scope: blocks:write. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Block"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "id": 123,
                    "block_code": "Example1",
                    "content_type": "text",
                    "teaser_title": "Материал",
                    "price": 990,
                    "status": "active",
                    "embed_api_url": "https://lfdrive.ru/block-embed.php?code=Example1"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "audio",
                      "video",
                      "image",
                      "document",
                      "text",
                      "link"
                    ]
                  },
                  "file_id": {
                    "type": "integer",
                    "description": "Свой файл для медиа/документа",
                    "minimum": 1
                  },
                  "content_value": {
                    "type": "string",
                    "description": "Текст или HTTPS-ссылка; для text/link",
                    "maxLength": 10000
                  },
                  "price": {
                    "type": "integer",
                    "description": "Цена целыми рублями",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "duration_days": {
                    "type": "integer",
                    "description": "Срок, 0 — бессрочно",
                    "minimum": 0,
                    "maximum": 3650
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "prodamus",
                      "yookassa"
                    ]
                  },
                  "provider_secret": {
                    "type": "string",
                    "description": "Секрет существующей системы платных блоков",
                    "maxLength": 200
                  },
                  "pay_url": {
                    "type": "string",
                    "description": "HTTPS-ссылка оплаты",
                    "maxLength": 2048
                  },
                  "teaser_title": {
                    "type": "string",
                    "description": "Название",
                    "maxLength": 255
                  },
                  "teaser_text": {
                    "type": "string",
                    "description": "Описание",
                    "maxLength": 2000
                  },
                  "page_url": {
                    "type": "string",
                    "description": "HTTPS-адрес страницы размещения",
                    "maxLength": 2048
                  },
                  "brand": {
                    "type": "object",
                    "description": "Частичные настройки заглушки; Studio",
                    "additionalProperties": false,
                    "properties": {
                      "bg_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "card_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "text_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "accent_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "btn_text": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "input_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "input_border": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "input_text": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "placeholder_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "btn_radius": {
                        "type": "integer",
                        "description": "Скругление кнопки",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "input_radius": {
                        "type": "integer",
                        "description": "Скругление поля",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "hide_brand": {
                        "type": "boolean",
                        "description": "Скрыть LF Drive"
                      },
                      "title": {
                        "type": "string",
                        "description": "Заголовок заглушки",
                        "maxLength": 120
                      },
                      "text": {
                        "type": "string",
                        "description": "Текст",
                        "maxLength": 400
                      },
                      "card_radius": {
                        "type": "integer",
                        "description": "Скругление карточки",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "terms_checkbox_radius": {
                        "type": "integer",
                        "description": "Скругление чекбокса условий",
                        "minimum": 0,
                        "maximum": 20
                      },
                      "terms_checkbox_bg": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_checkbox_border": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_checkbox_fill": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_checkbox_tick": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      },
                      "terms_link_color": {
                        "type": "string",
                        "description": "#RRGGBB или transparent"
                      }
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  }
                }
              },
              "example": {
                "teaser_title": "Обновлённый материал"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "blocks_delete",
        "summary": "Удалить платный блок",
        "description": "Scope: blocks:delete. Pro and Studio. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/branding": {
      "get": {
        "operationId": "branding_get",
        "summary": "Брендинг аккаунта",
        "description": "Scope: branding:read. Studio only. ",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Branding"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "accent_color": "#13935a",
                    "logo_path": null,
                    "pages": {}
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "branding_patch",
        "summary": "Настроить общий брендинг",
        "description": "Scope: branding:write. Studio only. ",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Branding"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "accent_color": "#13935a",
                    "logo_path": null,
                    "pages": {}
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "bg_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "card_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "text_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "accent_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "btn_text": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "input_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "input_border": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "input_text": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "placeholder_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "btn_radius": {
                    "type": "integer",
                    "description": "Скругление кнопки",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "input_radius": {
                    "type": "integer",
                    "description": "Скругление поля",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "custom_title": {
                    "type": "string",
                    "description": "Заголовок",
                    "maxLength": 120
                  },
                  "custom_text": {
                    "type": "string",
                    "description": "Текст",
                    "maxLength": 400
                  },
                  "hide_brand": {
                    "type": "boolean",
                    "description": "Скрыть LF Drive"
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "Включить брендинг"
                  }
                }
              },
              "example": {
                "accent_color": "#13935a",
                "btn_radius": 24
              }
            }
          }
        }
      }
    },
    "/branding/pages/{page}": {
      "patch": {
        "operationId": "branding_page",
        "summary": "Оформить конкретную заглушку",
        "description": "Scope: branding:write. Studio only. page: password, paid_file, domain_blocked, pdf_protected, traffic_limit, file_expired, file_consumed, invalid_confirmation, file_confirmation, uploader_expired, uploader_consumed, uploader_confirmation, uploader_direct_blocked. Полный список берётся из branding_placeholder_definitions() текущего LF Drive.",
        "parameters": [
          {
            "name": "page",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "page"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Branding"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "accent_color": "#13935a",
                    "logo_path": null,
                    "pages": {}
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "bg_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "card_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "text_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "accent_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "btn_text": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "input_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "input_border": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "input_text": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "placeholder_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "btn_radius": {
                    "type": "integer",
                    "description": "Скругление кнопки",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "input_radius": {
                    "type": "integer",
                    "description": "Скругление поля",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "hide_brand": {
                    "type": "boolean",
                    "description": "Скрыть LF Drive"
                  },
                  "title": {
                    "type": "string",
                    "description": "Заголовок заглушки",
                    "maxLength": 120
                  },
                  "text": {
                    "type": "string",
                    "description": "Текст",
                    "maxLength": 400
                  },
                  "card_radius": {
                    "type": "integer",
                    "description": "Скругление карточки",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "terms_checkbox_radius": {
                    "type": "integer",
                    "description": "Скругление чекбокса условий",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "terms_checkbox_bg": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "terms_checkbox_border": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "terms_checkbox_fill": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "terms_checkbox_tick": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  },
                  "terms_link_color": {
                    "type": "string",
                    "description": "#RRGGBB или transparent"
                  }
                }
              },
              "example": {
                "title": "Доступ к материалу",
                "accent_color": "#13935a"
              }
            }
          }
        }
      }
    },
    "/branding/logo": {
      "post": {
        "operationId": "branding_logo",
        "summary": "Загрузить общий логотип",
        "description": "Scope: branding:write. Studio only. До 20 попыток в сутки на аккаунт. JPEG/PNG/WebP до 2 МБ и 16 млн пикселей; итоговый PNG тоже до 2 МБ. Перекодируется в PNG шириной до 400 px. Обрезка логотипов отдельных заглушек остаётся в кабинете.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Branding"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "accent_color": "#13935a",
                    "logo_path": null,
                    "pages": {}
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Branding"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "accent_color": "#13935a",
                    "logo_path": null,
                    "pages": {}
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        }
      }
    },
    "/domains": {
      "get": {
        "operationId": "domains_list",
        "summary": "Свои домены и DNS-инструкция",
        "description": "Scope: domains:read. Studio only. ",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [],
                    "dns": {
                      "type": "CNAME",
                      "target": "lfdrive.ru"
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "domains_create",
        "summary": "Добавить свой поддомен",
        "description": "Scope: domains:write. Studio only. ",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "domain": "files.example.ru",
                    "dns": {
                      "type": "CNAME",
                      "target": "lfdrive.ru"
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "domain": "files.example.ru",
                    "dns": {
                      "type": "CNAME",
                      "target": "lfdrive.ru"
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "domain": {
                    "type": "string",
                    "description": "Поддомен, например files.example.ru",
                    "maxLength": 253
                  }
                },
                "required": [
                  "domain"
                ]
              },
              "example": {
                "domain": "files.example.ru"
              }
            }
          }
        }
      }
    },
    "/domains/{id}/verify": {
      "post": {
        "operationId": "domains_verify",
        "summary": "Проверить DNS домена",
        "description": "Scope: domains:write. Studio only. Проверяет DNS штатной функцией LF Drive. Выпуск TLS и маршрутизация выполняются существующей инфраструктурой.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "ok": true,
                    "status": "active"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "ok": true,
                    "status": "active"
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/domains/{id}/primary": {
      "post": {
        "operationId": "domains_primary",
        "summary": "Сделать домен основным",
        "description": "Scope: domains:write. Studio only. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "primary_id": 123
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "primary_id": 123
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/domains/{id}": {
      "delete": {
        "operationId": "domains_delete",
        "summary": "Удалить свой домен",
        "description": "Scope: domains:write. Studio only. ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ActionResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "deleted": true
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/operations/{key}": {
      "get": {
        "operationId": "operations_get",
        "summary": "Результат операции по Idempotency-Key",
        "description": "Scope: operations:read. Pro and Studio. Только операции текущего токена. pending означает неопределённый результат: автоматический повтор с этим ключом не выполнит действие заново. Завершённые операции хранятся 30 дней; pending не удаляются автоматически.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Idempotency-Key"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Operation"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "status": "done",
                    "status_code": 201,
                    "method": "POST",
                    "resource_path": "/projects",
                    "result": {
                      "ok": true,
                      "data": {
                        "id": 123,
                        "name": "Материалы сайта"
                      }
                    }
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/audit": {
      "get": {
        "operationId": "audit_list",
        "summary": "Журнал запросов текущего токена",
        "description": "Scope: audit:read. Pro and Studio. Не содержит тела, паролей, токенов, ключей магазина и исходных IP. Хранится 90 дней.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ. Пример сокращён; дополнительные поля могут добавляться.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/AuditRecordPage"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "ok",
                    "data",
                    "request_id"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "items": [
                      {
                        "id": 123,
                        "request_id": "0123456789abcdef0123456789abcdef",
                        "method": "GET",
                        "resource_path": "/files",
                        "status_code": 200,
                        "duration_ms": 12,
                        "created_at": "2026-10-14 00:00:00"
                      }
                    ],
                    "next_before_id": null
                  },
                  "request_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          },
          "201": {
            "description": "Created / completed POST action"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan or scope required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict or uncertain operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content type unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "lf_api_<64 hex>"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "FileAccess": {
        "type": "object",
        "properties": {
          "password_enabled": {
            "type": "boolean",
            "description": "Есть пароль"
          },
          "allowed_domains": {
            "type": "array",
            "description": "Разрешённые домены",
            "items": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": "string",
            "description": "ISO 8601",
            "nullable": true
          },
          "one_time": {
            "type": "boolean",
            "description": "Одноразовая ссылка"
          },
          "consumed_at": {
            "type": "string",
            "description": "ISO 8601",
            "nullable": true
          },
          "pdf_protected": {
            "type": "boolean",
            "description": "Защита PDF"
          },
          "force_download": {
            "type": "boolean",
            "description": "Принудительное скачивание"
          }
        },
        "additionalProperties": true
      },
      "File": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "name": {
            "type": "string",
            "description": "Имя"
          },
          "mime_type": {
            "type": "string",
            "description": "MIME"
          },
          "size_bytes": {
            "type": "integer",
            "description": "Размер в байтах",
            "minimum": 0
          },
          "category": {
            "type": "string",
            "description": "Категория"
          },
          "project_id": {
            "type": "integer",
            "description": "Проект",
            "minimum": 1,
            "nullable": true
          },
          "status": {
            "type": "string",
            "description": "Состояние"
          },
          "created_at": {
            "type": "string",
            "description": "Дата создания"
          },
          "url": {
            "type": "string",
            "description": "Публичная ссылка; активный основной свой домен на Studio используется автоматически"
          },
          "canonical_url": {
            "type": "string",
            "description": "Постоянный адрес через lfdrive.ru"
          },
          "access": {
            "$ref": "#/components/schemas/FileAccess"
          }
        },
        "additionalProperties": true,
        "required": [
          "id",
          "name",
          "url",
          "access"
        ]
      },
      "Project": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "name": {
            "type": "string",
            "description": "Название"
          },
          "created_at": {
            "type": "string",
            "description": "Дата создания"
          }
        },
        "additionalProperties": true
      },
      "Version": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "orig_name": {
            "type": "string",
            "description": "Имя"
          },
          "mime_type": {
            "type": "string",
            "description": "MIME"
          },
          "size_bytes": {
            "type": "integer",
            "description": "Байты",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "description": "Дата"
          },
          "expires_at": {
            "type": "string",
            "description": "Срок",
            "nullable": true
          },
          "pinned": {
            "type": "integer",
            "enum": [
              0,
              1
            ]
          },
          "label": {
            "type": "string",
            "description": "Подпись",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "email": {
            "type": "string",
            "description": "Email"
          },
          "plan": {
            "type": "string",
            "enum": [
              "pro",
              "studio"
            ]
          },
          "subscription_status": {
            "type": "string",
            "description": "Статус"
          },
          "subscription_expires_at": {
            "type": "string",
            "description": "Текущий срок из LF Drive",
            "nullable": true
          },
          "auto_renew": {
            "type": "boolean",
            "description": "Автопродление"
          },
          "trial_ends_at": {
            "type": "string",
            "description": "Пробный период",
            "nullable": true
          },
          "scopes": {
            "type": "array",
            "description": "Права текущего токена",
            "items": {
              "type": "string"
            }
          },
          "storage": {
            "type": "object",
            "properties": {
              "used_bytes": {
                "type": "integer",
                "description": "Использовано",
                "minimum": 0
              },
              "reserved_bytes": {
                "type": "integer",
                "description": "Зарезервировано",
                "minimum": 0
              },
              "limit_bytes": {
                "type": "integer",
                "description": "Лимит",
                "minimum": 0
              }
            },
            "additionalProperties": true
          },
          "traffic": {
            "type": "object",
            "properties": {
              "used_bytes": {
                "type": "integer",
                "description": "Использовано",
                "minimum": 0
              },
              "limit_bytes": {
                "type": "integer",
                "description": "Лимит",
                "minimum": 0
              },
              "unlimited": {
                "type": "boolean",
                "description": "Без лимита"
              }
            },
            "additionalProperties": true
          },
          "limits": {
            "type": "object",
            "description": "Текущие ограничения API и истории версий",
            "additionalProperties": true
          },
          "capabilities": {
            "type": "object",
            "description": "Доступные возможности",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "Form": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "title": {
            "type": "string",
            "description": "Название",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "description": "Описание",
            "maxLength": 2000
          },
          "url": {
            "type": "string",
            "description": "Публичная форма"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "success_text": {
            "type": "string",
            "description": "Сообщение после отправки",
            "maxLength": 500
          },
          "project_id": {
            "type": "integer",
            "description": "Проект; null — без проекта",
            "minimum": 1,
            "nullable": true
          },
          "allowed_extensions": {
            "type": "array",
            "description": "Расширения без точки",
            "items": {
              "type": "string"
            }
          },
          "allowed_domains": {
            "type": "array",
            "description": "Разрешённые домены",
            "items": {
              "type": "string"
            }
          },
          "max_file_bytes": {
            "type": "integer",
            "description": "Размер одного файла, байты",
            "minimum": 1024
          },
          "max_files": {
            "type": "integer",
            "description": "Файлов за отправку",
            "minimum": 1,
            "maximum": 10
          },
          "daily_file_limit": {
            "type": "integer",
            "description": "Файлов в сутки",
            "minimum": 1,
            "maximum": 10000
          },
          "theme": {
            "type": "object",
            "nullable": true,
            "description": "Studio: частичные настройки дизайна; null сбрасывает тему",
            "additionalProperties": false,
            "properties": {
              "primary_color": {
                "type": "string",
                "description": "#RRGGBB"
              },
              "background_color": {
                "type": "string",
                "description": "#RRGGBB"
              },
              "form_background_color": {
                "type": "string",
                "description": "#RRGGBB"
              },
              "text_color": {
                "type": "string",
                "description": "#RRGGBB"
              },
              "input_text_color": {
                "type": "string",
                "description": "#RRGGBB"
              },
              "border_color": {
                "type": "string",
                "description": "#RRGGBB"
              },
              "logo_url": {
                "type": "string",
                "description": "HTTPS-ссылка на логотип; браузер загружает её напрямую",
                "maxLength": 1000
              },
              "button_text": {
                "type": "string",
                "description": "Текст отправки",
                "maxLength": 80
              },
              "choose_files_text": {
                "type": "string",
                "description": "Текст выбора",
                "maxLength": 80
              },
              "dropzone_text": {
                "type": "string",
                "description": "Текст зоны загрузки",
                "maxLength": 150
              },
              "border_radius": {
                "type": "integer",
                "description": "Скругление",
                "minimum": 0,
                "maximum": 40
              },
              "font_family": {
                "type": "string",
                "enum": [
                  "system",
                  "Arial",
                  "Inter",
                  "Roboto",
                  "Montserrat"
                ]
              }
            }
          },
          "branding_enabled": {
            "type": "boolean",
            "description": "Показывать LF Drive; изменение только Studio"
          },
          "allow_direct_access": {
            "type": "boolean",
            "description": "Открывать форму по прямой ссылке"
          },
          "captcha_enabled": {
            "type": "boolean",
            "description": "Включить CAPTCHA"
          },
          "notify_email": {
            "type": "boolean",
            "description": "Уведомления владельцу по почте"
          },
          "notify_telegram": {
            "type": "boolean",
            "description": "Уведомления в подключённый Telegram"
          },
          "sender_name_mode": {
            "type": "string",
            "enum": [
              "off",
              "optional",
              "required"
            ]
          },
          "sender_email_mode": {
            "type": "string",
            "enum": [
              "off",
              "optional",
              "required"
            ]
          },
          "sender_phone_mode": {
            "type": "string",
            "enum": [
              "off",
              "optional",
              "required"
            ]
          },
          "sender_message_mode": {
            "type": "string",
            "enum": [
              "off",
              "optional",
              "required"
            ]
          }
        },
        "additionalProperties": true
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "file_id": {
            "type": "integer",
            "description": "Файл",
            "minimum": 1
          },
          "order_code": {
            "type": "string",
            "description": "Код заказа"
          },
          "buyer_email": {
            "type": "string",
            "description": "Email покупателя"
          },
          "amount": {
            "type": "string",
            "description": "Сумма RUB"
          },
          "status": {
            "type": "string",
            "description": "Статус провайдера"
          },
          "created_at": {
            "type": "string",
            "description": "Создан"
          },
          "paid_at": {
            "type": "string",
            "description": "Оплачен",
            "nullable": true
          },
          "access_started_at": {
            "type": "string",
            "description": "Начало доступа",
            "nullable": true
          },
          "access_expires_at": {
            "type": "string",
            "description": "Окончание доступа",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "Sale": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Продажа включена"
          },
          "price": {
            "type": "string",
            "description": "Цена RUB"
          },
          "sale_title": {
            "type": "string",
            "description": "Название"
          },
          "sale_description": {
            "type": "string",
            "description": "Описание"
          },
          "seller_terms_url": {
            "type": "string",
            "description": "Условия"
          },
          "access_duration_days": {
            "type": "integer",
            "description": "Дни доступа",
            "minimum": 1,
            "nullable": true
          },
          "purchases_count": {
            "type": "integer",
            "description": "Покупки",
            "minimum": 0
          },
          "revenue_total": {
            "type": "string",
            "description": "Выручка RUB"
          }
        },
        "additionalProperties": true
      },
      "Merchant": {
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean",
            "description": "Магазин подключён"
          },
          "shop_id": {
            "type": "string",
            "description": "Shop ID",
            "nullable": true
          },
          "receipt_enabled": {
            "type": "boolean",
            "description": "Чеки"
          },
          "vat_code": {
            "type": "integer",
            "description": "НДС",
            "minimum": 1
          },
          "tax_system_code": {
            "type": "integer",
            "description": "Налоговая система",
            "minimum": 1,
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "Statistics": {
        "type": "object",
        "properties": {
          "days": {
            "type": "integer",
            "description": "Период",
            "minimum": 1
          },
          "timezone": {
            "type": "string",
            "description": "Часовой пояс"
          },
          "totals": {
            "type": "object",
            "description": "requests, unique_opens, downloads, video_plays, audio_plays, bytes_sent",
            "additionalProperties": true
          },
          "daily": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "stat_date и те же метрики",
              "additionalProperties": true
            }
          },
          "referrers": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "ref_domain, requests, bytes_sent",
              "additionalProperties": true
            }
          },
          "link_events": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "event_type и event_count из журнала ограничений ссылок",
              "additionalProperties": true
            }
          },
          "unique_opens_note": {
            "type": "string",
            "description": "Семантика уникальных открытий"
          }
        },
        "additionalProperties": true
      },
      "Block": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "block_code": {
            "type": "string",
            "description": "Код"
          },
          "content_type": {
            "type": "string",
            "description": "Тип контента"
          },
          "teaser_title": {
            "type": "string",
            "description": "Название"
          },
          "teaser_text": {
            "type": "string",
            "description": "Описание"
          },
          "price": {
            "type": "integer",
            "description": "Рубли",
            "minimum": 0
          },
          "duration_days": {
            "type": "integer",
            "description": "Дни",
            "minimum": 0
          },
          "provider": {
            "type": "string",
            "description": "Провайдер"
          },
          "status": {
            "type": "string",
            "description": "Состояние"
          },
          "embed_api_url": {
            "type": "string",
            "description": "Endpoint существующего сниппета"
          },
          "brand": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "ActionResult": {
        "type": "object",
        "additionalProperties": true
      },
      "Branding": {
        "type": "object",
        "properties": {
          "bg_color": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "card_color": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "text_color": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "accent_color": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "btn_text": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "input_color": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "input_border": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "input_text": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "placeholder_color": {
            "type": "string",
            "description": "#RRGGBB или transparent"
          },
          "btn_radius": {
            "type": "integer",
            "description": "Скругление кнопки",
            "minimum": 0,
            "maximum": 100
          },
          "input_radius": {
            "type": "integer",
            "description": "Скругление поля",
            "minimum": 0,
            "maximum": 100
          },
          "custom_title": {
            "type": "string",
            "description": "Заголовок",
            "maxLength": 120
          },
          "custom_text": {
            "type": "string",
            "description": "Текст",
            "maxLength": 400
          },
          "hide_brand": {
            "type": "boolean",
            "description": "Скрыть LF Drive"
          },
          "enabled": {
            "type": "boolean",
            "description": "Включить брендинг"
          },
          "logo_path": {
            "type": "string",
            "description": "Публичный путь логотипа",
            "nullable": true
          },
          "pages": {
            "type": "object",
            "description": "Настройки заглушек по имени",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "Operation": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "done"
            ]
          },
          "status_code": {
            "type": "integer",
            "description": "HTTP сохранённого результата",
            "minimum": 1,
            "nullable": true
          },
          "method": {
            "type": "string",
            "description": "Метод"
          },
          "resource_path": {
            "type": "string",
            "description": "Путь"
          },
          "created_at": {
            "type": "string",
            "description": "Создана"
          },
          "completed_at": {
            "type": "string",
            "description": "Завершена",
            "nullable": true
          },
          "result": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "AuditRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID",
            "minimum": 1
          },
          "request_id": {
            "type": "string",
            "description": "Идентификатор запроса"
          },
          "method": {
            "type": "string",
            "description": "Метод"
          },
          "resource_path": {
            "type": "string",
            "description": "Путь"
          },
          "status_code": {
            "type": "integer",
            "description": "HTTP",
            "minimum": 1
          },
          "duration_ms": {
            "type": "integer",
            "description": "Миллисекунды",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "description": "Дата"
          }
        },
        "additionalProperties": true
      },
      "FilePage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/File"
            }
          },
          "next_before_id": {
            "type": "integer",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "ProjectPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Project"
            }
          },
          "next_before_id": {
            "type": "integer",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "VersionPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Version"
            }
          },
          "next_before_id": {
            "type": "integer",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "FormPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form"
            }
          },
          "next_before_id": {
            "type": "integer",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "OrderPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Order"
            }
          },
          "next_before_id": {
            "type": "integer",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "BlockPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Block"
            }
          },
          "next_before_id": {
            "type": "integer",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "AuditRecordPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditRecord"
            }
          },
          "next_before_id": {
            "type": "integer",
            "nullable": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}