{
 "openapi": "3.0.3",
 "info": {
  "title": "Labservs API",
  "version": "1.0",
  "description": "Gọi bằng khóa API (Tài khoản > Khóa API): `Authorization: Bearer lbs_...`. Lỗi trả JSON {\"error\": \"...\"}. Khóa API không đổi được mật khẩu, 2FA hay tạo khóa khác."
 },
 "servers": [
  {
   "url": "https://labservs.com/v1"
  }
 ],
 "components": {
  "securitySchemes": {
   "apiKey": {
    "type": "http",
    "scheme": "bearer"
   }
  }
 },
 "security": [
  {
   "apiKey": []
  }
 ],
 "paths": {
  "/me": {
   "get": {
    "summary": "Thông tin tài khoản hiện tại",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/plans": {
   "get": {
    "summary": "Danh sách gói app (không cần đăng nhập)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "security": []
   }
  },
  "/addon-plans": {
   "get": {
    "summary": "Danh sách loại và gói database (không cần đăng nhập)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "security": []
   }
  },
  "/apps": {
   "get": {
    "summary": "Danh sách app của bạn",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/orders": {
   "post": {
    "summary": "Tạo app (body: name, plan, trial?). Ví đủ tiền: tạo ngay; thiếu: tạo đơn chờ",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/apps/{name}": {
   "get": {
    "summary": "Chi tiết app, gồm biến môi trường",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "delete": {
    "summary": "Xóa app và dữ liệu",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/plan": {
   "put": {
    "summary": "Đổi gói (body: plan)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/config": {
   "put": {
    "summary": "Đặt/xóa biến môi trường (body: set:{K:V}, unset:[K])",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/ps/{action}": {
   "post": {
    "summary": "start | stop | restart",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "action",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/logs": {
   "get": {
    "summary": "Log (query: lines, q, level=error|warn)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/deploy": {
   "post": {
    "summary": "Deploy (body: {type:'image',image} hoặc {type:'git',repo,ref?}); trả {id}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/rebuild": {
   "post": {
    "summary": "Build lại (body {purgeCache:true} để xóa cache build)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/deployments": {
   "get": {
    "summary": "20 lần deploy gần nhất",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/deployments/{id}": {
   "get": {
    "summary": "Trạng thái và log (query: offset)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/deployments/{id}/cancel": {
   "post": {
    "summary": "Hủy lần deploy đang xếp hàng hoặc đang chạy",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/deployments/{id}/rollback": {
   "post": {
    "summary": "Deploy lại bản đã chạy thành công",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/scale": {
   "put": {
    "summary": "Số instance (body: scale:{web:2})",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/metrics": {
   "get": {
    "summary": "CPU/RAM hiện tại",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/metrics/history": {
   "get": {
    "summary": "Lịch sử CPU/RAM (query: range=1h|24h|7d)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/uptime": {
   "get": {
    "summary": "Uptime 24 giờ/7 ngày, thời gian phản hồi, sự cố",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/events": {
   "get": {
    "summary": "Dòng thời gian: khởi động lại, sập, deploy",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/domains": {
   "post": {
    "summary": "Thêm domain (body: domain)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/domains/check": {
   "get": {
    "summary": "Kiểm tra DNS của các domain",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/domains/{domain}": {
   "delete": {
    "summary": "Gỡ domain",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "domain",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/ssl": {
   "get": {
    "summary": "Trạng thái HTTPS",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "put": {
    "summary": "Bật/tắt HTTPS (body: enabled)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/auto-renew": {
   "put": {
    "summary": "Bật/tắt tự gia hạn (body: enabled)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/clone": {
   "post": {
    "summary": "Nhân bản app (body: name)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/build": {
   "put": {
    "summary": "Cách build: body {builder:''|dockerfile|herokuish|pack, buildDir, dockerfilePath}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/build-args": {
   "put": {
    "summary": "Build args Dockerfile: body {args:{KEY:value}}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/run": {
   "post": {
    "summary": "Chạy lệnh một lần: body {command}; trả {output, exitCode}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/cron": {
   "get": {
    "summary": "Danh sách tác vụ định kỳ",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "post": {
    "summary": "Tạo tác vụ định kỳ: body {schedule:'*/15 * * * *', command}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/cron/{id}": {
   "delete": {
    "summary": "Xóa tác vụ định kỳ",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/cron/{id}/run": {
   "post": {
    "summary": "Chạy ngay một tác vụ định kỳ",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/volumes": {
   "get": {
    "summary": "Danh sách volume lưu trữ",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "post": {
    "summary": "Gắn volume: body {name, mountPath}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/volumes/{id}": {
   "delete": {
    "summary": "Gỡ volume (query deleteData=1 để xóa dữ liệu)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/deploy-zip": {
   "post": {
    "summary": "Deploy từ file ZIP: thân request là file .zip (Content-Type application/zip, tối đa 50 MB)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/deploy-template": {
   "post": {
    "summary": "Deploy mẫu: body {template: static|node|python|php}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/promote": {
   "post": {
    "summary": "Promote bản đã chạy của app khác: body {from}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/config-history": {
   "get": {
    "summary": "Lịch sử đổi biến môi trường",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/config-history/{id}/revert": {
   "post": {
    "summary": "Hoàn tác một thay đổi biến",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/logs/history": {
   "get": {
    "summary": "Log đã lưu (query from, to, q, limit)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/traffic": {
   "get": {
    "summary": "Lượt truy cập từ access log (query range=1h|24h|7d)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/access": {
   "get": {
    "summary": "Quy tắc truy cập: bảo trì, IP, mật khẩu, chuyển hướng",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "put": {
    "summary": "Đặt quy tắc truy cập: body {maintenance, allowIps, basicAuth, redirects}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/autodeploy": {
   "get": {
    "summary": "Cấu hình tự deploy khi push",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "put": {
    "summary": "Bật tự deploy: body {repo, branch, previews}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/billing-cycle": {
   "put": {
    "summary": "Chu kỳ thanh toán: body {months: 1|12}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/prepay": {
   "post": {
    "summary": "Trả trước: body {months: 6|12}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/rename": {
   "post": {
    "summary": "Đổi tên app: body {name}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/restore": {
   "post": {
    "summary": "Khôi phục app từ thùng rác",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/transfer": {
   "post": {
    "summary": "Bàn giao app: body {email}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/apps/{name}/log-drain": {
   "put": {
    "summary": "Chuyển log ra ngoài: body {url} (https, tcp, udp)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/trash": {
   "get": {
    "summary": "Thùng rác",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/overview": {
   "get": {
    "summary": "Tổng quan tài khoản",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/env-groups": {
   "get": {
    "summary": "Nhóm biến môi trường dùng chung",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   },
   "post": {
    "summary": "Tạo nhóm biến: body {name, vars}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/addons/{id}/query": {
   "post": {
    "summary": "Truy vấn database: body {sql}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/addons/{id}/metrics": {
   "get": {
    "summary": "Số liệu database",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/addons/{id}/import": {
   "post": {
    "summary": "Nhập dữ liệu từ file .sql/.gz (thân request là file)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/addons/{id}/plan": {
   "put": {
    "summary": "Đổi gói database: body {plan}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/addons/{id}/rotate-password": {
   "post": {
    "summary": "Đổi mật khẩu database",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/billing/invoice/{ym}": {
   "get": {
    "summary": "Hóa đơn tổng hợp tháng YYYY-MM",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "ym",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/billing/redeem": {
   "post": {
    "summary": "Nhập mã quà tặng: body {code}",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/security-log": {
   "get": {
    "summary": "Nhật ký bảo mật",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/templates": {
   "get": {
    "summary": "Danh sách mẫu dự án (không cần đăng nhập)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "security": []
   }
  },
  "/addons": {
   "get": {
    "summary": "Danh sách database",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   },
   "post": {
    "summary": "Tạo database (body: kind, name, plan, expose?, allowedFrom?)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/addons/{id}": {
   "get": {
    "summary": "Chi tiết và chuỗi kết nối",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "delete": {
    "summary": "Xóa database và dữ liệu",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/addons/{id}/backups": {
   "get": {
    "summary": "Danh sách bản sao lưu",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   },
   "post": {
    "summary": "Sao lưu ngay",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/addons/{id}/backups/{bid}/download": {
   "get": {
    "summary": "Tải bản sao lưu (.gz)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "bid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/addons/{id}/backups/{bid}/restore": {
   "post": {
    "summary": "Khôi phục (body: confirm:true); ghi đè dữ liệu",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "bid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/billing": {
   "get": {
    "summary": "Số dư, mã nạp tiền, 50 giao dịch gần nhất",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/billing/forecast": {
   "get": {
    "summary": "Dự báo chi phí 30 ngày",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/billing/receipt/{id}": {
   "get": {
    "summary": "Biên lai một giao dịch",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    },
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ]
   }
  },
  "/activity": {
   "get": {
    "summary": "Nhật ký hoạt động (query: app, limit)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/notifications": {
   "get": {
    "summary": "Thông báo",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  },
  "/tickets": {
   "get": {
    "summary": "Yêu cầu hỗ trợ",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   },
   "post": {
    "summary": "Gửi yêu cầu hỗ trợ (body: subject, message, app?, includeLogs?)",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "Thiếu hoặc sai khóa API"
     }
    }
   }
  }
 }
}