{
  "openapi": "3.1.0",
  "info": {
    "title": "MarzbanAPI",
    "description": "Unified GUI Censorship Resistant Solution Powered by Xray",
    "version": "0.8.4"
  },
  "paths": {
    "/api/admin/token": {
      "post": {
        "tags": ["Admin"],
        "summary": "Admin Token",
        "description": "Authenticate an admin and issue a token.",
        "operationId": "admin_token",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": { "$ref": "#/components/schemas/Body_admin_token_api_admin_token_post" }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Token" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/admin": {
      "get": {
        "tags": ["Admin"],
        "summary": "Get Current Admin",
        "description": "Retrieve the current authenticated admin.",
        "operationId": "get_current_admin",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Admin" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      },
      "post": {
        "tags": ["Admin"],
        "summary": "Create Admin",
        "description": "Create a new admin if the current admin has sudo privileges.",
        "operationId": "create_admin",
        "requestBody": {
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AdminCreate" } } },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Admin" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "409": {
            "description": "Conflict",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Conflict" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/admin/{username}": {
      "put": {
        "tags": ["Admin"],
        "summary": "Modify Admin",
        "description": "Modify an existing admin's details.",
        "operationId": "modify_admin",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AdminModify" } } }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Admin" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "delete": {
        "tags": ["Admin"],
        "summary": "Remove Admin",
        "description": "Remove an admin from the database.",
        "operationId": "remove_admin",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/admins": {
      "get": {
        "tags": ["Admin"],
        "summary": "Get Admins",
        "description": "Fetch a list of admins with optional filters for pagination and username.",
        "operationId": "get_admins",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Offset" }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Limit" }
          },
          {
            "name": "username",
            "in": "query",
            "required": false,
            "schema": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Username" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/Admin" },
                  "title": "Response Get Admins Api Admins Get"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/admin/{username}/users/disable": {
      "post": {
        "tags": ["Admin"],
        "summary": "Disable All Active Users",
        "description": "Disable all active users under a specific admin",
        "operationId": "disable_all_active_users",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/admin/{username}/users/activate": {
      "post": {
        "tags": ["Admin"],
        "summary": "Activate All Disabled Users",
        "description": "Activate all disabled users under a specific admin",
        "operationId": "activate_all_disabled_users",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/admin/usage/reset/{username}": {
      "post": {
        "tags": ["Admin"],
        "summary": "Reset Admin Usage",
        "description": "Resets usage of admin.",
        "operationId": "reset_admin_usage",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Admin" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/admin/usage/{username}": {
      "get": {
        "tags": ["Admin"],
        "summary": "Get Admin Usage",
        "description": "Retrieve the usage of given admin.",
        "operationId": "get_admin_usage",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "type": "integer", "title": "Response Get Admin Usage Api Admin Usage  Username  Get" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/core": {
      "get": {
        "tags": ["Core"],
        "summary": "Get Core Stats",
        "description": "Retrieve core statistics such as version and uptime.",
        "operationId": "get_core_stats",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CoreStats" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/core/restart": {
      "post": {
        "tags": ["Core"],
        "summary": "Restart Core",
        "description": "Restart the core and all connected nodes.",
        "operationId": "restart_core",
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/core/config": {
      "get": {
        "tags": ["Core"],
        "summary": "Get Core Config",
        "description": "Get the current core configuration.",
        "operationId": "get_core_config",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Get Core Config Api Core Config Get",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      },
      "put": {
        "tags": ["Core"],
        "summary": "Modify Core Config",
        "description": "Modify the core configuration and restart the core.",
        "operationId": "modify_core_config",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { "type": "object", "title": "Payload", "additionalProperties": true }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Modify Core Config Api Core Config Put",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/node/settings": {
      "get": {
        "tags": ["Node"],
        "summary": "Get Node Settings",
        "description": "Retrieve the current node settings, including TLS certificate.",
        "operationId": "get_node_settings",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NodeSettings" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/node": {
      "post": {
        "tags": ["Node"],
        "summary": "Add Node",
        "description": "Add a new node to the database and optionally add it as a host.",
        "operationId": "add_node",
        "requestBody": {
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NodeCreate" } } },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NodeResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "409": {
            "description": "Conflict",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Conflict" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/node/{node_id}": {
      "get": {
        "tags": ["Node"],
        "summary": "Get Node",
        "description": "Retrieve details of a specific node by its ID.",
        "operationId": "get_node",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "node_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Node Id" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NodeResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "put": {
        "tags": ["Node"],
        "summary": "Modify Node",
        "description": "Update a node's details. Only accessible to sudo admins.",
        "operationId": "modify_node",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "node_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Node Id" } }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NodeModify" } } }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NodeResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "delete": {
        "tags": ["Node"],
        "summary": "Remove Node",
        "description": "Delete a node and remove it from xray in the background.",
        "operationId": "remove_node",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "node_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Node Id" } }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/nodes": {
      "get": {
        "tags": ["Node"],
        "summary": "Get Nodes",
        "description": "Retrieve a list of all nodes. Accessible only to sudo admins.",
        "operationId": "get_nodes",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": { "$ref": "#/components/schemas/NodeResponse" },
                  "type": "array",
                  "title": "Response Get Nodes Api Nodes Get"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/node/{node_id}/reconnect": {
      "post": {
        "tags": ["Node"],
        "summary": "Reconnect Node",
        "description": "Trigger a reconnection for the specified node. Only accessible to sudo admins.",
        "operationId": "reconnect_node",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "node_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Node Id" } }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/nodes/usage": {
      "get": {
        "tags": ["Node"],
        "summary": "Get Usage",
        "description": "Retrieve usage statistics for nodes within a specified date range.",
        "operationId": "get_usage",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "Start" }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "End" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NodesUsageResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/sub/{token}/": {
      "get": {
        "tags": ["Subscription"],
        "summary": "User Subscription",
        "description": "Provides a subscription link based on the user agent (Clash, V2Ray, etc.).",
        "operationId": "user_subscription",
        "parameters": [
          { "name": "token", "in": "path", "required": true, "schema": { "type": "string", "title": "Token" } },
          {
            "name": "user-agent",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "User-Agent" }
          }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/sub/{token}/info": {
      "get": {
        "tags": ["Subscription"],
        "summary": "User Subscription Info",
        "description": "Retrieves detailed information about the user's subscription.",
        "operationId": "user_subscription_info",
        "parameters": [
          { "name": "token", "in": "path", "required": true, "schema": { "type": "string", "title": "Token" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubscriptionUserResponse" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/sub/{token}/usage": {
      "get": {
        "tags": ["Subscription"],
        "summary": "User Get Usage",
        "description": "Fetches the usage statistics for the user within a specified date range.",
        "operationId": "user_get_usage",
        "parameters": [
          { "name": "token", "in": "path", "required": true, "schema": { "type": "string", "title": "Token" } },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "Start" }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "End" }
          }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/sub/{token}/{client_type}": {
      "get": {
        "tags": ["Subscription"],
        "summary": "User Subscription With Client Type",
        "description": "Provides a subscription link based on the specified client type (e.g., Clash, V2Ray).",
        "operationId": "user_subscription_with_client_type",
        "parameters": [
          {
            "name": "client_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "sing-box|clash-meta|clash|outline|v2ray|v2ray-json",
              "title": "Client Type"
            }
          },
          { "name": "token", "in": "path", "required": true, "schema": { "type": "string", "title": "Token" } },
          {
            "name": "user-agent",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "User-Agent" }
          }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/system": {
      "get": {
        "tags": ["System"],
        "summary": "Get System Stats",
        "description": "Fetch system stats including memory, CPU, and user metrics.",
        "operationId": "get_system_stats",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SystemStats" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/inbounds": {
      "get": {
        "tags": ["System"],
        "summary": "Get Inbounds",
        "description": "Retrieve inbound configurations grouped by protocol.",
        "operationId": "get_inbounds",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": { "items": { "$ref": "#/components/schemas/ProxyInbound" }, "type": "array" },
                  "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
                  "type": "object",
                  "title": "Response Get Inbounds Api Inbounds Get"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/hosts": {
      "get": {
        "tags": ["System"],
        "summary": "Get Hosts",
        "description": "Get a list of proxy hosts grouped by inbound tag.",
        "operationId": "get_hosts",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": { "items": { "$ref": "#/components/schemas/ProxyHost" }, "type": "array" },
                  "type": "object",
                  "title": "Response Get Hosts Api Hosts Get"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      },
      "put": {
        "tags": ["System"],
        "summary": "Modify Hosts",
        "description": "Modify proxy hosts and update the configuration.",
        "operationId": "modify_hosts",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": { "items": { "$ref": "#/components/schemas/ProxyHost" }, "type": "array" },
                "type": "object",
                "title": "Modified Hosts"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": { "items": { "$ref": "#/components/schemas/ProxyHost" }, "type": "array" },
                  "type": "object",
                  "title": "Response Modify Hosts Api Hosts Put"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/user_template": {
      "post": {
        "tags": ["User Template"],
        "summary": "Add User Template",
        "description": "Add a new user template\n\n- **name** can be up to 64 characters\n- **data_limit** must be in bytes and larger or equal to 0\n- **expire_duration** must be in seconds and larger or equat to 0\n- **inbounds** dictionary of protocol:inbound_tags, empty means all inbounds",
        "operationId": "add_user_template",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserTemplateCreate" } } }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserTemplateResponse" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "get": {
        "tags": ["User Template"],
        "summary": "Get User Templates",
        "description": "Get a list of User Templates with optional pagination",
        "operationId": "get_user_templates",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "offset", "in": "query", "required": false, "schema": { "type": "integer", "title": "Offset" } },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "title": "Limit" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/UserTemplateResponse" },
                  "title": "Response Get User Templates Api User Template Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/user_template/{template_id}": {
      "get": {
        "tags": ["User Template"],
        "summary": "Get User Template Endpoint",
        "description": "Get User Template information with id",
        "operationId": "get_user_template_endpoint",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "Template Id" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserTemplateResponse" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "put": {
        "tags": ["User Template"],
        "summary": "Modify User Template",
        "description": "Modify User Template\n\n- **name** can be up to 64 characters\n- **data_limit** must be in bytes and larger or equal to 0\n- **expire_duration** must be in seconds and larger or equat to 0\n- **inbounds** dictionary of protocol:inbound_tags, empty means all inbounds",
        "operationId": "modify_user_template",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "Template Id" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserTemplateModify" } } }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserTemplateResponse" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "delete": {
        "tags": ["User Template"],
        "summary": "Remove User Template",
        "description": "Remove a User Template by its ID",
        "operationId": "remove_user_template",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "Template Id" }
          }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/user": {
      "post": {
        "tags": ["User"],
        "summary": "Add User",
        "description": "Add a new user\n\n- **username**: 3 to 32 characters, can include a-z, 0-9, and underscores.\n- **status**: User's status, defaults to `active`. Special rules if `on_hold`.\n- **expire**: UTC timestamp for account expiration. Use `0` for unlimited.\n- **data_limit**: Max data usage in bytes (e.g., `1073741824` for 1GB). `0` means unlimited.\n- **data_limit_reset_strategy**: Defines how/if data limit resets. `no_reset` means it never resets.\n- **proxies**: Dictionary of protocol settings (e.g., `vmess`, `vless`).\n- **inbounds**: Dictionary of protocol tags to specify inbound connections.\n- **note**: Optional text field for additional user information or notes.\n- **on_hold_timeout**: UTC timestamp when `on_hold` status should start or end.\n- **on_hold_expire_duration**: Duration (in seconds) for how long the user should stay in `on_hold` status.\n- **next_plan**: Next user plan (resets after use).",
        "operationId": "add_user",
        "requestBody": {
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserCreate" } } },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "400": {
            "description": "Bad request",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPException" } } }
          },
          "409": {
            "description": "Conflict",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Conflict" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/user/{username}": {
      "get": {
        "tags": ["User"],
        "summary": "Get User",
        "description": "Get user information",
        "operationId": "get_user",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "put": {
        "tags": ["User"],
        "summary": "Modify User",
        "description": "Modify an existing user\n\n- **username**: Cannot be changed. Used to identify the user.\n- **status**: User's new status. Can be 'active', 'disabled', 'on_hold', 'limited', or 'expired'.\n- **expire**: UTC timestamp for new account expiration. Set to `0` for unlimited, `null` for no change.\n- **data_limit**: New max data usage in bytes (e.g., `1073741824` for 1GB). Set to `0` for unlimited, `null` for no change.\n- **data_limit_reset_strategy**: New strategy for data limit reset. Options include 'daily', 'weekly', 'monthly', or 'no_reset'.\n- **proxies**: Dictionary of new protocol settings (e.g., `vmess`, `vless`). Empty dictionary means no change.\n- **inbounds**: Dictionary of new protocol tags to specify inbound connections. Empty dictionary means no change.\n- **note**: New optional text for additional user information or notes. `null` means no change.\n- **on_hold_timeout**: New UTC timestamp for when `on_hold` status should start or end. Only applicable if status is changed to 'on_hold'.\n- **on_hold_expire_duration**: New duration (in seconds) for how long the user should stay in `on_hold` status. Only applicable if status is changed to 'on_hold'.\n- **next_plan**: Next user plan (resets after use).\n\nNote: Fields set to `null` or omitted will not be modified.",
        "operationId": "modify_user",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserModify" } } }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "400": {
            "description": "Bad request",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPException" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "delete": {
        "tags": ["User"],
        "summary": "Remove User",
        "description": "Remove a user",
        "operationId": "remove_user",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/user/{username}/reset": {
      "post": {
        "tags": ["User"],
        "summary": "Reset User Data Usage",
        "description": "Reset user data usage",
        "operationId": "reset_user_data_usage",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/user/{username}/revoke_sub": {
      "post": {
        "tags": ["User"],
        "summary": "Revoke User Subscription",
        "description": "Revoke users subscription (Subscription link and proxies)",
        "operationId": "revoke_user_subscription",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/users": {
      "get": {
        "tags": ["User"],
        "summary": "Get Users",
        "description": "Get all users",
        "operationId": "get_users",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "offset", "in": "query", "required": false, "schema": { "type": "integer", "title": "Offset" } },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "title": "Limit" } },
          {
            "name": "username",
            "in": "query",
            "required": false,
            "schema": { "type": "array", "items": { "type": "string" }, "title": "Username" }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Search" }
          },
          {
            "name": "admin",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "null" }],
              "title": "Admin"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": { "$ref": "#/components/schemas/UserStatus" }
          },
          { "name": "sort", "in": "query", "required": false, "schema": { "type": "string", "title": "Sort" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "400": {
            "description": "Bad request",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPException" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/users/reset": {
      "post": {
        "tags": ["User"],
        "summary": "Reset Users Data Usage",
        "description": "Reset all users data usage",
        "operationId": "reset_users_data_usage",
        "responses": {
          "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          }
        },
        "security": [{ "OAuth2PasswordBearer": [] }]
      }
    },
    "/api/user/{username}/usage": {
      "get": {
        "tags": ["User"],
        "summary": "Get User Usage",
        "description": "Get users usage",
        "operationId": "get_user_usage",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "Start" }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "End" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserUsagesResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/user/{username}/active-next": {
      "post": {
        "tags": ["User"],
        "summary": "Active Next Plan",
        "description": "Reset user by next plan",
        "operationId": "active_next_plan",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "403": {
            "description": "Forbidden",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Forbidden" } } }
          },
          "404": {
            "description": "Not found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotFound" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/users/usage": {
      "get": {
        "tags": ["User"],
        "summary": "Get Users Usage",
        "description": "Get all users usage",
        "operationId": "get_users_usage",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "Start" }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "", "title": "End" }
          },
          {
            "name": "admin",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "null" }],
              "title": "Admin"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersUsagesResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/user/{username}/set-owner": {
      "put": {
        "tags": ["User"],
        "summary": "Set Owner",
        "description": "Set a new owner (admin) for a user.",
        "operationId": "set_owner",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          { "name": "username", "in": "path", "required": true, "schema": { "type": "string", "title": "Username" } },
          {
            "name": "admin_username",
            "in": "query",
            "required": true,
            "schema": { "type": "string", "title": "Admin Username" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserResponse" } } }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/api/users/expired": {
      "get": {
        "tags": ["User"],
        "summary": "Get Expired Users",
        "description": "Get users who have expired within the specified date range.\n\n- **expired_after** UTC datetime (optional)\n- **expired_before** UTC datetime (optional)\n- At least one of expired_after or expired_before must be provided for filtering\n- If both are omitted, returns all expired users",
        "operationId": "get_expired_users",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "expired_after",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
              "title": "Expired After"
            },
            "example": "2024-01-01T00:00:00"
          },
          {
            "name": "expired_before",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
              "title": "Expired Before"
            },
            "example": "2024-01-31T23:59:59"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "type": "string" },
                  "title": "Response Get Expired Users Api Users Expired Get"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      },
      "delete": {
        "tags": ["User"],
        "summary": "Delete Expired Users",
        "description": "Delete users who have expired within the specified date range.\n\n- **expired_after** UTC datetime (optional)\n- **expired_before** UTC datetime (optional)\n- At least one of expired_after or expired_before must be provided",
        "operationId": "delete_expired_users",
        "security": [{ "OAuth2PasswordBearer": [] }],
        "parameters": [
          {
            "name": "expired_after",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
              "title": "Expired After"
            },
            "example": "2024-01-01T00:00:00"
          },
          {
            "name": "expired_before",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
              "title": "Expired Before"
            },
            "example": "2024-01-31T23:59:59"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "type": "string" },
                  "title": "Response Delete Expired Users Api Users Expired Delete"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": { "WWW-Authenticate": { "description": "Authentication type", "schema": { "type": "string" } } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } }
          },
          "422": {
            "description": "Validation Error",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }
          }
        }
      }
    },
    "/": {
      "get": {
        "summary": "Base",
        "operationId": "base",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": { "text/html": { "schema": { "type": "string" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Admin": {
        "properties": {
          "username": { "type": "string", "title": "Username" },
          "is_sudo": { "type": "boolean", "title": "Is Sudo" },
          "telegram_id": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Telegram Id" },
          "discord_webhook": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Discord Webhook" },
          "users_usage": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Users Usage" }
        },
        "type": "object",
        "required": ["username", "is_sudo"],
        "title": "Admin"
      },
      "AdminCreate": {
        "properties": {
          "username": { "type": "string", "title": "Username" },
          "is_sudo": { "type": "boolean", "title": "Is Sudo" },
          "telegram_id": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Telegram Id" },
          "discord_webhook": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Discord Webhook" },
          "users_usage": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Users Usage" },
          "password": { "type": "string", "title": "Password" }
        },
        "type": "object",
        "required": ["username", "is_sudo", "password"],
        "title": "AdminCreate"
      },
      "AdminModify": {
        "properties": {
          "password": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Password" },
          "is_sudo": { "type": "boolean", "title": "Is Sudo" },
          "telegram_id": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Telegram Id" },
          "discord_webhook": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Discord Webhook" }
        },
        "type": "object",
        "required": ["is_sudo"],
        "title": "AdminModify"
      },
      "Body_admin_token_api_admin_token_post": {
        "properties": {
          "grant_type": {
            "anyOf": [{ "type": "string", "pattern": "password" }, { "type": "null" }],
            "title": "Grant Type"
          },
          "username": { "type": "string", "title": "Username" },
          "password": { "type": "string", "title": "Password" },
          "scope": { "type": "string", "title": "Scope", "default": "" },
          "client_id": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Client Id" },
          "client_secret": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Client Secret" }
        },
        "type": "object",
        "required": ["username", "password"],
        "title": "Body_admin_token_api_admin_token_post"
      },
      "Conflict": {
        "properties": { "detail": { "type": "string", "title": "Detail", "default": "Entity already exists" } },
        "type": "object",
        "title": "Conflict"
      },
      "CoreStats": {
        "properties": {
          "version": { "type": "string", "title": "Version" },
          "started": { "type": "boolean", "title": "Started" },
          "logs_websocket": { "type": "string", "title": "Logs Websocket" }
        },
        "type": "object",
        "required": ["version", "started", "logs_websocket"],
        "title": "CoreStats"
      },
      "Forbidden": {
        "properties": { "detail": { "type": "string", "title": "Detail", "default": "You are not allowed to ..." } },
        "type": "object",
        "title": "Forbidden"
      },
      "HTTPException": {
        "properties": { "detail": { "type": "string", "title": "Detail" } },
        "type": "object",
        "required": ["detail"],
        "title": "HTTPException"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "NextPlanModel": {
        "properties": {
          "data_limit": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Data Limit" },
          "expire": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Expire" },
          "add_remaining_traffic": { "type": "boolean", "title": "Add Remaining Traffic", "default": false },
          "fire_on_either": { "type": "boolean", "title": "Fire On Either", "default": true }
        },
        "type": "object",
        "title": "NextPlanModel"
      },
      "NodeCreate": {
        "properties": {
          "name": { "type": "string", "title": "Name" },
          "address": { "type": "string", "title": "Address" },
          "port": { "type": "integer", "title": "Port", "default": 62050 },
          "api_port": { "type": "integer", "title": "Api Port", "default": 62051 },
          "usage_coefficient": {
            "type": "number",
            "exclusiveMinimum": 0.0,
            "title": "Usage Coefficient",
            "default": 1.0
          },
          "add_as_new_host": { "type": "boolean", "title": "Add As New Host", "default": true }
        },
        "type": "object",
        "required": ["name", "address"],
        "title": "NodeCreate",
        "example": {
          "add_as_new_host": true,
          "address": "192.168.1.1",
          "api_port": 62051,
          "name": "DE node",
          "port": 62050,
          "usage_coefficient": 1
        }
      },
      "NodeModify": {
        "properties": {
          "name": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Name", "nullable": true },
          "address": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Address", "nullable": true },
          "port": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Port", "nullable": true },
          "api_port": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Api Port", "nullable": true },
          "usage_coefficient": {
            "anyOf": [{ "type": "number" }, { "type": "null" }],
            "title": "Usage Coefficient",
            "nullable": true
          },
          "status": { "anyOf": [{ "$ref": "#/components/schemas/NodeStatus" }, { "type": "null" }], "nullable": true }
        },
        "type": "object",
        "title": "NodeModify",
        "example": {
          "address": "192.168.1.1",
          "api_port": 62051,
          "name": "DE node",
          "port": 62050,
          "status": "disabled",
          "usage_coefficient": 1.0
        }
      },
      "NodeResponse": {
        "properties": {
          "name": { "type": "string", "title": "Name" },
          "address": { "type": "string", "title": "Address" },
          "port": { "type": "integer", "title": "Port", "default": 62050 },
          "api_port": { "type": "integer", "title": "Api Port", "default": 62051 },
          "usage_coefficient": {
            "type": "number",
            "exclusiveMinimum": 0.0,
            "title": "Usage Coefficient",
            "default": 1.0
          },
          "id": { "type": "integer", "title": "Id" },
          "xray_version": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Xray Version" },
          "status": { "$ref": "#/components/schemas/NodeStatus" },
          "message": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Message" }
        },
        "type": "object",
        "required": ["name", "address", "id", "status"],
        "title": "NodeResponse"
      },
      "NodeSettings": {
        "properties": {
          "min_node_version": { "type": "string", "title": "Min Node Version", "default": "v0.2.0" },
          "certificate": { "type": "string", "title": "Certificate" }
        },
        "type": "object",
        "required": ["certificate"],
        "title": "NodeSettings"
      },
      "NodeStatus": {
        "type": "string",
        "enum": ["connected", "connecting", "error", "disabled"],
        "title": "NodeStatus"
      },
      "NodeUsageResponse": {
        "properties": {
          "node_id": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Node Id" },
          "node_name": { "type": "string", "title": "Node Name" },
          "uplink": { "type": "integer", "title": "Uplink" },
          "downlink": { "type": "integer", "title": "Downlink" }
        },
        "type": "object",
        "required": ["node_name", "uplink", "downlink"],
        "title": "NodeUsageResponse"
      },
      "NodesUsageResponse": {
        "properties": {
          "usages": {
            "items": { "$ref": "#/components/schemas/NodeUsageResponse" },
            "type": "array",
            "title": "Usages"
          }
        },
        "type": "object",
        "required": ["usages"],
        "title": "NodesUsageResponse"
      },
      "NotFound": {
        "properties": { "detail": { "type": "string", "title": "Detail", "default": "Entity {} not found" } },
        "type": "object",
        "title": "NotFound"
      },
      "ProxyHost": {
        "properties": {
          "remark": { "type": "string", "title": "Remark" },
          "address": { "type": "string", "title": "Address" },
          "port": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Port", "nullable": true },
          "sni": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Sni", "nullable": true },
          "host": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Host", "nullable": true },
          "path": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Path", "nullable": true },
          "security": { "$ref": "#/components/schemas/ProxyHostSecurity", "default": "inbound_default" },
          "alpn": { "$ref": "#/components/schemas/ProxyHostALPN", "default": "" },
          "fingerprint": { "$ref": "#/components/schemas/ProxyHostFingerprint", "default": "" },
          "allowinsecure": { "anyOf": [{ "type": "boolean" }, { "type": "null" }], "title": "Allowinsecure" },
          "is_disabled": { "anyOf": [{ "type": "boolean" }, { "type": "null" }], "title": "Is Disabled" },
          "mux_enable": { "anyOf": [{ "type": "boolean" }, { "type": "null" }], "title": "Mux Enable" },
          "fragment_setting": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Fragment Setting",
            "nullable": true
          },
          "noise_setting": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Noise Setting",
            "nullable": true
          },
          "random_user_agent": { "anyOf": [{ "type": "boolean" }, { "type": "null" }], "title": "Random User Agent" },
          "use_sni_as_host": { "anyOf": [{ "type": "boolean" }, { "type": "null" }], "title": "Use Sni As Host" }
        },
        "type": "object",
        "required": ["remark", "address"],
        "title": "ProxyHost"
      },
      "ProxyHostALPN": {
        "type": "string",
        "enum": ["", "h3", "h2", "http/1.1", "h3,h2,http/1.1", "h3,h2", "h2,http/1.1"],
        "title": "ProxyHostALPN"
      },
      "ProxyHostFingerprint": {
        "type": "string",
        "enum": ["", "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized"],
        "title": "ProxyHostFingerprint"
      },
      "ProxyHostSecurity": {
        "type": "string",
        "enum": ["inbound_default", "none", "tls"],
        "title": "ProxyHostSecurity"
      },
      "ProxyInbound": {
        "properties": {
          "tag": { "type": "string", "title": "Tag" },
          "protocol": { "$ref": "#/components/schemas/ProxyTypes" },
          "network": { "type": "string", "title": "Network" },
          "tls": { "type": "string", "title": "Tls" },
          "port": { "anyOf": [{ "type": "integer" }, { "type": "string" }], "title": "Port" }
        },
        "type": "object",
        "required": ["tag", "protocol", "network", "tls", "port"],
        "title": "ProxyInbound"
      },
      "ProxySettings": { "properties": {}, "type": "object", "title": "ProxySettings", "additionalProperties": true },
      "ProxyTypes": { "type": "string", "enum": ["vmess", "vless", "trojan", "shadowsocks"], "title": "ProxyTypes" },
      "SubscriptionUserResponse": {
        "properties": {
          "proxies": {
            "additionalProperties": { "$ref": "#/components/schemas/ProxySettings" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Proxies"
          },
          "expire": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Expire", "nullable": true },
          "data_limit": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Data Limit",
            "description": "data_limit can be 0 or greater"
          },
          "data_limit_reset_strategy": {
            "$ref": "#/components/schemas/UserDataLimitResetStrategy",
            "default": "no_reset"
          },
          "sub_updated_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Sub Updated At",
            "nullable": true
          },
          "sub_last_user_agent": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Sub Last User Agent",
            "nullable": true
          },
          "online_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Online At",
            "nullable": true
          },
          "on_hold_expire_duration": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "On Hold Expire Duration",
            "nullable": true
          },
          "on_hold_timeout": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "On Hold Timeout",
            "nullable": true
          },
          "next_plan": {
            "anyOf": [{ "$ref": "#/components/schemas/NextPlanModel" }, { "type": "null" }],
            "nullable": true
          },
          "username": { "type": "string", "title": "Username" },
          "status": { "$ref": "#/components/schemas/UserStatus" },
          "used_traffic": { "type": "integer", "title": "Used Traffic" },
          "lifetime_used_traffic": { "type": "integer", "title": "Lifetime Used Traffic", "default": 0 },
          "created_at": { "type": "string", "format": "date-time", "title": "Created At" },
          "links": { "items": { "type": "string" }, "type": "array", "title": "Links", "default": [] },
          "subscription_url": { "type": "string", "title": "Subscription Url", "default": "" }
        },
        "type": "object",
        "required": ["proxies", "username", "status", "used_traffic", "created_at"],
        "title": "SubscriptionUserResponse"
      },
      "SystemStats": {
        "properties": {
          "version": { "type": "string", "title": "Version" },
          "mem_total": { "type": "integer", "title": "Mem Total" },
          "mem_used": { "type": "integer", "title": "Mem Used" },
          "cpu_cores": { "type": "integer", "title": "Cpu Cores" },
          "cpu_usage": { "type": "number", "title": "Cpu Usage" },
          "total_user": { "type": "integer", "title": "Total User" },
          "online_users": { "type": "integer", "title": "Online Users" },
          "users_active": { "type": "integer", "title": "Users Active" },
          "users_on_hold": { "type": "integer", "title": "Users On Hold" },
          "users_disabled": { "type": "integer", "title": "Users Disabled" },
          "users_expired": { "type": "integer", "title": "Users Expired" },
          "users_limited": { "type": "integer", "title": "Users Limited" },
          "incoming_bandwidth": { "type": "integer", "title": "Incoming Bandwidth" },
          "outgoing_bandwidth": { "type": "integer", "title": "Outgoing Bandwidth" },
          "incoming_bandwidth_speed": { "type": "integer", "title": "Incoming Bandwidth Speed" },
          "outgoing_bandwidth_speed": { "type": "integer", "title": "Outgoing Bandwidth Speed" }
        },
        "type": "object",
        "required": [
          "version",
          "mem_total",
          "mem_used",
          "cpu_cores",
          "cpu_usage",
          "total_user",
          "online_users",
          "users_active",
          "users_on_hold",
          "users_disabled",
          "users_expired",
          "users_limited",
          "incoming_bandwidth",
          "outgoing_bandwidth",
          "incoming_bandwidth_speed",
          "outgoing_bandwidth_speed"
        ],
        "title": "SystemStats"
      },
      "Token": {
        "properties": {
          "access_token": { "type": "string", "title": "Access Token" },
          "token_type": { "type": "string", "title": "Token Type", "default": "bearer" }
        },
        "type": "object",
        "required": ["access_token"],
        "title": "Token"
      },
      "Unauthorized": {
        "properties": { "detail": { "type": "string", "title": "Detail", "default": "Not authenticated" } },
        "type": "object",
        "title": "Unauthorized"
      },
      "UserCreate": {
        "properties": {
          "proxies": {
            "additionalProperties": { "$ref": "#/components/schemas/ProxySettings" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Proxies",
            "default": {}
          },
          "expire": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Expire", "nullable": true },
          "data_limit": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Data Limit",
            "description": "data_limit can be 0 or greater"
          },
          "data_limit_reset_strategy": {
            "$ref": "#/components/schemas/UserDataLimitResetStrategy",
            "default": "no_reset"
          },
          "inbounds": {
            "additionalProperties": { "items": { "type": "string" }, "type": "array" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Inbounds",
            "default": {}
          },
          "note": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Note", "nullable": true },
          "sub_updated_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Sub Updated At",
            "nullable": true
          },
          "sub_last_user_agent": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Sub Last User Agent",
            "nullable": true
          },
          "online_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Online At",
            "nullable": true
          },
          "on_hold_expire_duration": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "On Hold Expire Duration",
            "nullable": true
          },
          "on_hold_timeout": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "On Hold Timeout",
            "nullable": true
          },
          "auto_delete_in_days": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "Auto Delete In Days",
            "nullable": true
          },
          "next_plan": {
            "anyOf": [{ "$ref": "#/components/schemas/NextPlanModel" }, { "type": "null" }],
            "nullable": true
          },
          "username": { "type": "string", "title": "Username" },
          "status": { "$ref": "#/components/schemas/UserStatusCreate" }
        },
        "type": "object",
        "required": ["username"],
        "title": "UserCreate",
        "example": {
          "data_limit": 0,
          "data_limit_reset_strategy": "no_reset",
          "expire": 0,
          "inbounds": {
            "vless": ["VLESS TCP REALITY", "VLESS GRPC REALITY"],
            "vmess": ["VMess TCP", "VMess Websocket"]
          },
          "next_plan": { "add_remaining_traffic": false, "data_limit": 0, "expire": 0, "fire_on_either": true },
          "note": "",
          "on_hold_expire_duration": 0,
          "on_hold_timeout": "2023-11-03T20:30:00",
          "proxies": { "vless": {}, "vmess": { "id": "35e4e39c-7d5c-4f4b-8b71-558e4f37ff53" } },
          "status": "active",
          "username": "user1234"
        }
      },
      "UserDataLimitResetStrategy": {
        "type": "string",
        "enum": ["no_reset", "day", "week", "month", "year"],
        "title": "UserDataLimitResetStrategy"
      },
      "UserModify": {
        "properties": {
          "proxies": {
            "additionalProperties": { "$ref": "#/components/schemas/ProxySettings" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Proxies",
            "default": {}
          },
          "expire": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Expire", "nullable": true },
          "data_limit": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Data Limit",
            "description": "data_limit can be 0 or greater"
          },
          "data_limit_reset_strategy": { "$ref": "#/components/schemas/UserDataLimitResetStrategy" },
          "inbounds": {
            "additionalProperties": { "items": { "type": "string" }, "type": "array" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Inbounds",
            "default": {}
          },
          "note": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Note", "nullable": true },
          "sub_updated_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Sub Updated At",
            "nullable": true
          },
          "sub_last_user_agent": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Sub Last User Agent",
            "nullable": true
          },
          "online_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Online At",
            "nullable": true
          },
          "on_hold_expire_duration": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "On Hold Expire Duration",
            "nullable": true
          },
          "on_hold_timeout": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "On Hold Timeout",
            "nullable": true
          },
          "auto_delete_in_days": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "Auto Delete In Days",
            "nullable": true
          },
          "next_plan": {
            "anyOf": [{ "$ref": "#/components/schemas/NextPlanModel" }, { "type": "null" }],
            "nullable": true
          },
          "status": { "$ref": "#/components/schemas/UserStatusModify" }
        },
        "type": "object",
        "title": "UserModify",
        "example": {
          "data_limit": 0,
          "data_limit_reset_strategy": "no_reset",
          "expire": 0,
          "inbounds": {
            "vless": ["VLESS TCP REALITY", "VLESS GRPC REALITY"],
            "vmess": ["VMess TCP", "VMess Websocket"]
          },
          "next_plan": { "add_remaining_traffic": false, "data_limit": 0, "expire": 0, "fire_on_either": true },
          "note": "",
          "on_hold_expire_duration": 0,
          "on_hold_timeout": "2023-11-03T20:30:00",
          "proxies": { "vless": {}, "vmess": { "id": "35e4e39c-7d5c-4f4b-8b71-558e4f37ff53" } },
          "status": "active"
        }
      },
      "UserResponse": {
        "properties": {
          "proxies": {
            "additionalProperties": { "$ref": "#/components/schemas/ProxySettings" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Proxies"
          },
          "expire": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Expire", "nullable": true },
          "data_limit": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Data Limit",
            "description": "data_limit can be 0 or greater"
          },
          "data_limit_reset_strategy": {
            "$ref": "#/components/schemas/UserDataLimitResetStrategy",
            "default": "no_reset"
          },
          "inbounds": {
            "additionalProperties": { "items": { "type": "string" }, "type": "array" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Inbounds",
            "default": {}
          },
          "note": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Note", "nullable": true },
          "sub_updated_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Sub Updated At",
            "nullable": true
          },
          "sub_last_user_agent": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Sub Last User Agent",
            "nullable": true
          },
          "online_at": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "Online At",
            "nullable": true
          },
          "on_hold_expire_duration": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "On Hold Expire Duration",
            "nullable": true
          },
          "on_hold_timeout": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "title": "On Hold Timeout",
            "nullable": true
          },
          "auto_delete_in_days": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "Auto Delete In Days",
            "nullable": true
          },
          "next_plan": {
            "anyOf": [{ "$ref": "#/components/schemas/NextPlanModel" }, { "type": "null" }],
            "nullable": true
          },
          "username": { "type": "string", "title": "Username" },
          "status": { "$ref": "#/components/schemas/UserStatus" },
          "used_traffic": { "type": "integer", "title": "Used Traffic" },
          "lifetime_used_traffic": { "type": "integer", "title": "Lifetime Used Traffic", "default": 0 },
          "created_at": { "type": "string", "format": "date-time", "title": "Created At" },
          "links": { "items": { "type": "string" }, "type": "array", "title": "Links", "default": [] },
          "subscription_url": { "type": "string", "title": "Subscription Url", "default": "" },
          "excluded_inbounds": {
            "additionalProperties": { "items": { "type": "string" }, "type": "array" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Excluded Inbounds",
            "default": {}
          },
          "admin": { "anyOf": [{ "$ref": "#/components/schemas/Admin" }, { "type": "null" }] }
        },
        "type": "object",
        "required": ["proxies", "username", "status", "used_traffic", "created_at"],
        "title": "UserResponse"
      },
      "UserStatus": {
        "type": "string",
        "enum": ["active", "disabled", "limited", "expired", "on_hold"],
        "title": "UserStatus"
      },
      "UserStatusCreate": { "type": "string", "enum": ["active", "on_hold"], "title": "UserStatusCreate" },
      "UserStatusModify": { "type": "string", "enum": ["active", "disabled", "on_hold"], "title": "UserStatusModify" },
      "UserTemplateCreate": {
        "properties": {
          "name": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Name", "nullable": true },
          "data_limit": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Data Limit",
            "description": "data_limit can be 0 or greater"
          },
          "expire_duration": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Expire Duration",
            "description": "expire_duration can be 0 or greater in seconds"
          },
          "username_prefix": {
            "anyOf": [{ "type": "string", "maxLength": 20, "minLength": 1 }, { "type": "null" }],
            "title": "Username Prefix"
          },
          "username_suffix": {
            "anyOf": [{ "type": "string", "maxLength": 20, "minLength": 1 }, { "type": "null" }],
            "title": "Username Suffix"
          },
          "inbounds": {
            "additionalProperties": { "items": { "type": "string" }, "type": "array" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Inbounds",
            "default": {}
          }
        },
        "type": "object",
        "title": "UserTemplateCreate",
        "example": {
          "data_limit": 0,
          "expire_duration": 0,
          "inbounds": { "vless": ["VLESS_INBOUND"], "vmess": ["VMESS_INBOUND"] },
          "name": "my template 1"
        }
      },
      "UserTemplateModify": {
        "properties": {
          "name": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Name", "nullable": true },
          "data_limit": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Data Limit",
            "description": "data_limit can be 0 or greater"
          },
          "expire_duration": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Expire Duration",
            "description": "expire_duration can be 0 or greater in seconds"
          },
          "username_prefix": {
            "anyOf": [{ "type": "string", "maxLength": 20, "minLength": 1 }, { "type": "null" }],
            "title": "Username Prefix"
          },
          "username_suffix": {
            "anyOf": [{ "type": "string", "maxLength": 20, "minLength": 1 }, { "type": "null" }],
            "title": "Username Suffix"
          },
          "inbounds": {
            "additionalProperties": { "items": { "type": "string" }, "type": "array" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Inbounds",
            "default": {}
          }
        },
        "type": "object",
        "title": "UserTemplateModify",
        "example": {
          "data_limit": 0,
          "expire_duration": 0,
          "inbounds": { "vless": ["VLESS_INBOUND"], "vmess": ["VMESS_INBOUND"] },
          "name": "my template 1"
        }
      },
      "UserTemplateResponse": {
        "properties": {
          "name": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Name", "nullable": true },
          "data_limit": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Data Limit",
            "description": "data_limit can be 0 or greater"
          },
          "expire_duration": {
            "anyOf": [{ "type": "integer", "minimum": 0.0 }, { "type": "null" }],
            "title": "Expire Duration",
            "description": "expire_duration can be 0 or greater in seconds"
          },
          "username_prefix": {
            "anyOf": [{ "type": "string", "maxLength": 20, "minLength": 1 }, { "type": "null" }],
            "title": "Username Prefix"
          },
          "username_suffix": {
            "anyOf": [{ "type": "string", "maxLength": 20, "minLength": 1 }, { "type": "null" }],
            "title": "Username Suffix"
          },
          "inbounds": {
            "additionalProperties": { "items": { "type": "string" }, "type": "array" },
            "propertyNames": { "$ref": "#/components/schemas/ProxyTypes" },
            "type": "object",
            "title": "Inbounds",
            "default": {}
          },
          "id": { "type": "integer", "title": "Id" }
        },
        "type": "object",
        "required": ["id"],
        "title": "UserTemplateResponse"
      },
      "UserUsageResponse": {
        "properties": {
          "node_id": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Node Id" },
          "node_name": { "type": "string", "title": "Node Name" },
          "used_traffic": { "type": "integer", "title": "Used Traffic" }
        },
        "type": "object",
        "required": ["node_name", "used_traffic"],
        "title": "UserUsageResponse"
      },
      "UserUsagesResponse": {
        "properties": {
          "username": { "type": "string", "title": "Username" },
          "usages": {
            "items": { "$ref": "#/components/schemas/UserUsageResponse" },
            "type": "array",
            "title": "Usages"
          }
        },
        "type": "object",
        "required": ["username", "usages"],
        "title": "UserUsagesResponse"
      },
      "UsersResponse": {
        "properties": {
          "users": { "items": { "$ref": "#/components/schemas/UserResponse" }, "type": "array", "title": "Users" },
          "total": { "type": "integer", "title": "Total" }
        },
        "type": "object",
        "required": ["users", "total"],
        "title": "UsersResponse"
      },
      "UsersUsagesResponse": {
        "properties": {
          "usages": {
            "items": { "$ref": "#/components/schemas/UserUsageResponse" },
            "type": "array",
            "title": "Usages"
          }
        },
        "type": "object",
        "required": ["usages"],
        "title": "UsersUsagesResponse"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] },
            "type": "array",
            "title": "Location"
          },
          "msg": { "type": "string", "title": "Message" },
          "type": { "type": "string", "title": "Error Type" }
        },
        "type": "object",
        "required": ["loc", "msg", "type"],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "OAuth2PasswordBearer": {
        "type": "oauth2",
        "flows": { "password": { "scopes": {}, "tokenUrl": "/api/admin/token" } }
      }
    }
  }
}
