{
 "openapi": "3.1.0",
 "info": {
  "title": "SAMM API",
  "description": "\nSAMM public REST API — everything the admin portal does, scriptable.\n\n## Authentication\n\nCreate a token in the admin portal (**System → API**, superadmin only) and send it\non every request:\n\n```bash\ncurl -H \"Authorization: Bearer samm_YOUR_TOKEN\" https://your-samm/api/v1/me\n```\n\nThe secret is shown **once** at creation; only its SHA-256 hash is stored. A token\ncarries **scopes** — per-resource grants such as `customers:read` / `customers:write`;\na `write` scope automatically includes the matching `read`. `GET /me` shows the\ncalling token's effective scopes. Revoking a token makes its calls fail immediately.\n\n## Rate limits\n\nEach token has its own per-minute limit (default 120, set at creation). Exceeding it\nreturns `429` with `Retry-After` and `X-RateLimit-Limit` / `X-RateLimit-Remaining`\nheaders — back off and retry.\n\n## Conventions\n\n* List endpoints accept `limit` / `offset` and return `{\"total\": n, \"items\": [...]}`.\n* Errors: `401` missing/invalid/expired/revoked token · `403` token lacks the required\n  scope · `404` not found · `409` duplicate · `422` validation error · `429` rate limit.\n* All timestamps are ISO-8601 UTC; all byte counters are plain integers.\n\n## Queued commands\n\nMutations that touch live accounting state (limit resets, card/group enable/disable,\nvalidity extensions) are **not applied inside the request** — they are queued into the\naudited command queue and applied by the `samm-radius` service within one tick\n(a few seconds), exactly like the same clicks in the admin portal. These endpoints\nreply `{\"queued\": true}`; poll `GET /commands` to watch your token's commands flip\nto `applied`. Everything else (create/update/suspend/renew/pay …) is applied\nimmediately, and any needed router push (CoA) is queued automatically.\n\n## Webhooks\n\nRegister an endpoint (`POST /webhooks` or the admin page) and pick events. Every\ndelivery carries `X-SAMM-Event` and `X-SAMM-Signature: sha256=<hex>` — the HMAC-SHA256\nof the **raw body** with your endpoint's signing secret (returned once at creation):\n\n```python\nimport hmac, hashlib\n\ndef verify(body: bytes, signature_header: str, secret: str) -> bool:\n    calc = \"sha256=\" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()\n    return hmac.compare_digest(calc, signature_header)\n```\n\n`GET /webhooks/events` lists every event name and what it means — read it rather\nthan hard-coding the list, since subscribing to a name that does not exist creates\nan endpoint that simply never fires. Among them, `alert.opened` / `alert.resolved`\ncarry the Alert Center's own transitions (router down, service down, rogue DHCP, a\nnew crash), already deduplicated by the alert engine, so a flapping link sends one\nevent rather than hundreds.\n\nFailed deliveries retry with exponential backoff; an endpoint that keeps failing is\ndisabled automatically (re-enable with `POST /webhooks/{id}/enable`, or trial-run\nwith `POST /webhooks/{id}/test`).\n\n## Two shapes of \"expired\"\n\nA user is expired either because `status` says so, or because their\nexpiration limit is exhausted and they were **parked** on a next plan — still\nauthenticating, against a plan that gives them nothing. `GET /customers?status=expired`\nand `/stats/overview` count both, exactly as the admin panel does. Filtering the\nraw status field yourself will miss the second group, which is the group that has\nalready been cut off.\n\nServer version: **6.0.0**\n",
  "version": "1.0"
 },
 "paths": {
  "/customers": {
   "get": {
    "tags": [
     "customers"
    ],
    "summary": "List users",
    "description": "List users with paging.\n\nFilter by `status`, exact `username`, free-text `search`, `plan_id`,\n`auto_renew`, and the expiry window (`expiring_before` / `expiring_after`).\n\nThe expiry filters and the `expiration_date` field exist because answering\n\"which users renew today\" previously meant listing everyone and then\nfetching each one individually — 675 extra requests against a production\nbox to build one work list. Scope: `customers:read`.",
    "operationId": "list_customers_customers_get",
    "parameters": [
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "active | suspended | expired",
       "title": "Status"
      },
      "description": "active | suspended | expired"
     },
     {
      "name": "search",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "username / name / mobile substring",
       "title": "Search"
      },
      "description": "username / name / mobile substring"
     },
     {
      "name": "username",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "exact username lookup",
       "title": "Username"
      },
      "description": "exact username lookup"
     },
     {
      "name": "auto_renew",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "boolean"
        },
        {
         "type": "null"
        }
       ],
       "description": "only users with auto-renew on/off",
       "title": "Auto Renew"
      },
      "description": "only users with auto-renew on/off"
     },
     {
      "name": "expiring_before",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time — users whose expiry falls before this",
       "title": "Expiring Before"
      },
      "description": "ISO date/time — users whose expiry falls before this"
     },
     {
      "name": "expiring_after",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time — users whose expiry falls after this",
       "title": "Expiring After"
      },
      "description": "ISO date/time — users whose expiry falls after this"
     },
     {
      "name": "plan_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "only users on this plan",
       "title": "Plan Id"
      },
      "description": "only users on this plan"
     },
     {
      "name": "assigned_admin_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "only users assigned to this admin (see GET /admins)",
       "title": "Assigned Admin Id"
      },
      "description": "only users assigned to this admin (see GET /admins)"
     },
     {
      "name": "assigned_admin",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "same, by admin username — case-insensitive, exact",
       "title": "Assigned Admin"
      },
      "description": "same, by admin username — case-insensitive, exact"
     },
     {
      "name": "custom_field",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        {
         "type": "null"
        }
       ],
       "description": "filter by a custom field, `key:value` (repeatable, all must match; value compared case-insensitively; keys are listed on GET /customers/{id})",
       "title": "Custom Field"
      },
      "description": "filter by a custom field, `key:value` (repeatable, all must match; value compared case-insensitively; keys are listed on GET /customers/{id})"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_CustomerListItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Create a user",
    "description": "Create a user on a plan — applied immediately. Generates the initial subscription invoice unless `generate_invoice` is false; optionally pins the account to specific NAS via `allowed_nas_ids` (empty list = any NAS). `assigned_admin_id` puts the user in that admin's branch (a staff admin resolves to its branch; ids from GET /admins); without it the user belongs to General; to move an existing user use PUT /customers/{id}/branch. Scope: `customers:write`.",
    "operationId": "create_customer_customers_post",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CustomerCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}": {
   "get": {
    "tags": [
     "customers"
    ],
    "summary": "Get one user",
    "description": "Fetch one user by id, including their custom field values\n(`custom_fields`; set them with `PUT /customers/{id}/custom-fields`).\nScope: `customers:read`.",
    "operationId": "get_customer_customers__customer_id__get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerWithCustomFields"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "patch": {
    "tags": [
     "customers"
    ],
    "summary": "Update a user",
    "description": "Partially update profile fields, password, status, auto-renew or the NAS allow-list — omit a field to leave it unchanged. Emits a `customer.updated` webhook. Scope: `customers:write`; sending `expiration_date` also needs `customers:renew`.",
    "operationId": "update_customer_customers__customer_id__patch",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CustomerUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "customers"
    ],
    "summary": "Delete a user and all history",
    "description": "Permanently delete the user and all their history (sessions, usage, invoices). Irreversible. Scope: `customers:write`.",
    "operationId": "delete_customer_customers__customer_id__delete",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "204": {
      "description": "Successful Response"
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/custom-fields": {
   "put": {
    "tags": [
     "customers"
    ],
    "summary": "Set a user's custom field values",
    "description": "Validates each value against its field's type (text / number / date /\nlist / bool — samm.custom_field.kind) exactly the way Add/Edit user does\n(app/services/custom_fields.py:clean), then writes samm.\"user\".custom.\nAn unknown key is refused outright and nothing is written. Scope:\n`customers:write`.",
    "operationId": "set_custom_fields_customers__customer_id__custom_fields_put",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CustomFieldsUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerWithCustomFields"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/suspend": {
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Suspend (live sessions are disconnected)",
    "description": "Suspend the account; live sessions are dropped via CoA so access stops immediately. Scope: `customers:write`.",
    "operationId": "suspend_customers__customer_id__suspend_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/activate": {
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Reactivate a suspended user",
    "description": "Reactivate a suspended account. Scope: `customers:write`.",
    "operationId": "activate_customers__customer_id__activate_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/renew": {
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Renew the plan expiration",
    "description": "Extend the expiration by one plan period, restore the original plan if the account was parked on an expired/throttle plan, and drop live sessions so the user re-authenticates with fresh attributes. Creates a renewal invoice when the plan has a price and `generate_invoice` is true (the new invoice id is in the response). Scope: `customers:renew`.",
    "operationId": "renew_customers__customer_id__renew_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "generate_invoice",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": true,
       "title": "Generate Invoice"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerRenewResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/reset-limit": {
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Reset one limit counter (queued, applied within one tick)",
    "description": "Queue a reset of one limit counter — `limitation_type` is quota | daily | uptime | expiration. Applied by samm-radius within one tick; track it via `GET /commands`. Scope: `customers:write`; `expiration` (a renewal) needs `customers:renew`.",
    "operationId": "reset_limit_customers__customer_id__reset_limit_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RenewLimitationRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedResetResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/assign-plan": {
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Change the user's plan",
    "description": "Change the user's plan (optionally generating an invoice). Live sessions receive the new speed via CoA. Scope: `customers:renew`.",
    "operationId": "assign_plan_customers__customer_id__assign_plan_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AssignPlanRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AssignPlanResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/disconnect": {
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Disconnect all live sessions (CoA)",
    "description": "Queue a CoA Disconnect for every live session of this user. Scope: `coa:write`.",
    "operationId": "disconnect_customers__customer_id__disconnect_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CoaQueuedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/usage": {
   "get": {
    "tags": [
     "customers"
    ],
    "summary": "Usage counters + recent sessions",
    "description": "Usage snapshot: today's traffic, non-resettable lifetime totals, the per-limit resettable counters, and the most recent sessions. Scope: `customers:read`.",
    "operationId": "usage_customers__customer_id__usage_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "sessions_limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 200,
       "minimum": 0,
       "default": 20,
       "title": "Sessions Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerUsageResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/timeline": {
   "get": {
    "tags": [
     "customers"
    ],
    "summary": "Everything that happened to this user",
    "description": "The user's timeline: created, renewed, plan changes, suspensions, limit resets and every movement of money, newest first — the same rows the admin page shows, with the same amounts. Scope: `customers:read`.",
    "operationId": "timeline_customers__customer_id__timeline_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "A family (money, plan, sub, limit, user) or an exact kind (money.invoice_paid)",
       "default": "",
       "title": "Kind"
      },
      "description": "A family (money, plan, sub, limit, user) or an exact kind (money.invoice_paid)"
     },
     {
      "name": "money",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "Only events that moved money",
       "default": false,
       "title": "Money"
      },
      "description": "Only events that moved money"
     },
     {
      "name": "since_days",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 3650,
       "minimum": 1,
       "default": 90,
       "title": "Since Days"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/timeline/export.{fmt}": {
   "get": {
    "tags": [
     "customers"
    ],
    "summary": "The user's timeline as a file",
    "description": "The same rows as a CSV or XLSX download, honouring the same filters. Scope: `customers:read`.",
    "operationId": "timeline_export_customers__customer_id__timeline_export__fmt__get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "fmt",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Fmt"
      }
     },
     {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "",
       "title": "Kind"
      }
     },
     {
      "name": "money",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Money"
      }
     },
     {
      "name": "since_days",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 3650,
       "minimum": 1,
       "default": 90,
       "title": "Since Days"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/plans": {
   "get": {
    "tags": [
     "plans"
    ],
    "summary": "List plans",
    "description": "List plans. Scope: `plans:read`.",
    "operationId": "list_plans_plans_get",
    "parameters": [
     {
      "name": "enabled_only",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Enabled Only"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/PlanResponse"
         },
         "title": "Response List Plans Plans Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "plans"
    ],
    "summary": "Create a plan",
    "description": "Create a plan. `download_speed` / `upload_speed` are MikroTik rate strings such as `5M` or `512k`; the duration fields define the expiration period; `next_*_plan_id` fields configure automatic throttle-plan swaps on limit exhaustion. Scope: `plans:write`.",
    "operationId": "create_plan_plans_post",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PlanCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PlanResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/plans/{plan_id}": {
   "get": {
    "tags": [
     "plans"
    ],
    "summary": "Get one plan",
    "description": "Fetch one plan. Scope: `plans:read`.",
    "operationId": "get_plan_plans__plan_id__get",
    "parameters": [
     {
      "name": "plan_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Plan Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PlanResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "patch": {
    "tags": [
     "plans"
    ],
    "summary": "Update a plan",
    "description": "Partial update — omit fields to keep their current values. Set `enabled` to false to retire a plan without deleting it. Scope: `plans:write`.",
    "operationId": "update_plan_plans__plan_id__patch",
    "parameters": [
     {
      "name": "plan_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Plan Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PlanUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PlanResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices": {
   "get": {
    "tags": [
     "billing"
    ],
    "summary": "List invoices",
    "description": "List invoices, filterable by `customer_id` and `status` (paid | unpaid | due). Scope: `billing:read`.",
    "operationId": "list_invoices_invoices_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Customer Id"
      }
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "paid | unpaid | due",
       "title": "Status"
      },
      "description": "paid | unpaid | due"
     },
     {
      "name": "issued_after",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time — invoices issued at or after this",
       "title": "Issued After"
      },
      "description": "ISO date/time — invoices issued at or after this"
     },
     {
      "name": "issued_before",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time — invoices issued before this",
       "title": "Issued Before"
      },
      "description": "ISO date/time — invoices issued before this"
     },
     {
      "name": "description_contains",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "substring of the invoice description, e.g. 'Auto-renewal'",
       "title": "Description Contains"
      },
      "description": "substring of the invoice description, e.g. 'Auto-renewal'"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_InvoiceListItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "billing"
    ],
    "summary": "Create a plan invoice",
    "description": "Create a plan invoice for a user and plan; the amount defaults to the plan price and the entry is posted to the double-entry ledger. Scope: `billing:write`.",
    "operationId": "create_invoice_invoices_post",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InvoiceCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoiceStatusResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}": {
   "get": {
    "tags": [
     "billing"
    ],
    "summary": "Get one invoice (with line items)",
    "description": "Full invoice detail: header, line items, recorded payments and the outstanding balance. Scope: `billing:read`.",
    "operationId": "get_invoice_invoices__invoice_id__get",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoiceDetailResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "billing"
    ],
    "summary": "Delete an invoice, closing it out correctly",
    "description": "Delete an invoice and leave the books consistent. Scope: `billing:write`.\n\nAdded because the API could create, pay and reopen an invoice but never\nremove one — so an operator whose auto-renew sweep raised 675 invoices by\nmistake had no way to undo it programmatically and had to be walked through\nthe panel.\n\nThis is NOT a raw delete. It routes through the accounting service, which:\n  * voids the journal entries when nothing was ever collected,\n  * writes the remainder off to Bad Debt when the invoice was part paid, so\n    the cash and revenue already recognised are preserved,\n  * skips the ledger entirely for an agent's off-ledger retail invoice.\n\nDeleting the row without that leaves the receivable alive and attached to\nnothing — money the company believes it is owed by no one.",
    "operationId": "delete_invoice_invoices__invoice_id__delete",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     },
     {
      "name": "void_payments",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "Also void the invoice's recorded payments: the money leaves the cash box",
       "default": false,
       "title": "Void Payments"
      },
      "description": "Also void the invoice's recorded payments: the money leaves the cash box"
     },
     {
      "name": "take_back_days",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "For a renewal invoice: also take back the time this renewal added to the user's expiry (needs `customers:write`)",
       "default": false,
       "title": "Take Back Days"
      },
      "description": "For a renewal invoice: also take back the time this renewal added to the user's expiry (needs `customers:write`)"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoiceStatusResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}/pdf": {
   "get": {
    "tags": [
     "billing"
    ],
    "summary": "Invoice PDF",
    "description": "Render the invoice as a downloadable PDF — the same renderer the portal and the Telegram bot use. Scope: `billing:read`.",
    "operationId": "invoice_pdf_invoices__invoice_id__pdf_get",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response"
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}/pay": {
   "post": {
    "tags": [
     "billing"
    ],
    "summary": "Mark an invoice paid",
    "description": "Mark the invoice paid now and post the payment to the ledger. Emits an `invoice.paid` webhook on the next worker sweep. Scope: `billing:write`.",
    "operationId": "mark_paid_invoices__invoice_id__pay_post",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoicePaidResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}/unpay": {
   "post": {
    "tags": [
     "billing"
    ],
    "summary": "Reopen a paid invoice",
    "description": "Reopen a paid invoice (reverses the payment posting). Scope: `billing:write`.",
    "operationId": "mark_unpaid_invoices__invoice_id__unpay_post",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoiceStatusResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/sessions": {
   "get": {
    "tags": [
     "sessions"
    ],
    "summary": "List live RADIUS sessions",
    "description": "List live RADIUS sessions (no stop time yet), filterable by `username` or `search` (username part, MAC, IP). Scope: `sessions:read`.",
    "operationId": "list_sessions_sessions_get",
    "parameters": [
     {
      "name": "username",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Username"
      }
     },
     {
      "name": "search",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "part of a username, a MAC (any separator) or the session's IP address",
       "title": "Search"
      },
      "description": "part of a username, a MAC (any separator) or the session's IP address"
     },
     {
      "name": "nas_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Nas Id"
      }
     },
     {
      "name": "throttled",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "boolean"
        },
        {
         "type": "null"
        }
       ],
       "title": "Throttled"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_SessionItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/sessions/disconnect": {
   "post": {
    "tags": [
     "sessions"
    ],
    "summary": "Disconnect a user's sessions (CoA)",
    "description": "Queue CoA Disconnect-Requests for all of the username's live sessions. Confirm delivery in `GET /coa-outbox`. Scope: `coa:write`.",
    "operationId": "disconnect_user_sessions_disconnect_post",
    "parameters": [
     {
      "name": "username",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "Username",
       "title": "Username"
      },
      "description": "Username"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CoaQueuedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/sessions/reconnect": {
   "post": {
    "tags": [
     "sessions"
    ],
    "summary": "Push current plan speed to a user's live sessions (CoA-Update)",
    "description": "Queue a CoA-Update that pushes the user's current plan speed to their live sessions without disconnecting them. Scope: `coa:write`.",
    "operationId": "reconnect_user_sessions_reconnect_post",
    "parameters": [
     {
      "name": "username",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "Username",
       "title": "Username"
      },
      "description": "Username"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CoaQueuedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/coa-outbox": {
   "get": {
    "tags": [
     "sessions"
    ],
    "summary": "Inspect the CoA outbox",
    "description": "Inspect the CoA queue (pending / sent / NACK / done / failed) — useful to confirm a disconnect or speed change actually reached the router. Scope: `sessions:read`.",
    "operationId": "coa_outbox_coa_outbox_get",
    "parameters": [
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "pending | sent | nack | done | failed | obsolete | unconfigured | unreachable",
       "title": "Status"
      },
      "description": "pending | sent | nack | done | failed | obsolete | unconfigured | unreachable"
     },
     {
      "name": "username",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Username"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_CoaOutboxItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/coa-outbox/retry": {
   "post": {
    "tags": [
     "sessions"
    ],
    "summary": "Requeue every failed CoA",
    "description": "Put every failed CoA back on the queue with its attempt counter reset, so\n`samm-radius` sends it again on the next tick.\n\nOnly rows that actually failed (`nack`, `failed`, `unreachable`,\n`unconfigured`) are touched — a delivered CoA is never re-sent. Pass\n`nas_id` after one router comes back rather than retrying the estate.\nScope: `coa:write`.",
    "operationId": "coa_retry_all_coa_outbox_retry_post",
    "parameters": [
     {
      "name": "nas_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "Limit to one router",
       "title": "Nas Id"
      },
      "description": "Limit to one router"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CoaQueuedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/coa-outbox/cancel": {
   "post": {
    "tags": [
     "sessions"
    ],
    "summary": "Cancel every CoA still in flight",
    "description": "Close every CoA still waiting to be delivered, as `obsolete`.\n\nObsolete, not failed: the operator decided these are no longer wanted, and\nthat must not read later as the router having refused them. Use it after a\nchange of plan, or when a backlog would push a stale rate to users\nwhose plan has since moved on. Scope: `coa:write`.",
    "operationId": "coa_cancel_all_coa_outbox_cancel_post",
    "parameters": [
     {
      "name": "nas_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "Limit to one router",
       "title": "Nas Id"
      },
      "description": "Limit to one router"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CoaQueuedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/playbooks": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Ready router playbooks (load balancing, failover, DNS, queues, protection)",
    "description": "Professional router changes SAMM builds itself. Each one keeps an undo on the router and undoes itself if SAMM\nloses the router. Use GET .../scoop-change/preview to see one, POST .../scoop-change to apply it.",
    "operationId": "playbooks_routers_playbooks_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/scoop-change/preview": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Preview a playbook on a router (nothing changes)",
    "operationId": "change_preview_routers__router_id__scoop_change_preview_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "playbook",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Playbook"
      }
     },
     {
      "name": "params",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "{}",
       "title": "Params"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/scoop-change": {
   "post": {
    "tags": [
     "routers"
    ],
    "summary": "Apply a playbook on a router (undo kept on the router)",
    "operationId": "change_apply_routers__router_id__scoop_change_post",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ChangeBody"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/scoop-changes": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "SCOOP changes made on a router (newest first)",
    "operationId": "changes_routers__router_id__scoop_changes_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/scoop-change/{change_id}/undo": {
   "post": {
    "tags": [
     "routers"
    ],
    "summary": "Undo a SCOOP change on a router",
    "operationId": "change_undo_routers__router_id__scoop_change__change_id__undo_post",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "change_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Change Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/network/wireless/aps": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "Wireless access points: SSID, channel, clients, noise",
    "description": "Every radio SAMM sees on the routers it manages. Scope: `routers:read`.",
    "operationId": "wireless_aps_network_wireless_aps_get",
    "parameters": [
     {
      "name": "nas_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Nas Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/network/wireless/stations": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "Wireless clients: signal, rates, which user",
    "description": "Clients connected to SAMM's radios, with the SAMM user they belong to when known. Scope: `routers:read`.",
    "operationId": "wireless_stations_network_wireless_stations_get",
    "parameters": [
     {
      "name": "nas_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Nas Id"
      }
     },
     {
      "name": "weak",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "Only signal below -75 dBm",
       "default": false,
       "title": "Weak"
      },
      "description": "Only signal below -75 dBm"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 2000,
       "minimum": 1,
       "default": 200,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/network/ftth/olts": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "OLTs: model, PON ports, ONUs online",
    "operationId": "ftth_olts_network_ftth_olts_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/network/ftth/onus": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "ONUs: state, optical power, distance, which user",
    "operationId": "ftth_onus_network_ftth_onus_get",
    "parameters": [
     {
      "name": "nas_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Nas Id"
      }
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "e.g. online, offline, los",
       "title": "State"
      },
      "description": "e.g. online, offline, los"
     },
     {
      "name": "weak",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "Only receive power below -27 dBm",
       "default": false,
       "title": "Weak"
      },
      "description": "Only receive power below -27 dBm"
     },
     {
      "name": "user_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "User Id"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 5000,
       "minimum": 1,
       "default": 500,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/reach": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "Networks SAMM reaches behind this router (devices behind)",
    "operationId": "reach_list_routers__router_id__reach_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "network"
    ],
    "summary": "Reach a network behind this router (delivered to the router)",
    "operationId": "reach_add_routers__router_id__reach_post",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ReachIn"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/reach/{reach_id}": {
   "delete": {
    "tags": [
     "network"
    ],
    "summary": "Stop reaching a network behind this router",
    "operationId": "reach_remove_routers__router_id__reach__reach_id__delete",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "reach_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Reach Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/features": {
   "put": {
    "tags": [
     "network"
    ],
    "summary": "Switch a user's parental control and VPN through SAMM",
    "description": "The same switches as the user's edit form. Through SCOOP AI the admin also needs the \"Parental control and VPN\"\naction. Scope: `customers:write`.",
    "operationId": "customer_features_customers__customer_id__features_put",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/FeaturesIn"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/reports/activations": {
   "get": {
    "tags": [
     "reports"
    ],
    "summary": "Activations: renewals, new users and plan changes by plan",
    "description": "The same numbers as Overview -> Activations, with the previous period for comparison. Scope: `customers:read`.",
    "operationId": "activations_reports_activations_get",
    "parameters": [
     {
      "name": "period",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "week | month | year | custom",
       "default": "month",
       "title": "Period"
      },
      "description": "week | month | year | custom"
     },
     {
      "name": "from",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "YYYY-MM-DD, with period=custom",
       "title": "From"
      },
      "description": "YYYY-MM-DD, with period=custom"
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "YYYY-MM-DD, with period=custom",
       "title": "To"
      },
      "description": "YYYY-MM-DD, with period=custom"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/reports/financial": {
   "get": {
    "tags": [
     "reports"
    ],
    "summary": "Financial summary: income, expenses, profit, collections, what is owed",
    "description": "Profit and loss, cash in and out, payments collected per admin, and unpaid invoices by age, for a date range.\nThe same books as Accounting -> Reports. Scope: `accounting:read`.",
    "operationId": "financial_reports_financial_get",
    "parameters": [
     {
      "name": "from",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "YYYY-MM-DD (default: first day of this month)",
       "title": "From"
      },
      "description": "YYYY-MM-DD (default: first day of this month)"
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "YYYY-MM-DD (default: today)",
       "title": "To"
      },
      "description": "YYYY-MM-DD (default: today)"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/statement": {
   "get": {
    "tags": [
     "reports"
    ],
    "summary": "A user's statement: plan, expiry, invoices, balance, wallet",
    "description": "Everything an admin asks about one user, in one call: who they are, plan and expiry, every invoice with what it\nstill owes, the total owed, the prepaid wallet, and the last sessions. Scope: `customers:read` (+ `billing:read`\nfor the money part).",
    "operationId": "statement_customers__customer_id__statement_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/retention/lookup": {
   "post": {
    "tags": [
     "reports"
    ],
    "summary": "Data retention: who had this address (and port) at that time",
    "description": "The same lookup as Overview -> Data Log -> Data retention: CGNAT mapping, then the session that held the address.\nEvery lookup is written to the append-only lookup log, with the reference and who asked. Scope: `retention:lookup`.",
    "operationId": "retention_lookup_retention_lookup_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/_LookupBody"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/scoop/schedules": {
   "get": {
    "tags": [
     "scoop"
    ],
    "summary": "SCOOP AI: my scheduled missions and reports",
    "operationId": "schedules_scoop_schedules_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "scoop"
    ],
    "summary": "SCOOP AI: schedule a mission or a report (runs as you, never approves anything)",
    "operationId": "schedule_create_scoop_schedules_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ScheduleIn"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/scoop/schedules/{schedule_id}": {
   "delete": {
    "tags": [
     "scoop"
    ],
    "summary": "SCOOP AI: stop a schedule",
    "operationId": "schedule_delete_scoop_schedules__schedule_id__delete",
    "parameters": [
     {
      "name": "schedule_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Schedule Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "List NAS + monitor-only routers",
    "description": "Inventory of RADIUS NAS and monitor-only MikroTiks, with reachability (last ping) and the identity/model/RouterOS metadata synced by samm-worker. Scope: `routers:read`.",
    "operationId": "list_routers_routers_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_RouterItem_"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "One router, with its health and its uplinks",
    "description": "One router in full: the inventory row, its current health state and\nopen-finding count, and every interface SAMM has classified — which one is\nthe internet, what decided that, and whether an operator pinned it by hand.\n\n\"Which interface is the internet on\" used to be answered three different\nways in three different places and stored nowhere. It is one answer now,\nand this is where an integration reads it. Scope: `routers:read`.",
    "operationId": "get_router_routers__router_id__get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/RouterDetail"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/traffic": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Interface throughput history for one router",
    "description": "Interface throughput over a window, in bits per second — the same series the dashboard draws.\n\n`win` is minutes and snaps to one of 10/30/60/180. `iface` limits it to a\nsingle interface name; omitted, every interface on the router is summed.\n\nThe number of points is derived from how often this install actually polls,\nnever finer, so a bucket always contains at least one real sample. Ask for\n10 minutes on a router polled every 30s and you get 20 points, not 40 with\nevery other one empty. Scope: `routers:read`.",
    "operationId": "router_traffic_routers__router_id__traffic_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "win",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "default": 60,
       "title": "Win"
      }
     },
     {
      "name": "iface",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "",
       "title": "Iface"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/ros": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Read any RouterOS menu on a router (secrets masked)",
    "description": "Everything `print` shows for that menu, as JSON, with passwords and keys\nmasked. Filters compare values exactly (yes/true and no/false are the same).\nScope: `routers:diagnose`.",
    "operationId": "ros_read_routers__router_id__ros_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "path",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "RouterOS menu, e.g. ppp/secret, ip/pool, interface, ip/route",
       "title": "Path"
      },
      "description": "RouterOS menu, e.g. ppp/secret, ip/pool, interface, ip/route"
     },
     {
      "name": "where",
      "in": "query",
      "required": false,
      "schema": {
       "type": "array",
       "items": {
        "type": "string"
       },
       "description": "Exact-match filters, key=value (repeatable)",
       "default": [],
       "title": "Where"
      },
      "description": "Exact-match filters, key=value (repeatable)"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 5000,
       "minimum": 1,
       "default": 500,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "routers"
    ],
    "summary": "Change a router: add / set / remove / enable / disable",
    "description": "One change on an allow-listed menu (see the module docs). The item is\nread before and after; both go to the Admin Log with `reason`, masked.\nExactly one item is changed: a `match` that fits several is refused.\nScope: `routers:write`.",
    "operationId": "ros_act_routers__router_id__ros_post",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RosAction"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/log": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "The router's own log (newest last)",
    "description": "The router's in-memory log, filtered here. Scope: `routers:diagnose`.",
    "operationId": "ros_log_routers__router_id__log_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "grep",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "Case-insensitive text the line must contain",
       "default": "",
       "title": "Grep"
      },
      "description": "Case-insensitive text the line must contain"
     },
     {
      "name": "topics",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "Only lines whose topics contain this (e.g. pppoe, radius)",
       "default": "",
       "title": "Topics"
      },
      "description": "Only lines whose topics contain this (e.g. pppoe, radius)"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 200,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/ppp/{username}": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Investigate one PPPoE user on a router",
    "description": "One call for \"connects but no internet\" / \"cannot connect\": the router's\nPPP AAA settings, any LOCAL secret with this name (which the router answers\nitself, without asking SAMM), the live session and the address it got, the\nprofile it uses, that profile's pool, the NAT rules, and the log lines\nmentioning the user. `findings` states what looks wrong in plain words.\nScope: `routers:diagnose`.",
    "operationId": "ppp_investigate_routers__router_id__ppp__username__get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "username",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Username"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/wireless/by-user/{customer_id}": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "A user's radio as the access points see it",
    "description": "Signal (dBm and a quality word), SNR, Tx/Rx rate, CCQ and uptime of this\nuser's radio, read live from every MikroTik SAMM logs in to. Scope:\n`routers:diagnose`.",
    "operationId": "wireless_for_user_routers_wireless_by_user__customer_id__get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/test": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Ping, traceroute or DNS lookup FROM the router",
    "description": "The same tools as the panel's Network Tools, run on the router itself:\n\"does this NAS reach the internet / SAMM / the upstream?\". Scope:\n`routers:diagnose`.",
    "operationId": "ros_test_routers__router_id__test_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     },
     {
      "name": "tool",
      "in": "query",
      "required": true,
      "schema": {
       "enum": [
        "ping",
        "traceroute",
        "dns"
       ],
       "type": "string",
       "title": "Tool"
      }
     },
     {
      "name": "target",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "Address or host name, e.g. 8.8.8.8 or google.com",
       "title": "Target"
      },
      "description": "Address or host name, e.g. 8.8.8.8 or google.com"
     },
     {
      "name": "count",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 20,
       "minimum": 1,
       "default": 4,
       "title": "Count"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/radius": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "The router's RADIUS clients and their live counters",
    "description": "Each /radius entry with `/radius monitor` counters (requests, accepts,\nrejects, timeouts, bad replies) and /radius incoming. Rising timeouts mean\nthe router cannot reach SAMM; rising bad replies mean a secret mismatch.\nScope: `routers:diagnose`.",
    "operationId": "ros_radius_routers__router_id__radius_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/script": {
   "post": {
    "tags": [
     "routers"
    ],
    "summary": "Run a RouterOS script on a router and return its output",
    "description": "Runs the script on the router (`:execute ... as-string`) and returns what\nit printed. For anything the menus cannot express: PCC load balancing,\nmangle, routing tables, several changes at once. A script that names\nSAMM's link to the router (/user, /ip service, /radius, reset-configuration,\nSAMM-AUTOSEC rules) is refused. Output is capped by RouterOS; keep long jobs\nshort or split them. Scope: `routers:write`.",
    "operationId": "ros_script_routers__router_id__script_post",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RosScript"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/probe": {
   "post": {
    "tags": [
     "routers"
    ],
    "summary": "Probe a Ubiquiti device over SSH (read-only)",
    "description": "Runs a FIXED list of read-only commands on a Ubiquiti device (airOS: `mca-status`, `wstalist`,\n`iwconfig`, version, board, config; UniFi: `mca-dump`, `info`, …) and returns what each answered, secrets\nmasked. Nothing on the device changes. The first probe pins the device's SSH host key; a different key later\nis refused before the password is sent. `survey: true` adds the site survey, which takes the radio off air,\nruns under the install-wide one-radio-at-a-time lock and needs `routers:write`.\nScope: `routers:diagnose`.",
    "operationId": "device_probe_routers__router_id__probe_post",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ProbeBody"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/{router_id}/probes": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Earlier probes of a Ubiquiti device (newest first)",
    "description": "The newest probes kept for this device (10), each with every command's output. Scope: `routers:diagnose`.",
    "operationId": "device_probes_routers__router_id__probes_get",
    "parameters": [
     {
      "name": "router_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Router Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/network/health": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "The health board: every router, worst first",
    "description": "Every router SAMM watches, with its health state, score, open-finding\ncounts and the single worst reason — ordered worst first, exactly as the\nNetwork Health board orders it.\n\n`state` is the summary an alerting rule wants: `down` is unreachable,\n`fault` is answering but broken (a critical finding on a live router),\n`warn` is degraded, `ok` is clean, and null means it has not been checked\nyet. Scope: `routers:read`.",
    "operationId": "network_health_network_health_get",
    "parameters": [
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "Only routers in this state: down | fault | warn | ok",
       "title": "State"
      },
      "description": "Only routers in this state: down | fault | warn | ok"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_NetHealthItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/network/findings": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "Open findings across the estate",
    "description": "What is actually wrong, one row per problem, newest-worst first.\n\nA finding keeps its `finding_key` for as long as the problem persists, so a\nticket raised against one can be closed when it stops coming back rather\nthan re-raised on every poll. `status=resolved` shows what cleared and\nwhen. Scope: `routers:read`.",
    "operationId": "network_findings_network_findings_get",
    "parameters": [
     {
      "name": "nas_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "Limit to one router",
       "title": "Nas Id"
      },
      "description": "Limit to one router"
     },
     {
      "name": "severity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "critical | important | minor",
       "title": "Severity"
      },
      "description": "critical | important | minor"
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "open | resolved | any",
       "default": "open",
       "title": "Status"
      },
      "description": "open | resolved | any"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 200,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_NetFindingItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/network/topology": {
   "get": {
    "tags": [
     "network"
    ],
    "summary": "Nodes and links, as discovered",
    "description": "The map as data: every device SAMM has seen and every link between them.\n\nA node with a null `nas_id` is a device discovered on the network that SAMM\ndoes not manage — a user's own switch, an unregistered MikroTik, a\nthird-party box that answers neighbour discovery. Those are the interesting\nones: they are how an unauthorised device gets noticed.\n\nEdges are stored once per link, not once per direction, even though both\nends usually report each other; `a_node_id` / `b_node_id` are ordered\ncanonically, so a link is stable to compare between polls. Scope:\n`routers:read`.",
    "operationId": "network_topology_network_topology_get",
    "parameters": [
     {
      "name": "include_hidden",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "Include nodes an operator hid on the map",
       "default": false,
       "title": "Include Hidden"
      },
      "description": "Include nodes an operator hid on the map"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/NetTopologyResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/audit": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Search the audit trail",
    "description": "Search the audit trail. Scope: `logs:read`.\n\nEvery filter is optional and they AND together, so \"everything that touched\nuser 412 this week\" is one call:\n\n    /api/v1/audit?entity_type=user&entity_id=412&since=2026-08-01\n\n`before`/`after` hold the changed fields and are omitted unless\n`include_payload=true`, because they dominate the response and support\nusually wants the shape of what happened first, then one row in detail.",
    "operationId": "list_audit_audit_get",
    "parameters": [
     {
      "name": "entity_type",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "e.g. user, invoice, plan, role",
       "title": "Entity Type"
      },
      "description": "e.g. user, invoice, plan, role"
     },
     {
      "name": "entity_id",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "id of that entity",
       "title": "Entity Id"
      },
      "description": "id of that entity"
     },
     {
      "name": "actor",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "admin username, or api:<token name>",
       "title": "Actor"
      },
      "description": "admin username, or api:<token name>"
     },
     {
      "name": "action",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "substring, e.g. 'delete' or 'user.update'",
       "title": "Action"
      },
      "description": "substring, e.g. 'delete' or 'user.update'"
     },
     {
      "name": "category",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "user | financials | network | plan | admin | ...",
       "title": "Category"
      },
      "description": "user | financials | network | plan | admin | ..."
     },
     {
      "name": "severity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "info | warning | critical",
       "title": "Severity"
      },
      "description": "info | warning | critical"
     },
     {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time, inclusive",
       "title": "Since"
      },
      "description": "ISO date/time, inclusive"
     },
     {
      "name": "until",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time, exclusive",
       "title": "Until"
      },
      "description": "ISO date/time, exclusive"
     },
     {
      "name": "include_payload",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "include before/after and payload (verbose)",
       "default": false,
       "title": "Include Payload"
      },
      "description": "include before/after and payload (verbose)"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/audit/actors": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Who has been acting on this install",
    "description": "Distinct actors with a count and their last action. Scope: `logs:read`.\n\nAnswers \"who is touching this system\" in one call — including API tokens,\nwhich appear as `api:<token name>`.",
    "operationId": "audit_actors_audit_actors_get",
    "parameters": [
     {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time, inclusive",
       "title": "Since"
      },
      "description": "ISO date/time, inclusive"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/auth-log": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "RADIUS authentication attempts, including rejections",
    "description": "Every authentication attempt and its verdict. Scope: `logs:read`.\n\n`radacct` only records sessions that were ACCEPTED, so a user being\nturned away leaves no trace there — they simply stop appearing. This reads\n`radius.radpostauth`, which records the reply either way, so\n\"are they being rejected, or not even trying?\" is answerable.",
    "operationId": "auth_log_auth_log_get",
    "parameters": [
     {
      "name": "username",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "exact username",
       "title": "Username"
      },
      "description": "exact username"
     },
     {
      "name": "only_failures",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "just the rejections",
       "default": false,
       "title": "Only Failures"
      },
      "description": "just the rejections"
     },
     {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time, inclusive",
       "title": "Since"
      },
      "description": "ISO date/time, inclusive"
     },
     {
      "name": "until",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time, exclusive",
       "title": "Until"
      },
      "description": "ISO date/time, exclusive"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/why-blocked": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Can this user authenticate, and if not, why",
    "description": "One call that answers the support question. Scope: `customers:read`.\n\nChecks, in the order that actually decides the outcome:\n\n  * the subscriber exists and is not suspended\n  * the expiry the PANEL shows (COALESCE(override, limit state))\n  * the expiry the ENFORCEMENT ENGINE reads (limit state alone)\n  * whether those two disagree — the failure that took a village offline:\n    the screen said \"active, 2 days left\" while the sweep re-expired them\n    every cycle and RADIUS refused every reconnect\n  * any exhausted limit\n  * the most recent authentication verdict\n\n`blocked` is the verdict; `reasons` says why in plain words.",
    "operationId": "why_blocked_customers__customer_id__why_blocked_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/bulk": {
   "post": {
    "tags": [
     "customers"
    ],
    "summary": "Set expiry and/or status on many users",
    "description": "Apply one change to many users. Scope: `customers:write`; setting\n`expiration_date` also needs `customers:renew`.\n\nReturns a result per user — `ok`, `skipped` with a reason, or\n`error` — because a bulk call that answers only \"437 done\" is unusable when\nthe question is \"which ones did not, and why\".\n\nSetting `expiration_date` writes BOTH the admin override and the limit\nstate the expiration sweep reads. Writing only one is what let a screen\nshow \"active\" while RADIUS refused every reconnect.",
    "operationId": "bulk_update_customers_bulk_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/BulkRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/groups": {
   "get": {
    "tags": [
     "cards"
    ],
    "summary": "List card groups",
    "description": "List card groups with per-status card counts. Scope: `cards:read`.",
    "operationId": "list_groups_cards_groups_get",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_CardGroupListItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Create a card group and generate its cards",
    "description": "Create a voucher group and generate `count` cards in it. The group defines the speed and optional quota / uptime / expiration limits shared by all of its cards; username/password recipes control how card credentials are generated. Returns 403 when the licensed card cap would be exceeded. Scope: `cards:write`.",
    "operationId": "create_group_cards_groups_post",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CardGroupCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CardsCreatedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/groups/{group_id}/cards": {
   "get": {
    "tags": [
     "cards"
    ],
    "summary": "List a group's cards",
    "description": "List a group's cards (username, password, status), filterable by `status` (unused | active | exhausted | disabled). Scope: `cards:read`.",
    "operationId": "list_cards_cards_groups__group_id__cards_get",
    "parameters": [
     {
      "name": "group_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Group Id"
      }
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "unused | active | exhausted | disabled",
       "title": "Status"
      },
      "description": "unused | active | exhausted | disabled"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 5000,
       "minimum": 1,
       "default": 500,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_CardItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Add cards to an existing group",
    "description": "Generate `count` additional cards using the group's existing username/password recipe. Scope: `cards:write`.",
    "operationId": "add_cards_cards_groups__group_id__cards_post",
    "parameters": [
     {
      "name": "group_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Group Id"
      }
     },
     {
      "name": "count",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer",
       "maximum": 10000,
       "minimum": 1,
       "title": "Count"
      }
     }
    ],
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CardsCreatedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/groups/{group_id}": {
   "get": {
    "tags": [
     "cards"
    ],
    "summary": "Get one card group",
    "description": "Group configuration plus card counts by status. Scope: `cards:read`.",
    "operationId": "get_group_cards_groups__group_id__get",
    "parameters": [
     {
      "name": "group_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Group Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CardGroupDetailResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/groups/{group_id}/enable": {
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Enable a group (queued, applied within one tick)",
    "description": "Queue enabling of the whole group (applied by samm-radius within one tick; track via `GET /commands`). Scope: `cards:write`.",
    "operationId": "enable_group_cards_groups__group_id__enable_post",
    "parameters": [
     {
      "name": "group_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Group Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedActionResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/groups/{group_id}/disable": {
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Disable a group and drop its live sessions (queued)",
    "description": "Queue disabling of the whole group; live card sessions are dropped when it applies. Scope: `cards:write`.",
    "operationId": "disable_group_cards_groups__group_id__disable_post",
    "parameters": [
     {
      "name": "group_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Group Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedActionResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/groups/{group_id}/extend": {
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Extend the group's validity date (queued)",
    "description": "Queue a new `valid_until` date for the group — must be later than the current one. Scope: `cards:write`.",
    "operationId": "extend_group_cards_groups__group_id__extend_post",
    "parameters": [
     {
      "name": "group_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Group Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/GroupExtend"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedExtendResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/groups/{group_id}/print.pdf": {
   "get": {
    "tags": [
     "cards"
    ],
    "summary": "Voucher cards PDF",
    "description": "Printable voucher sheet (PDF) for the group, with the ISP name/logo from Settings; pass `only_unused=true` to print unsold cards only. Scope: `cards:read`.",
    "operationId": "group_print_pdf_cards_groups__group_id__print_pdf_get",
    "parameters": [
     {
      "name": "group_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Group Id"
      }
     },
     {
      "name": "only_unused",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Only Unused"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response"
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/{card_id}": {
   "get": {
    "tags": [
     "cards"
    ],
    "summary": "Get one card (with usage counters)",
    "description": "One card with its per-limit counters and lifetime usage totals. Scope: `cards:read`.",
    "operationId": "get_card_cards__card_id__get",
    "parameters": [
     {
      "name": "card_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Card Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CardDetailResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/{card_id}/enable": {
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Enable a card (queued, applied within one tick)",
    "description": "Queue re-enabling of a single card. Scope: `cards:write`.",
    "operationId": "enable_card_cards__card_id__enable_post",
    "parameters": [
     {
      "name": "card_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Card Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedCardActionResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/{card_id}/disable": {
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Disable a card and drop its live session (queued)",
    "description": "Queue disabling of a single card; its live session is dropped when it applies. Scope: `cards:write`.",
    "operationId": "disable_card_cards__card_id__disable_post",
    "parameters": [
     {
      "name": "card_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Card Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedCardActionResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cards/{card_id}/reset/{kind}": {
   "post": {
    "tags": [
     "cards"
    ],
    "summary": "Reset one card limit counter (queued)",
    "description": "Queue a reset of one card limit counter — `kind` is quota | uptime | expiration. Scope: `cards:write`.",
    "operationId": "reset_card_cards__card_id__reset__kind__post",
    "parameters": [
     {
      "name": "card_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Card Id"
      }
     },
     {
      "name": "kind",
      "in": "path",
      "required": true,
      "schema": {
       "enum": [
        "quota",
        "uptime",
        "expiration"
       ],
       "type": "string",
       "title": "Kind"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedCardActionResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/self-service/handouts": {
   "get": {
    "tags": [
     "self-service"
    ],
    "summary": "List guest passcodes that were handed out",
    "description": "The guest register, newest first: who signed themselves up, the passcode\nthey were given, how it was sent and whether it arrived. Scope: `guests:read`.\n\nSeveral jurisdictions require an ISP to be able to say who used a guest\nnetwork — this is that record, and rows are kept until an admin deletes one.\n\n`contact` matches the way the one-live-code rule does: on the CANONICAL\ncontact, so a mobile must be given in E.164 (`+961…`). Names are not\nsearchable here — people share names, and contact alone is the identity the\nfeature keys on.",
    "operationId": "list_handouts_self_service_handouts_get",
    "parameters": [
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "enum": [
          "issued",
          "sent",
          "failed",
          "void"
         ],
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "Delivery state of the handout itself",
       "title": "Status"
      },
      "description": "Delivery state of the handout itself"
     },
     {
      "name": "valid_now",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "boolean"
        },
        {
         "type": "null"
        }
       ],
       "description": "true = passcode still usable; false = expired or voided",
       "title": "Valid Now"
      },
      "description": "true = passcode still usable; false = expired or voided"
     },
     {
      "name": "contact",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "Exact mobile (E.164, e.g. +96181507933) or email, case-insensitive",
       "title": "Contact"
      },
      "description": "Exact mobile (E.164, e.g. +96181507933) or email, case-insensitive"
     },
     {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time, inclusive (issued_at)",
       "title": "Since"
      },
      "description": "ISO date/time, inclusive (issued_at)"
     },
     {
      "name": "until",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "ISO date/time, exclusive (issued_at)",
       "title": "Until"
      },
      "description": "ISO date/time, exclusive (issued_at)"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 100,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_GuestHandoutItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/self-service/summary": {
   "get": {
    "tags": [
     "self-service"
    ],
    "summary": "Self Service license position and register counters",
    "description": "Where this install stands on Self Service: the master switch, the\nlicensed passcodes-per-day and how much of today is spent, the add-on tier\nwith its own expiry, and the register's counters. Scope: `guests:read`.\n\n`allowance` and `remaining` are **null** when the rate is unlimited\n(Self Service Max) — the -1 sentinel samm.settings uses never leaves SAMM.\n\nRead from the SQL side (`samm.guest_daily_allowance()` and the same two-term\ncount) rather than from the license token, exactly as the admin Self Service\npage is: the number a guest actually meets is the one the RADIUS gate\ncomputes, and a second opinion here could disagree with the refusal on their\nscreen. `used` therefore counts billable handouts since the install's own day\nstarted PLUS registrations still in flight — a slot is claimed when it is\npromised, not when the passcode is minted.",
    "operationId": "summary_self_service_summary_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SelfServiceSummaryResponse"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks": {
   "get": {
    "tags": [
     "webhooks"
    ],
    "summary": "List webhook endpoints",
    "description": "List endpoints including delivery health: consecutive fail streak, last successful delivery and last error. Scope: `webhooks:manage`.",
    "operationId": "list_webhooks_webhooks_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_WebhookEndpointItem_"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "webhooks"
    ],
    "summary": "Register a webhook endpoint",
    "description": "Register an endpoint. The HMAC signing secret is returned ONCE in this response — store it; deliveries are signed with it (`X-SAMM-Signature`). Unknown event names are ignored; at least one valid event is required. Scope: `webhooks:manage`.",
    "operationId": "create_webhook_webhooks_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WebhookCreate"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookCreatedResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks/events": {
   "get": {
    "tags": [
     "webhooks"
    ],
    "summary": "Every event an endpoint can subscribe to",
    "description": "The event catalogue, with what each one means.\n\nSubscribing to a name that does not exist is silently useless — the endpoint\nis created and simply never fires — so a client that builds its own\nsubscription list needs to read the catalogue rather than guess it. The\nnames here are the only values `POST /webhooks` accepts.",
    "operationId": "list_events_webhooks_events_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/webhooks/{endpoint_id}": {
   "delete": {
    "tags": [
     "webhooks"
    ],
    "summary": "Delete a webhook endpoint",
    "description": "Delete the endpoint and its queued deliveries. Scope: `webhooks:manage`.",
    "operationId": "delete_webhook_webhooks__endpoint_id__delete",
    "parameters": [
     {
      "name": "endpoint_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Endpoint Id"
      }
     }
    ],
    "responses": {
     "204": {
      "description": "Successful Response"
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "patch": {
    "tags": [
     "webhooks"
    ],
    "summary": "Change an endpoint's URL, events or description",
    "description": "Only the fields sent are changed; the secret is kept. Scope: `webhooks:manage`.",
    "operationId": "update_webhook_webhooks__endpoint_id__patch",
    "parameters": [
     {
      "name": "endpoint_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Endpoint Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WebhookUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks/{endpoint_id}/enable": {
   "post": {
    "tags": [
     "webhooks"
    ],
    "summary": "Enable a webhook endpoint",
    "description": "Re-enable a disabled endpoint and reset its fail streak. Scope: `webhooks:manage`.",
    "operationId": "enable_webhook_webhooks__endpoint_id__enable_post",
    "parameters": [
     {
      "name": "endpoint_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Endpoint Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookToggleResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks/{endpoint_id}/disable": {
   "post": {
    "tags": [
     "webhooks"
    ],
    "summary": "Disable a webhook endpoint",
    "description": "Stop deliveries to this endpoint (kept configured, reversible). Scope: `webhooks:manage`.",
    "operationId": "disable_webhook_webhooks__endpoint_id__disable_post",
    "parameters": [
     {
      "name": "endpoint_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Endpoint Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookToggleResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks/{endpoint_id}/test": {
   "post": {
    "tags": [
     "webhooks"
    ],
    "summary": "Queue a test event to this endpoint",
    "description": "Queue a `webhook.test` event, delivered on the next samm-worker tick — verify your receiver and signature check end-to-end. Scope: `webhooks:manage`.",
    "operationId": "test_webhook_webhooks__endpoint_id__test_post",
    "parameters": [
     {
      "name": "endpoint_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Endpoint Id"
      }
     }
    ],
    "responses": {
     "202": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/QueuedNoteResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks/{endpoint_id}/roll-secret": {
   "post": {
    "tags": [
     "webhooks"
    ],
    "summary": "Replace the signing secret",
    "description": "A new secret, returned ONCE; deliveries from now on are signed with it. Scope: `webhooks:manage`.",
    "operationId": "roll_secret_webhooks__endpoint_id__roll_secret_post",
    "parameters": [
     {
      "name": "endpoint_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Endpoint Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks/{endpoint_id}/deliveries": {
   "get": {
    "tags": [
     "webhooks"
    ],
    "summary": "Recent deliveries of one endpoint",
    "description": "Newest first (max 500): event, event id, status (pending / sending / sent / failed), tries,\nthe receiver's HTTP code and time, last error. Scope: `webhooks:manage`.",
    "operationId": "deliveries_webhooks__endpoint_id__deliveries_get",
    "parameters": [
     {
      "name": "endpoint_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Endpoint Id"
      }
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Status"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "default": 100,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/webhooks/deliveries/{delivery_id}/resend": {
   "post": {
    "tags": [
     "webhooks"
    ],
    "summary": "Send one delivery again",
    "description": "Queues it again as it was (same event id). Only a sent or failed delivery. Scope: `webhooks:manage`.",
    "operationId": "resend_webhooks_deliveries__delivery_id__resend_post",
    "parameters": [
     {
      "name": "delivery_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Delivery Id"
      }
     }
    ],
    "responses": {
     "202": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/accounting/export": {
   "get": {
    "tags": [
     "accounting"
    ],
    "summary": "List available accounting exports",
    "description": "The export `kind`s available at `/accounting/export/{kind}`. Scope: `accounting:read`.",
    "operationId": "list_exports_accounting_export_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ExportKindsResponse"
        }
       }
      }
     }
    }
   }
  },
  "/accounting/export/{kind}": {
   "get": {
    "tags": [
     "accounting"
    ],
    "summary": "Export the books (JSON or CSV)",
    "description": "Export one set of books. `kind` ∈ journal, chart_of_accounts, invoices,\ntrial_balance, pnl, balance_sheet. `format=csv` streams a download; default\nJSON returns `{kind, columns, rows}`. Voided journal entries are excluded, so\nan export always reconciles with the admin reports. Scope: `accounting:read`.",
    "operationId": "export_accounting_export__kind__get",
    "parameters": [
     {
      "name": "kind",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Kind"
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "json | csv",
       "default": "json",
       "title": "Format"
      },
      "description": "json | csv"
     },
     {
      "name": "date_from",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "YYYY-MM-DD (period exports; default current month)",
       "title": "Date From"
      },
      "description": "YYYY-MM-DD (period exports; default current month)"
     },
     {
      "name": "date_to",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "YYYY-MM-DD",
       "title": "Date To"
      },
      "description": "YYYY-MM-DD"
     },
     {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "YYYY-MM-DD for point-in-time exports (trial_balance, balance_sheet, chart_of_accounts)",
       "title": "As Of"
      },
      "description": "YYYY-MM-DD for point-in-time exports (trial_balance, balance_sheet, chart_of_accounts)"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AccountingExportResponse"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/diagnostics": {
   "get": {
    "tags": [
     "diagnostics"
    ],
    "summary": "Full health + collection snapshot for support",
    "description": "One-shot health snapshot: service liveness, data-collection freshness, per-router sync ages, recent self-heal events and license state. Scope: `diagnostics:read`.",
    "operationId": "diagnostics_diagnostics_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/errors": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Incidents captured on this install",
    "description": "Incidents from samm.error_report, newest first — deduplicated by\nfingerprint with an occurrence count, so a crash loop is ONE row saying\n\"×4,000\" rather than four thousand rows. The traceback is omitted here (it is\nlong and this is the triage list); fetch one incident for it.\n\n`reported` tells you whether the operator already flagged it for upload, and\n`sent` whether it reached SecuryTik — useful when a user says \"I sent\nyou the error\" and nothing arrived. Scope: `errors:read`.",
    "operationId": "errors_support_errors_get",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 200,
       "minimum": 1,
       "default": 50,
       "title": "Limit"
      }
     },
     {
      "name": "since_hours",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 8760,
       "minimum": 1,
       "default": 168,
       "title": "Since Hours"
      }
     },
     {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "Filter by kind, e.g. 'http_500'",
       "title": "Kind"
      },
      "description": "Filter by kind, e.g. 'http_500'"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/support/alerts": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Admin alerts raised on this install",
    "description": "The Alert Center's own view, read-only, from off the box.\n\n/diagnostics answers \"is the machine healthy\"; this answers the question\nthat follows it — \"and has the install been TELLING anyone it isn't\". They\nare not the same: an alert can be open for two days with a healthy snapshot\nright now, and a bell nobody has clicked is the most common reason a\nuser says nothing warned them.\n\nDefault is everything unresolved (pending + open + acknowledged), newest\nfirst, because that is the triage question. Pass `status=resolved` for what\ncleared. Rides `diagnostics:read`: subjects name a router or a service, not\na user, so this is health data — nothing here needs the separate\nconsent that tracebacks and daemon logs do.",
    "operationId": "alerts_support_alerts_get",
    "parameters": [
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "pending | open | acknowledged | resolved. Omit for everything still live.",
       "title": "Status"
      },
      "description": "pending | open | acknowledged | resolved. Omit for everything still live."
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 200,
       "minimum": 1,
       "default": 50,
       "title": "Limit"
      }
     },
     {
      "name": "since_hours",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 8760,
       "minimum": 1,
       "default": 168,
       "title": "Since Hours"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/support/errors/{incident}": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "One incident, with its traceback",
    "description": "One incident by numeric id, incident_id or fingerprint — whichever the\nuser quoted. Includes the full traceback and captured context, both\ntext-masked. Scope: `errors:read`.",
    "operationId": "error_detail_support_errors__incident__get",
    "parameters": [
     {
      "name": "incident",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Incident"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/support/settings": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Live tunables (redacted)",
    "description": "The live samm.settings tunables that explain most misbehaviour, plus the\nschema level. An allow-list — credentials and gateway keys are never in it,\nand any value whose key still looks like a secret is masked anyway.\n\n`schema_version` is the highest applied migration, which is the first thing\nto check when an install behaves like an older release. Scope:\n`diagnostics:read`.",
    "operationId": "settings_support_settings_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "put": {
    "tags": [
     "support"
    ],
    "summary": "Change a safe, allow-listed set of live tunables",
    "description": "Every key must be in the allow-list below — anything else (including\nevery `licence_*` / `update_*` / `backup_*` / `history_*` key) is\nrefused, not silently ignored, so a caller learns immediately that a key\nneeds a different endpoint or is not exposed at all. Scope:\n`settings:write`.",
    "operationId": "update_settings_support_settings_put",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "title": "Body"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/support/self-test": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Actively probe the moving parts",
    "description": "Runs the checks a support engineer would run by hand and returns a\npass/fail per check with a one-line reason.\n\nUnlike /diagnostics — which reports what the install has RECORDED — these\nprobe the current state: the database answers, the daemons have beaten\nrecently, every router has been reached, the disk has room, and the AAA\ntables are reachable. `ok` is the summary: false means at least one check\nfailed. Scope: `diagnostics:read`.",
    "operationId": "self_test_support_self_test_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/probe": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Can this install reach what SAMM depends on?",
    "description": "Reachability of every service SAMM talks to, from the install's network.\n\nRead-only, and deliberately not a URL fetcher: the targets are the fixed\nlist above. `ok` means the host ANSWERED — an HTTP 403/405 to a HEAD still\nproves the path is open, so read `status` for what it said and `error` for\nwhy nothing came back. `blocked` is the short answer.\n\nAll targets are probed in parallel behind one deadline, because the whole\npoint is that a blocked host does not fail fast: a DNS-black-holed name\nstalls per resolved address, so probing seven of them in sequence could\noutlast the request itself. Scope: `diagnostics:read`.",
    "operationId": "probe_support_probe_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/logs": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Capped, redacted tail of a SAMM unit or log file",
    "description": "A bounded tail of one SAMM unit, newest last, with secret shapes masked.\n\nDeliberately narrow: a fixed unit allow-list, at most 1000 lines, at most a\nday back. Daemon output can quote usernames and addresses, which is why this\nhas its own scope instead of riding on `diagnostics:read` — a user grants\nlog access as a separate, conscious decision. Scope: `logs:read`.\n\n`file=radius.log` reads FreeRADIUS's own log instead of the journal, and it\nis not a convenience. FreeRADIUS logs to `${logdir}/radius.log`, so its\nstartup failures never reach journald: the journal shows only the\n`ExecStartPre` config check saying \"Configuration appears to be OK\" followed\nby a bare `status=1/FAILURE`. Two user outages were diagnosable ONLY\nfrom this file, and reaching it meant asking the operator for shell access.\nReach for it whenever freeradius will not start.",
    "operationId": "logs_support_logs_get",
    "parameters": [
     {
      "name": "unit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "One of the SAMM units",
       "default": "samm-api",
       "title": "Unit"
      },
      "description": "One of the SAMM units"
     },
     {
      "name": "file",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "Read a FILE log instead of the journal: one of radius.log, samm-install.log",
       "title": "File"
      },
      "description": "Read a FILE log instead of the journal: one of radius.log, samm-install.log"
     },
     {
      "name": "lines",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 200,
       "title": "Lines"
      }
     },
     {
      "name": "since_minutes",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1440,
       "minimum": 1,
       "default": 60,
       "title": "Since Minutes"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/support/system": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Host + unit facts support used to ask for by SSH",
    "description": "The `systemctl show` / `ls -ld` / `--version` answers, over the API.\n\nEvery field here was something support had to obtain by asking the operator\nfor a shell session during the 2026-08 outages. The unit facts in particular\ndecide the diagnosis outright: a freeradius unit with an EMPTY\n`RuntimeDirectory` cannot recreate /run/freeradius after a reboot, which is\nwhat took two ISPs offline — and it is invisible from every other endpoint.\nRead-only, no shell, no secrets. Scope: `diagnostics:read`.",
    "operationId": "system_facts_support_system_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/services": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Per-service state for every unit SAMM needs",
    "description": "What is running, what is enabled at boot, and how often it has restarted.\n\n/diagnostics reports the four daemons that stamp a heartbeat. This reports\nevery unit the install actually depends on — including freeradius, nginx and\npostgresql, none of which heartbeat, and one of which takes the whole ISP\noffline when it dies. Read-only. Scope: `diagnostics:read`.",
    "operationId": "services_support_services_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/service-restart": {
   "post": {
    "tags": [
     "support"
    ],
    "summary": "Restart one SAMM service",
    "description": "Restart a single SAMM-owned unit.\n\nThe one endpoint in this router that changes the machine, which is why it\nneeds `services:write` — a scope no support token carries by default. During\nthe 2026-08 outages the only way to restart a user's FreeRADIUS was to\nask them for a shell; this closes that, without letting a read-only token do\nit by accident.\n\nAllow-listed against SAMM's own catalogue: never an arbitrary unit name,\nwhich would make this a systemctl proxy for the whole box. `samm-api` is\nhanded to the oneshot restart unit because a process cannot restart itself\ninside the request that asked for it.",
    "operationId": "service_restart_support_service_restart_post",
    "parameters": [
     {
      "name": "unit",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "Unit to restart; must be one SAMM owns",
       "title": "Unit"
      },
      "description": "Unit to restart; must be one SAMM owns"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/support/notifications": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Channel configuration and delivery health",
    "description": "Why messages are not arriving — the question behind most support mail.\n\nThree things, in one call: how each channel is configured (values through\n`_redact()`, so the SMTP password and the WhatsApp access token never leave\nthe box), what the queue has done in the last 24 h per channel and status,\nand the errors themselves. `samm.notif_outbox.last_error` is where a\nrejected SMTP login, an expired Meta token or an unlinked WhatsApp number\nactually says so, and nothing outside this endpoint could read it.\n\nFor the unofficial QR bridge specifically, pair this with\n`GET /support/logs?unit=samm-wa-bridge`. Scope: `diagnostics:read`.",
    "operationId": "notifications_support_notifications_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/queues": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Backlog and failures in every SAMM queue",
    "description": "The three queues that make an install look broken while it is healthy.\n\nA CoA backlog means speed and disconnect changes are not reaching the\nrouters, so an operator sees \"the plan change did nothing\". Unapplied\n`audit_log` rows mean samm-radius is not draining, so panel actions appear\nto be ignored. A webhook backlog means the customer's own integration is\ndown, not SAMM. Each one is a different owner, and they are indistinguishable\nfrom the panel. (`notif_outbox` has its own endpoint, /support/notifications.)\n\nSame per-status indexed ranges as there, for the same reason. Scope:\n`diagnostics:read`.",
    "operationId": "queues_support_queues_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/license": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Licence state, and what it is sized against",
    "description": "Where an install stands with the licence authority, and why.\n\n`license_last_error` is the whole answer to \"it says unlicensed\" — a DNS\nblock on license-samm.securytik.com, a clock so far out that the token\nfails validation, a device id that was re-linked elsewhere. The counts are\nwhat the licence is measured against, so an over-limit install shows up\nhere rather than in a support round trip.\n\nEvery `license_*` setting is included EXCEPT the tokens: `_redact()` masks\nany key that looks like a credential, which covers `license_token` and\n`license_device_token`. Scope: `diagnostics:read`.",
    "operationId": "license_state_support_license_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/update": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Update state, and why the last one did not land",
    "description": "What this install knows about updates, and how its schema compares.\n\nAn update that fails leaves `update_apply_error` and a stalled\n`update_apply_phase` behind, and until now neither was readable remotely —\nnor was the updater's journal, which is the other half (now\n`GET /support/logs?unit=samm-updater`).\n\n`schema_head` against `SAMM_VERSION` is the second question support asks:\nan install running new code on an old schema behaves like neither release.\nScope: `diagnostics:read`.",
    "operationId": "update_state_support_update_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/database": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "PostgreSQL health and the connection pool",
    "description": "The pool, the server, and what is holding either of them.\n\nThis exists because of one incident shape that reaches us repeatedly: the\npanel starts timing out and the captured traceback says\n`QueuePool limit of size N overflow M reached` — SQLAlchemy could not get a\nconnection. That single line cannot distinguish a leak in SAMM from a\nPostgres that is refusing connections from a long query holding a lock, and\nthe difference decides the fix. All three are here.\n\n`pg_stat_activity` shows the query text of OUR OWN backends only (SAMM\nconnects as one unprivileged role), which is the set that matters; other\nroles appear as a state with no text. Query text is masked anyway. Scope:\n`diagnostics:read`.",
    "operationId": "database_support_database_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/backups": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Are backups running, and did the last one work?",
    "description": "The nightly backup's own record, plus what is actually on disk.\n\nA scheduled backup that has been failing silently is only discovered when\nsomeone needs it. `_backup_auto_last_error` is written every time the sweep\nfails and read by nobody; this puts it where support can see it without a\nshell, next to the files it claims to have written.\n\nSince SAMM has no update rollback, a current backup is the only floor under\na bad update — so \"is this install backed up\" is a release question, not\njust a support one. Scope: `diagnostics:read`.",
    "operationId": "backups_support_backups_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/support/payments": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "Online payment gateways and recent checkouts",
    "description": "Which gateways are set up (never a key or secret: only the base URL,\ncurrency and public address) and the latest online checkouts with what each\ngateway answered. Answers \"the customer paid but nothing happened\" without a\nshell. Scope: `diagnostics:read`.",
    "operationId": "payments_support_payments_get",
    "parameters": [
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "pending | paid | expired | failed | review",
       "title": "Status"
      },
      "description": "pending | paid | expired | failed | review"
     },
     {
      "name": "gateway",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Gateway"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 200,
       "minimum": 1,
       "default": 50,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/support/payments/incoming": {
   "get": {
    "tags": [
     "support"
    ],
    "summary": "What actually reached the ISP's payment accounts (live, read-only)",
    "description": "Asks each enabled payment channel, read-only, for its latest incoming money: time, amount, currency, the\nnote / reference the payer typed (what SAMM matches on) and a masked sender. Put it next to `/payments` to see\nwhether a payment never arrived, arrived without SAMM's code, or arrived and was not booked. Never returns a key,\na full name or a full address. Scope: `diagnostics:read`.",
    "operationId": "payments_incoming_support_payments_incoming_get",
    "parameters": [
     {
      "name": "gateway",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "shamcash | binance | stripe | paypal; default every enabled one",
       "title": "Gateway"
      },
      "description": "shamcash | binance | stripe | paypal; default every enabled one"
     },
     {
      "name": "hours",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 168,
       "minimum": 1,
       "default": 48,
       "title": "Hours"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 100,
       "minimum": 1,
       "default": 20,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/admins": {
   "get": {
    "tags": [
     "admins"
    ],
    "summary": "Admin accounts and how many users each owns",
    "description": "List admins with their assigned-subscriber counts. Scope: `customers:read`.\n\nFeed `id` to `GET /customers?assigned_admin_id=` (or pass the username to\n`?assigned_admin=`). `customer_count` is the number that lets an operator\nconfirm they picked the right person before acting on them — \"Ali, the one\nwith 456\" is checkable in a way a bare id is not.\n\n`orphaned_customers` counts users whose `assigned_admin_id` points at\nan admin row that no longer exists. samm.user.assigned_admin_id carries no\nforeign key, so deleting an admin silently strands their users; they\nappear under no admin at all and are invisible to every per-admin filter.",
    "operationId": "list_admins_admins_get",
    "parameters": [
     {
      "name": "search",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "username substring, case-insensitive",
       "title": "Search"
      },
      "description": "username substring, case-insensitive"
     },
     {
      "name": "with_customers_only",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "only admins who actually own users",
       "default": false,
       "title": "With Customers Only"
      },
      "description": "only admins who actually own users"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/jobs/kinds": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Every job kind this install knows, with its label",
    "description": "The same action catalogue the panel's bulk dialog offers (Websites &\nApps, QoS, Router Security, backup, update, NTP, ...). Scope:\n`routers:jobs`.",
    "operationId": "job_kinds_routers_jobs_kinds_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/routers/jobs/prefill": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "Prefill values for a job kind over a set of routers",
    "description": "The \"start from the fullest config among the chosen routers\" values the\npanel's bulk dialog prefills with (app/admin/jobs_routes.py:jobs_prefill),\nfor an install-wide token — see the module docstring for why there is no\nrow-scoping step. Scope: `routers:jobs`.",
    "operationId": "job_prefill_routers_jobs_prefill_get",
    "parameters": [
     {
      "name": "kind",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Kind"
      }
     },
     {
      "name": "nas_ids",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "Comma-separated router ids",
       "title": "Nas Ids"
      },
      "description": "Comma-separated router ids"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/jobs": {
   "post": {
    "tags": [
     "routers"
    ],
    "summary": "Start a background job on one or more routers",
    "description": "Queues one job item per router and returns at once; poll\n`GET /routers/jobs/{id}` for progress. Every handler's own side effects\n(RouterOS pushes, Admin Log rows) are unchanged from the panel path.\nScope: `routers:jobs`.",
    "operationId": "job_start_routers_jobs_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/JobStart"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/jobs/{job_id}": {
   "get": {
    "tags": [
     "routers"
    ],
    "summary": "A job's status and its per-router items",
    "description": "Scope: `routers:jobs`.",
    "operationId": "job_get_routers_jobs__job_id__get",
    "parameters": [
     {
      "name": "job_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Job Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/routers/jobs/{job_id}/cancel": {
   "post": {
    "tags": [
     "routers"
    ],
    "summary": "Cancel a job's not-yet-started items",
    "description": "Routers not started yet are skipped; one already running finishes (a\nhalf-pushed router is worse). Scope: `routers:jobs`.",
    "operationId": "job_cancel_routers_jobs__job_id__cancel_post",
    "parameters": [
     {
      "name": "job_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Job Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/backups": {
   "get": {
    "tags": [
     "backups"
    ],
    "summary": "List backups on disk",
    "description": "Newest first, with kind (manual/auto), size and the database/host it\nwas taken from. Scope: `backups:read`.",
    "operationId": "list_backups_backups_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "backups"
    ],
    "summary": "Start a backup in the background",
    "description": "Starts a `pg_dump` on a background thread and returns at once — the\nsame reasoning as the panel's Create button (a dump of a large database\noutlasts most HTTP proxies). Poll `GET /backups` for it to appear. Scope:\n`backups:write`.",
    "operationId": "create_backup_backups_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/BackupCreate"
       }
      }
     },
     "required": true
    },
    "responses": {
     "202": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/backups/schedule": {
   "get": {
    "tags": [
     "backups"
    ],
    "summary": "The automatic nightly backup's schedule",
    "description": "Scope: `backups:read`.",
    "operationId": "get_schedule_backups_schedule_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "put": {
    "tags": [
     "backups"
    ],
    "summary": "Change the automatic backup schedule",
    "description": "Same validation as the panel's admin_tools_backup_schedule. Scope:\n`backups:write`.",
    "operationId": "put_schedule_backups_schedule_put",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/app__api__routers__backups__ScheduleUpdate"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/backups/{name}/download": {
   "get": {
    "tags": [
     "backups"
    ],
    "summary": "Download one backup file",
    "description": "Scope: `backups:read`.",
    "operationId": "download_backup_backups__name__download_get",
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Name"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/backups/{name}": {
   "delete": {
    "tags": [
     "backups"
    ],
    "summary": "Delete one backup file",
    "description": "Scope: `backups:write`.",
    "operationId": "delete_backup_backups__name__delete",
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Name"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/backups/{name}/restore": {
   "post": {
    "tags": [
     "backups"
    ],
    "summary": "Restore a backup (DESTRUCTIVE)",
    "description": "Drops and recreates the database from the named dump, in the\nbackground, exactly like the panel's Restore button — including the\n`confirm` gate. SAMM has no update rollback, so this is also the only way\nback from a bad change: get the exact confirmation text right before\ncalling. Scope: `backups:write`.",
    "operationId": "restore_backup_backups__name__restore_post",
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Name"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RestoreBody"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/history/space": {
   "get": {
    "tags": [
     "history"
    ],
    "summary": "What each cleanable table costs on disk",
    "description": "Same figures as the panel page: live/dead row estimates and the\nreclaimable (bloat) share. Scope: `history:read`.",
    "operationId": "space_history_space_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/history/schedule": {
   "get": {
    "tags": [
     "history"
    ],
    "summary": "The automatic history clean's schedule",
    "description": "Scope: `history:read`.",
    "operationId": "get_schedule_history_schedule_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "put": {
    "tags": [
     "history"
    ],
    "summary": "Change the automatic history clean's schedule",
    "description": "Same validation as admin_tools_history_cleaner_schedule. Scope:\n`history:write`.",
    "operationId": "put_schedule_history_schedule_put",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/app__api__routers__history__ScheduleUpdate"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/history/clean": {
   "post": {
    "tags": [
     "history"
    ],
    "summary": "Run the history cleaner now (DESTRUCTIVE)",
    "description": "Deletes history older than the preset's cutoff and VACUUMs the\naffected tables — identical to the panel's Run button, including the\n`confirm` gate. Deletion does not shrink the database file; see\n`GET /history/space` and the panel's Reclaim action for that. Scope:\n`history:write`.",
    "operationId": "clean_history_clean_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CleanBody"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/wireguard/clients": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "List WireGuard VPN clients",
    "description": "Scope: `vpn:read`.",
    "operationId": "wg_list_vpn_wireguard_clients_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "vpn"
    ],
    "summary": "Add a WireGuard client",
    "description": "Generates a keypair, assigns the next free address and rewrites\nwg0.conf — identical to the panel's Add Client. `add_as_router` mirrors\nthe panel's \"Managed Router (NAS)\" radio. Scope: `vpn:write`.",
    "operationId": "wg_create_vpn_wireguard_clients_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WgCreate"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/wireguard/clients/{peer_id}": {
   "put": {
    "tags": [
     "vpn"
    ],
    "summary": "Rename a WireGuard client",
    "description": "Display name only — keys, address and any linked router stay. Scope:\n`vpn:write`.",
    "operationId": "wg_rename_vpn_wireguard_clients__peer_id__put",
    "parameters": [
     {
      "name": "peer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Peer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RenameBody"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "vpn"
    ],
    "summary": "Delete a WireGuard client",
    "description": "Scope: `vpn:write`.",
    "operationId": "wg_delete_vpn_wireguard_clients__peer_id__delete",
    "parameters": [
     {
      "name": "peer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Peer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/wireguard/clients/{peer_id}/toggle": {
   "post": {
    "tags": [
     "vpn"
    ],
    "summary": "Enable/disable a WireGuard client",
    "description": "Scope: `vpn:write`.",
    "operationId": "wg_toggle_vpn_wireguard_clients__peer_id__toggle_post",
    "parameters": [
     {
      "name": "peer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Peer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/wireguard/clients/{peer_id}/config": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "This client's wg-quick config text",
    "description": "A working credential — scoped like the panel's own config endpoint.\nScope: `vpn:read`.",
    "operationId": "wg_config_vpn_wireguard_clients__peer_id__config_get",
    "parameters": [
     {
      "name": "peer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Peer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/wireguard/clients/{peer_id}/mikrotik": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "RouterOS commands to install this client",
    "description": "Scope: `vpn:read`.",
    "operationId": "wg_mikrotik_vpn_wireguard_clients__peer_id__mikrotik_get",
    "parameters": [
     {
      "name": "peer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Peer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/l2tp/clients": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "List L2TP/IPsec VPN clients",
    "description": "Scope: `vpn:read`.",
    "operationId": "l2tp_list_vpn_l2tp_clients_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "vpn"
    ],
    "summary": "Add an L2TP client",
    "description": "Generates a username + password and rewrites chap-secrets — identical\nto the panel's Add Client. The password is returned once; re-fetch it\nwith `GET /vpn/l2tp/clients/{id}/config`. `add_as_router` mirrors the\npanel's \"Managed Router (NAS)\" radio. Scope: `vpn:write`.",
    "operationId": "l2tp_create_vpn_l2tp_clients_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/L2tpCreate"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/l2tp/clients/{cid}": {
   "put": {
    "tags": [
     "vpn"
    ],
    "summary": "Rename an L2TP client",
    "description": "Display name only — the login (username) and password stay. Scope:\n`vpn:write`.",
    "operationId": "l2tp_rename_vpn_l2tp_clients__cid__put",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RenameBody"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "vpn"
    ],
    "summary": "Delete an L2TP client",
    "description": "Scope: `vpn:write`.",
    "operationId": "l2tp_delete_vpn_l2tp_clients__cid__delete",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/l2tp/clients/{cid}/toggle": {
   "post": {
    "tags": [
     "vpn"
    ],
    "summary": "Enable/disable an L2TP client",
    "description": "Disabling stops the NEXT dial; an already-connected tunnel is kicked\nonce rather than restarting the daemon (which would drop every tunnel).\nScope: `vpn:write`.",
    "operationId": "l2tp_toggle_vpn_l2tp_clients__cid__toggle_post",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/l2tp/clients/{cid}/config": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "This client's plain-text config",
    "description": "Includes the password — a working credential. Scope: `vpn:read`.",
    "operationId": "l2tp_config_vpn_l2tp_clients__cid__config_get",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/l2tp/clients/{cid}/mikrotik": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "RouterOS commands to install this client",
    "description": "Scope: `vpn:read`.",
    "operationId": "l2tp_mikrotik_vpn_l2tp_clients__cid__mikrotik_get",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/sstp/clients": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "List SSTP VPN clients",
    "description": "Scope: `vpn:read`.",
    "operationId": "sstp_list_vpn_sstp_clients_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "vpn"
    ],
    "summary": "Add an SSTP client",
    "description": "Generates a username + password and writes the SSTP secrets file —\nidentical to the panel's Add Client. Re-fetch the password with\n`GET /vpn/sstp/clients/{id}/config`. `add_as_router` mirrors the\npanel's \"Managed Router (NAS)\" radio. Scope: `vpn:write`.",
    "operationId": "sstp_create_vpn_sstp_clients_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SstpCreate"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/sstp/clients/{cid}": {
   "put": {
    "tags": [
     "vpn"
    ],
    "summary": "Rename an SSTP client",
    "description": "Display name only — the login (username) and password stay. Scope:\n`vpn:write`.",
    "operationId": "sstp_rename_vpn_sstp_clients__cid__put",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RenameBody"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "vpn"
    ],
    "summary": "Delete an SSTP client",
    "description": "Scope: `vpn:write`.",
    "operationId": "sstp_delete_vpn_sstp_clients__cid__delete",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/sstp/clients/{cid}/toggle": {
   "post": {
    "tags": [
     "vpn"
    ],
    "summary": "Enable/disable an SSTP client",
    "description": "Disabling stops the NEXT dial; an already-connected tunnel is kicked\nonce rather than restarting the daemon (which would drop every tunnel).\nScope: `vpn:write`.",
    "operationId": "sstp_toggle_vpn_sstp_clients__cid__toggle_post",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/sstp/clients/{cid}/config": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "This client's plain-text config",
    "description": "Includes the password — a working credential. Scope: `vpn:read`.",
    "operationId": "sstp_config_vpn_sstp_clients__cid__config_get",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/vpn/sstp/clients/{cid}/mikrotik": {
   "get": {
    "tags": [
     "vpn"
    ],
    "summary": "RouterOS commands to install this client",
    "description": "Scope: `vpn:read`.",
    "operationId": "sstp_mikrotik_vpn_sstp_clients__cid__mikrotik_get",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Cid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/branches": {
   "get": {
    "tags": [
     "branches"
    ],
    "summary": "The branch tree: admins that own users",
    "description": "Every `holds_users` admin, with its parent (`parent_admin_id`) and how\nmany users it owns directly. Build the tree client-side from\n`parent_branch_id` — it is already the nearest `holds_users` ancestor,\nnot necessarily the immediate `parent_admin_id` (a non-branch login role\ncan sit in between). Scope: `customers:read`.",
    "operationId": "list_branches_branches_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/branch": {
   "put": {
    "tags": [
     "branches"
    ],
    "summary": "Move a user to another branch",
    "description": "Sets `samm.user.assigned_admin_id` — the same column and the same rule\nas the panel's bulk \"Assign admin\" action (app/admin/routes.py, action ==\n\"assign-admin\"): the branch must be an active, `holds_users` admin.\nOwnership decides whose prepaid wallet an agent's renewals spend against,\nso `before`/`after` are recorded in full. Scope: `admins:write`.",
    "operationId": "assign_branch_customers__customer_id__branch_put",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/BranchAssign"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/data-log": {
   "get": {
    "tags": [
     "customers"
    ],
    "summary": "A user's logged traffic destinations",
    "description": "Reads `samm.user_data_log` (recent, fine-grained) falling back to\nnothing older than it holds — the panel's own rollup\n(`samm.user_data_log_daily`) is NOT merged in here, so a `from` far in the\npast returns fewer rows rather than silently switching granularity.\nScope: `diagnostics:read`.",
    "operationId": "data_log_customers__customer_id__data_log_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "from",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "format": "date-time"
        },
        {
         "type": "null"
        }
       ],
       "title": "From"
      }
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "format": "date-time"
        },
        {
         "type": "null"
        }
       ],
       "title": "To"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 2000,
       "minimum": 1,
       "default": 200,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/addons": {
   "get": {
    "tags": [
     "addons"
    ],
    "summary": "The add-on catalogue",
    "description": "Scope: `addons:read`.",
    "operationId": "list_addons_addons_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/addons": {
   "get": {
    "tags": [
     "addons"
    ],
    "summary": "Add-ons a user holds",
    "description": "Every add-on ever granted to this user, live ones first. Scope:\n`addons:read`.",
    "operationId": "customer_addons_customers__customer_id__addons_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "addons"
    ],
    "summary": "Grant a user one add-on",
    "description": "Starts now, or when an already-held copy of the same add-on ends\n(buying twice extends). Scope: `addons:write`.",
    "operationId": "grant_addon_customers__customer_id__addons_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AddonGrant"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/user-addons/{user_addon_id}": {
   "delete": {
    "tags": [
     "addons"
    ],
    "summary": "Cancel a held add-on",
    "description": "Ends it now; it does not refund or reverse any invoice already raised.\nScope: `addons:write`.",
    "operationId": "cancel_addon_user_addons__user_addon_id__delete",
    "parameters": [
     {
      "name": "user_addon_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "User Addon Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/price-lists": {
   "get": {
    "tags": [
     "addons"
    ],
    "summary": "Per-branch plan and add-on prices",
    "description": "The price a branch pays for every plan and add-on: its own, else the\nnearest ancestor branch's, else the plan/add-on card's own price\n(sql/0206, `samm.plan_price_admin` / `samm.addon_price_admin`). Scope:\n`addons:read`.",
    "operationId": "price_lists_price_lists_get",
    "parameters": [
     {
      "name": "branch_id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Branch Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/imports/users": {
   "post": {
    "tags": [
     "imports"
    ],
    "summary": "Bulk-import users from a CSV/XLSX/MikroTik .rsc file",
    "description": "Parses the upload, validates every row (duplicate natural keys, bad\nplan names, required columns — exactly `import_export.parse_upload`'s own\nrules) and commits in the same request. Returns per-row outcome notes, so\na partially-bad file still reports exactly what happened to each row\nrather than refusing the whole batch. Scope: `imports:write`.",
    "operationId": "import_users_imports_users_post",
    "requestBody": {
     "content": {
      "multipart/form-data": {
       "schema": {
        "$ref": "#/components/schemas/Body_import_users_imports_users_post"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/files": {
   "get": {
    "tags": [
     "files"
    ],
    "summary": "Files kept on a user",
    "description": "Every file stored on this user (not their bytes — use the download\nendpoint for that). Scope: `customers:read`.",
    "operationId": "list_files_customers__customer_id__files_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "files"
    ],
    "summary": "Upload a file to a user",
    "description": "Stores the upload exactly like the panel's Upload pop-up (same size\ncap — Settings -> Advanced -> files_max_mb). Scope: `customers:write`.",
    "operationId": "upload_file_customers__customer_id__files_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "$ref": "#/components/schemas/Body_upload_file_customers__customer_id__files_post"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/files/{file_id}": {
   "get": {
    "tags": [
     "files"
    ],
    "summary": "Download a user's file",
    "description": "The file's bytes. Scope: `customers:read`.",
    "operationId": "download_file_customers__customer_id__files__file_id__get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "file_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "File Id"
      }
     },
     {
      "name": "download",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Download"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "files"
    ],
    "summary": "Delete a user's file",
    "description": "Permanently deletes the file. Scope: `customers:write`.",
    "operationId": "delete_file_customers__customer_id__files__file_id__delete",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "file_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "File Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/collect/lookup": {
   "get": {
    "tags": [
     "collect"
    ],
    "summary": "Find a user by username: what is due (for payment apps)",
    "description": "Masked name, plan, expiry, amount due, open invoices and wallet balance. Scope: `collect:read`.",
    "operationId": "lookup_collect_lookup_get",
    "parameters": [
     {
      "name": "username",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 64,
       "title": "Username"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/collect/payments": {
   "post": {
    "tags": [
     "collect"
    ],
    "summary": "Record a payment taken by a payment app",
    "description": "Credits the user's wallet and settles open invoices (the named one first, then oldest first);\nrestores a user suspended for not paying. Idempotent on (channel, reference). Scope: `collect:write`.",
    "operationId": "collect_payment_collect_payments_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CollectPayment"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/collect/payments/{channel}/{reference}": {
   "get": {
    "tags": [
     "collect"
    ],
    "summary": "What happened to one app payment",
    "description": "Scope: `collect:read`. 404 means SAMM never booked it: safe to send it again.",
    "operationId": "collect_payment_status_collect_payments__channel___reference__get",
    "parameters": [
     {
      "name": "channel",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Channel"
      }
     },
     {
      "name": "reference",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Reference"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/cash-accounts": {
   "get": {
    "tags": [
     "money"
    ],
    "summary": "Where money lands",
    "description": "Cash drawers, bank accounts and gateway accounts. A payment or a wallet top-up names one\nby id. Scope: `billing:read`.",
    "operationId": "cash_accounts_cash_accounts_get",
    "parameters": [
     {
      "name": "include_inactive",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Include Inactive"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/CashAccount"
         },
         "title": "Response Cash Accounts Cash Accounts Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}/balance": {
   "get": {
    "tags": [
     "money"
    ],
    "summary": "What an invoice still owes, with its discounts",
    "description": "Total, paid, discount and outstanding as decimal strings, plus every live discount.\nScope: `billing:read`.",
    "operationId": "invoice_balance_invoices__invoice_id__balance_get",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoiceMoney"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}/payments": {
   "post": {
    "tags": [
     "money"
    ],
    "summary": "Record a payment (partial or full)",
    "description": "Record money received against an invoice into a cash account (Dr Cash / Cr Receivable).\nAny amount up to what is owed; the status moves to `partial` or `paid`. A user suspended\nfor not paying is restored once nothing is owed. Scope: `billing:write`.",
    "operationId": "invoice_payment_invoices__invoice_id__payments_post",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PaymentIn"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PaymentOut"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}/discounts": {
   "post": {
    "tags": [
     "money"
    ],
    "summary": "Give a discount on an invoice",
    "description": "Take a percent of the invoice total, or a fixed amount, off what is still owed\n(Dr 4050 Sales Discounts / Cr 1100 Receivable). Refused (409) on a settled invoice, an\nagent's invoice, or a discount larger than what is owed. A fully discounted invoice ends\n`discounted`. Emits `invoice.updated`. Scope: `billing:write`.",
    "operationId": "invoice_discount_invoices__invoice_id__discounts_post",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DiscountIn"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoiceMoney"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/invoices/{invoice_id}/discounts/{discount_id}": {
   "delete": {
    "tags": [
     "money"
    ],
    "summary": "Take a discount back",
    "description": "Void the discount's journal entry; the amount is owed again. Scope: `billing:write`.",
    "operationId": "invoice_discount_remove_invoices__invoice_id__discounts__discount_id__delete",
    "parameters": [
     {
      "name": "invoice_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Invoice Id"
      }
     },
     {
      "name": "discount_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Discount Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoiceMoney"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/wallet": {
   "get": {
    "tags": [
     "money"
    ],
    "summary": "Prepaid balance and its movements",
    "description": "The user's prepaid credit, read straight from the ledger (account 2300), with the newest\nmovements first and the running balance after each. Scope: `billing:read`.",
    "operationId": "wallet_customers__customer_id__wallet_get",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 500,
       "minimum": 1,
       "default": 50,
       "title": "Limit"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Wallet"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/wallet/topup": {
   "post": {
    "tags": [
     "money"
    ],
    "summary": "Add prepaid credit",
    "description": "Dr Cash / Cr Wallet, then (with `settle`, the default) pay open invoices oldest first from\nthe balance and restore a user suspended for not paying. Emits `wallet.topup`, and\n`invoice.updated` / `invoice.paid` for each invoice it settles. Scope: `billing:write`.",
    "operationId": "wallet_topup_customers__customer_id__wallet_topup_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TopUpIn"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WalletResult"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/wallet/pay-invoice": {
   "post": {
    "tags": [
     "money"
    ],
    "summary": "Pay an invoice from the wallet",
    "description": "Dr Wallet / Cr Receivable, capped at both the balance and what the invoice owes.\n409 when nothing could be paid (empty wallet, settled invoice). Scope: `billing:write`.",
    "operationId": "wallet_pay_invoice_customers__customer_id__wallet_pay_invoice_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WalletPayIn"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WalletResult"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/customers/{customer_id}/wallet/withdraw": {
   "post": {
    "tags": [
     "money"
    ],
    "summary": "Hand credit back as cash",
    "description": "Dr Wallet / Cr Cash. Refused (409) above the balance. Scope: `billing:write`.",
    "operationId": "wallet_withdraw_customers__customer_id__wallet_withdraw_post",
    "parameters": [
     {
      "name": "customer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Customer Id"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WithdrawIn"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WalletResult"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/me": {
   "get": {
    "tags": [
     "auth"
    ],
    "summary": "Introspect the calling token",
    "description": "Introspect the calling token: name, effective scopes (write expands to read) and rate limit. Use it to smoke-test credentials.",
    "operationId": "me_me_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MeResponse"
        }
       }
      }
     }
    }
   }
  },
  "/stats/overview": {
   "get": {
    "tags": [
     "stats"
    ],
    "summary": "Install-wide dashboard aggregates",
    "description": "Install-wide aggregates for dashboards: user counts by status, live session count, today's traffic totals, router reachability, card counts, and the backlog of the CoA / command / webhook queues. Scope: `stats:read`.",
    "operationId": "stats_overview_stats_overview_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/StatsOverviewResponse"
        }
       }
      }
     }
    }
   }
  },
  "/commands": {
   "get": {
    "tags": [
     "auth"
    ],
    "summary": "This token's queued commands and their applied status",
    "description": "Mutations like resets and card/group status changes are queued into the\naudit-log command queue and applied by samm-radius within one tick. This\nendpoint reports only the calling token's own commands.",
    "operationId": "my_commands_commands_get",
    "parameters": [
     {
      "name": "applied",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "boolean"
        },
        {
         "type": "null"
        }
       ],
       "title": "Applied"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 500,
       "minimum": 1,
       "default": 50,
       "title": "Limit"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Offset"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ListResponse_CommandItem_"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "AccountingExportResponse": {
    "properties": {
     "kind": {
      "type": "string",
      "title": "Kind"
     },
     "columns": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Columns"
     },
     "rows": {
      "items": {
       "type": "object"
      },
      "type": "array",
      "title": "Rows"
     }
    },
    "type": "object",
    "required": [
     "kind",
     "columns",
     "rows"
    ],
    "title": "AccountingExportResponse"
   },
   "AddonGrant": {
    "properties": {
     "addon_id": {
      "type": "integer",
      "title": "Addon Id"
     },
     "charge": {
      "type": "boolean",
      "title": "Charge",
      "description": "Invoice the price (false = comp it)",
      "default": true
     },
     "pay_from_wallet": {
      "type": "boolean",
      "title": "Pay From Wallet",
      "description": "Settle the invoice from the wallet at once",
      "default": false
     }
    },
    "type": "object",
    "required": [
     "addon_id"
    ],
    "title": "AddonGrant"
   },
   "AssignPlanRequest": {
    "properties": {
     "plan_id": {
      "type": "integer",
      "title": "Plan Id",
      "description": "Target plan (see GET /plans)"
     },
     "extend_expiration": {
      "type": "boolean",
      "title": "Extend Expiration",
      "description": "Apply the new plan's expiration period (renew from now); off keeps the current expiration",
      "default": false
     },
     "reset_state": {
      "type": "boolean",
      "title": "Reset State",
      "description": "Reset usage counters (daily/quota/uptime) to zero",
      "default": false
     },
     "generate_invoice": {
      "type": "boolean",
      "title": "Generate Invoice",
      "description": "Create an invoice for the new plan's price",
      "default": false
     },
     "invoice_due_days": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Due Days"
     },
     "reactivate": {
      "type": "boolean",
      "title": "Reactivate",
      "description": "Also reactivate a suspended/expired account",
      "default": false
     },
     "apply_speed_live": {
      "type": "boolean",
      "title": "Apply Speed Live",
      "description": "Push a CoA so the new speed applies to the online session immediately",
      "default": false
     },
     "notify_customer": {
      "type": "boolean",
      "title": "Notify Customer",
      "description": "Send the user a plan-change notification",
      "default": false
     },
     "when": {
      "type": "string",
      "title": "When",
      "description": "'now' applies immediately; 'renewal' queues the plan for the next renewal and changes nothing today",
      "default": "now"
     },
     "invoice_mode": {
      "type": "string",
      "title": "Invoice Mode",
      "description": "'full' bills one whole new period, 'segmented' bills only the price difference over the remaining time, 'none' bills nothing",
      "default": "none"
     },
     "invoice_paid": {
      "type": "boolean",
      "title": "Invoice Paid",
      "description": "Record the invoice as paid in cash straight away",
      "default": false
     },
     "keep_expiration": {
      "type": "boolean",
      "title": "Keep Expiration",
      "description": "With invoice_mode 'full': bill the new plan but keep the current expiration instead of starting a new period today",
      "default": false
     },
     "expiry_anchor": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiry Anchor",
      "description": "Where the new period starts when the expiry moves: 'expiry' continues from the current expiry, 'today' starts now; omitted = today"
     },
     "expiry_adjust_days": {
      "type": "integer",
      "maximum": 3650.0,
      "minimum": -3650.0,
      "title": "Expiry Adjust Days",
      "description": "Days added to (or taken off) the computed new expiry",
      "default": 0
     },
     "expiry_adjust_minutes": {
      "type": "integer",
      "maximum": 5256000.0,
      "minimum": -5256000.0,
      "title": "Expiry Adjust Minutes",
      "description": "Minutes added to (or taken off) the computed new expiry",
      "default": 0
     }
    },
    "type": "object",
    "required": [
     "plan_id"
    ],
    "title": "AssignPlanRequest"
   },
   "AssignPlanResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Plan Id"
     },
     "invoice_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Id",
      "description": "Invoice id, when one was generated"
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "plan_id",
     "invoice_id"
    ],
    "title": "AssignPlanResponse"
   },
   "BackupCreate": {
    "properties": {
     "note": {
      "type": "string",
      "maxLength": 200,
      "title": "Note",
      "default": ""
     },
     "skip_usage": {
      "type": "boolean",
      "title": "Skip Usage",
      "description": "Skip usage/session/log tables (smaller, faster)",
      "default": true
     }
    },
    "type": "object",
    "title": "BackupCreate"
   },
   "Body_import_users_imports_users_post": {
    "properties": {
     "file": {
      "type": "string",
      "format": "binary",
      "title": "File"
     },
     "duplicate_policy": {
      "type": "string",
      "title": "Duplicate Policy",
      "description": "\"skip\" or \"update\"",
      "default": "skip"
     },
     "default_plan_name": {
      "type": "string",
      "title": "Default Plan Name",
      "description": "Fallback plan for rows with no plan_name",
      "default": ""
     },
     "branch_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Branch Id",
      "description": "Owning branch; omit to leave unowned"
     }
    },
    "type": "object",
    "required": [
     "file"
    ],
    "title": "Body_import_users_imports_users_post"
   },
   "Body_upload_file_customers__customer_id__files_post": {
    "properties": {
     "file": {
      "type": "string",
      "format": "binary",
      "title": "File"
     },
     "portal_visible": {
      "type": "boolean",
      "title": "Portal Visible",
      "description": "Show this file to the user in their own portal",
      "default": false
     },
     "doc_type": {
      "type": "string",
      "title": "Doc Type",
      "description": "One of the file-type catalogue keys; blank leaves it unset",
      "default": ""
     },
     "note": {
      "type": "string",
      "maxLength": 500,
      "title": "Note",
      "default": ""
     },
     "alias": {
      "type": "string",
      "maxLength": 120,
      "title": "Alias",
      "default": ""
     }
    },
    "type": "object",
    "required": [
     "file"
    ],
    "title": "Body_upload_file_customers__customer_id__files_post"
   },
   "BranchAssign": {
    "properties": {
     "branch_id": {
      "type": "integer",
      "title": "Branch Id",
      "description": "Must be an active admin with holds_users"
     }
    },
    "type": "object",
    "required": [
     "branch_id"
    ],
    "title": "BranchAssign"
   },
   "BulkRequest": {
    "properties": {
     "customer_ids": {
      "items": {
       "type": "integer"
      },
      "type": "array",
      "title": "Customer Ids",
      "description": "Users to act on"
     },
     "expiration_date": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Date",
      "description": "Absolute expiry, ISO 8601 or 'YYYY-MM-DD HH:MM' (interpreted in the install's timezone)"
     },
     "status": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Status",
      "description": "active | suspended — omit to leave status alone"
     }
    },
    "type": "object",
    "required": [
     "customer_ids"
    ],
    "title": "BulkRequest"
   },
   "CardCounts": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "active": {
      "type": "integer",
      "title": "Active"
     },
     "unused": {
      "type": "integer",
      "title": "Unused"
     }
    },
    "type": "object",
    "required": [
     "total",
     "active",
     "unused"
    ],
    "title": "CardCounts"
   },
   "CardDetailResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "password": {
      "type": "string",
      "title": "Password"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "unused | active | exhausted | disabled"
     },
     "activated_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Activated At"
     },
     "group_id": {
      "type": "integer",
      "title": "Group Id"
     },
     "group_name": {
      "type": "string",
      "title": "Group Name"
     },
     "limit_state": {
      "items": {
       "$ref": "#/components/schemas/CardLimitState"
      },
      "type": "array",
      "title": "Limit State"
     },
     "totals": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/UsageTotals"
       },
       {
        "type": "null"
       }
      ]
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "password",
     "status",
     "activated_at",
     "group_id",
     "group_name",
     "limit_state",
     "totals"
    ],
    "title": "CardDetailResponse"
   },
   "CardGroupCounts": {
    "properties": {
     "cards": {
      "type": "integer",
      "title": "Cards"
     },
     "unused": {
      "type": "integer",
      "title": "Unused"
     },
     "active": {
      "type": "integer",
      "title": "Active"
     },
     "exhausted": {
      "type": "integer",
      "title": "Exhausted"
     },
     "disabled": {
      "type": "integer",
      "title": "Disabled"
     }
    },
    "type": "object",
    "required": [
     "cards",
     "unused",
     "active",
     "exhausted",
     "disabled"
    ],
    "title": "CardGroupCounts"
   },
   "CardGroupCreate": {
    "properties": {
     "name": {
      "type": "string",
      "title": "Name",
      "description": "Group name — unique across the install"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     },
     "count": {
      "type": "integer",
      "maximum": 10000.0,
      "minimum": 1.0,
      "title": "Count",
      "description": "How many cards to generate"
     },
     "speed_down_mbps": {
      "type": "number",
      "exclusiveMinimum": 0.0,
      "title": "Speed Down Mbps",
      "description": "Download speed for every card in the group (Mbps)"
     },
     "speed_up_mbps": {
      "type": "number",
      "exclusiveMinimum": 0.0,
      "title": "Speed Up Mbps",
      "description": "Upload speed for every card in the group (Mbps)"
     },
     "quota_mode": {
      "type": "string",
      "enum": [
       "unlimited",
       "combined",
       "separate"
      ],
      "title": "Quota Mode",
      "description": "unlimited = no traffic cap; combined = one shared cap (quota_total_bytes); separate = independent down/up caps",
      "default": "unlimited"
     },
     "quota_total_bytes": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Quota Total Bytes",
      "description": "Traffic cap when quota_mode=combined"
     },
     "quota_down_bytes": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Quota Down Bytes",
      "description": "Download cap when quota_mode=separate"
     },
     "quota_up_bytes": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Quota Up Bytes",
      "description": "Upload cap when quota_mode=separate"
     },
     "uptime_seconds": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Seconds",
      "description": "Total online-time budget per card; omit for unlimited"
     },
     "expiration_seconds": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Seconds",
      "description": "Validity window per card, counted from first login; omit for none"
     },
     "valid_until": {
      "anyOf": [
       {
        "type": "string",
        "format": "date"
       },
       {
        "type": "null"
       }
      ],
      "title": "Valid Until",
      "description": "Hard end date for the whole group (extendable later)"
     },
     "username_prefix": {
      "type": "string",
      "title": "Username Prefix",
      "description": "Fixed prefix prepended to every generated card username",
      "default": ""
     },
     "username_format": {
      "type": "string",
      "enum": [
       "numeric",
       "letters",
       "alphanumeric"
      ],
      "title": "Username Format",
      "description": "Character set for the generated part of usernames",
      "default": "numeric"
     },
     "username_length": {
      "type": "integer",
      "maximum": 24.0,
      "minimum": 0.0,
      "title": "Username Length",
      "description": "Generated length after the prefix",
      "default": 8
     },
     "password_format": {
      "type": "string",
      "enum": [
       "numeric",
       "letters",
       "alphanumeric"
      ],
      "title": "Password Format",
      "description": "Character set for generated passwords",
      "default": "numeric"
     },
     "password_length": {
      "type": "integer",
      "maximum": 16.0,
      "minimum": 4.0,
      "title": "Password Length",
      "default": 6
     },
     "notes": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Notes"
     }
    },
    "type": "object",
    "required": [
     "name",
     "count",
     "speed_down_mbps",
     "speed_up_mbps"
    ],
    "title": "CardGroupCreate"
   },
   "CardGroupDetailResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "name": {
      "type": "string",
      "title": "Name"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     },
     "speed_down_mbps": {
      "type": "number",
      "title": "Speed Down Mbps"
     },
     "speed_up_mbps": {
      "type": "number",
      "title": "Speed Up Mbps"
     },
     "quota_mode": {
      "type": "string",
      "title": "Quota Mode",
      "description": "unlimited | combined | separate"
     },
     "quota_total_bytes": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Quota Total Bytes"
     },
     "quota_down_bytes": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Quota Down Bytes"
     },
     "quota_up_bytes": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Quota Up Bytes"
     },
     "uptime_seconds": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Seconds"
     },
     "expiration_seconds": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Seconds"
     },
     "valid_until": {
      "anyOf": [
       {
        "type": "string",
        "format": "date"
       },
       {
        "type": "null"
       }
      ],
      "title": "Valid Until"
     },
     "username_prefix": {
      "type": "string",
      "title": "Username Prefix"
     },
     "username_format": {
      "type": "string",
      "title": "Username Format"
     },
     "username_length": {
      "type": "integer",
      "title": "Username Length"
     },
     "password_format": {
      "type": "string",
      "title": "Password Format"
     },
     "password_length": {
      "type": "integer",
      "title": "Password Length"
     },
     "enabled": {
      "type": "boolean",
      "title": "Enabled"
     },
     "notes": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Notes"
     },
     "price_per_card": {
      "type": "number",
      "title": "Price Per Card"
     },
     "reseller_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Reseller Id"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
     },
     "counts": {
      "$ref": "#/components/schemas/CardGroupCounts"
     }
    },
    "type": "object",
    "required": [
     "id",
     "name",
     "description",
     "speed_down_mbps",
     "speed_up_mbps",
     "quota_mode",
     "quota_total_bytes",
     "quota_down_bytes",
     "quota_up_bytes",
     "uptime_seconds",
     "expiration_seconds",
     "valid_until",
     "username_prefix",
     "username_format",
     "username_length",
     "password_format",
     "password_length",
     "enabled",
     "notes",
     "price_per_card",
     "reseller_id",
     "created_at",
     "updated_at",
     "counts"
    ],
    "title": "CardGroupDetailResponse"
   },
   "CardGroupListItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "name": {
      "type": "string",
      "title": "Name"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     },
     "valid_until": {
      "anyOf": [
       {
        "type": "string",
        "format": "date"
       },
       {
        "type": "null"
       }
      ],
      "title": "Valid Until"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "cards": {
      "type": "integer",
      "title": "Cards"
     },
     "unused": {
      "type": "integer",
      "title": "Unused"
     },
     "active": {
      "type": "integer",
      "title": "Active"
     }
    },
    "type": "object",
    "required": [
     "id",
     "name",
     "description",
     "valid_until",
     "created_at",
     "cards",
     "unused",
     "active"
    ],
    "title": "CardGroupListItem"
   },
   "CardItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "password": {
      "type": "string",
      "title": "Password"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "unused | active | exhausted | disabled"
     },
     "activated_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Activated At"
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "password",
     "status",
     "activated_at"
    ],
    "title": "CardItem"
   },
   "CardLimitState": {
    "properties": {
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "expiration | uptime | quota"
     },
     "expires_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expires At"
     },
     "uptime_used_seconds": {
      "type": "integer",
      "title": "Uptime Used Seconds"
     },
     "quota_used_down_bytes": {
      "type": "integer",
      "title": "Quota Used Down Bytes"
     },
     "quota_used_up_bytes": {
      "type": "integer",
      "title": "Quota Used Up Bytes"
     },
     "exhausted": {
      "type": "boolean",
      "title": "Exhausted"
     },
     "exhausted_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Exhausted At"
     }
    },
    "type": "object",
    "required": [
     "kind",
     "expires_at",
     "uptime_used_seconds",
     "quota_used_down_bytes",
     "quota_used_up_bytes",
     "exhausted",
     "exhausted_at"
    ],
    "title": "CardLimitState"
   },
   "CardsCreatedResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id",
      "description": "Card group id"
     },
     "cards_created": {
      "type": "integer",
      "title": "Cards Created"
     }
    },
    "type": "object",
    "required": [
     "id",
     "cards_created"
    ],
    "title": "CardsCreatedResponse"
   },
   "CashAccount": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "name": {
      "type": "string",
      "title": "Name"
     },
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "cash | bank | gateway | other, as set in the panel"
     },
     "is_active": {
      "type": "boolean",
      "title": "Is Active"
     }
    },
    "type": "object",
    "required": [
     "id",
     "name",
     "kind",
     "is_active"
    ],
    "title": "CashAccount"
   },
   "ChangeBody": {
    "properties": {
     "playbook": {
      "type": "string",
      "title": "Playbook",
      "description": "One of GET /routers/playbooks"
     },
     "params": {
      "type": "object",
      "title": "Params",
      "description": "The playbook's parameters"
     },
     "title": {
      "type": "string",
      "maxLength": 200,
      "title": "Title",
      "description": "What it does, in a few words (shown to the admin)",
      "default": ""
     }
    },
    "type": "object",
    "required": [
     "playbook"
    ],
    "title": "ChangeBody"
   },
   "CleanBody": {
    "properties": {
     "preset": {
      "type": "string",
      "title": "Preset",
      "description": "one of: 1w, 1m, 3m, 6m, 12m, all"
     },
     "confirm": {
      "type": "string",
      "title": "Confirm",
      "description": "Must be exactly \"CLEAN\""
     }
    },
    "type": "object",
    "required": [
     "preset",
     "confirm"
    ],
    "title": "CleanBody"
   },
   "CoaOutboxItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Username"
     },
     "action": {
      "type": "string",
      "title": "Action"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "pending | sent | nack | done | failed"
     },
     "attempts": {
      "type": "integer",
      "title": "Attempts"
     },
     "reason": {
      "type": "string",
      "title": "Reason"
     },
     "last_error": {
      "type": "string",
      "title": "Last Error"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "sent_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Sent At"
     },
     "nas_ip": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Nas Ip"
     },
     "nas_name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Nas Name"
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "action",
     "status",
     "attempts",
     "reason",
     "last_error",
     "created_at",
     "sent_at",
     "nas_ip",
     "nas_name"
    ],
    "title": "CoaOutboxItem"
   },
   "CoaQueuedResponse": {
    "properties": {
     "queued": {
      "type": "boolean",
      "title": "Queued",
      "description": "True when CoA request(s) were queued to the outbox"
     },
     "message": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Message"
     }
    },
    "type": "object",
    "required": [
     "queued",
     "message"
    ],
    "title": "CoaQueuedResponse"
   },
   "CollectPayment": {
    "properties": {
     "username": {
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "title": "Username"
     },
     "amount": {
      "type": "string",
      "title": "Amount",
      "description": "Decimal, in the install's currency, e.g. \"10.00\""
     },
     "reference": {
      "type": "string",
      "title": "Reference",
      "description": "The payment app's own transaction id (unique per channel)"
     },
     "channel": {
      "type": "string",
      "title": "Channel",
      "description": "Who collected it, e.g. \"wishmoney\" or \"shamcash\""
     },
     "invoice_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Id",
      "description": "Settle this invoice first (else oldest first)"
     },
     "cash_account_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Cash Account Id",
      "description": "Accounting cash account (default: the first active)"
     }
    },
    "type": "object",
    "required": [
     "username",
     "amount",
     "reference",
     "channel"
    ],
    "title": "CollectPayment"
   },
   "CommandItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "action": {
      "type": "string",
      "title": "Action"
     },
     "target": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Target"
     },
     "applied": {
      "type": "boolean",
      "title": "Applied",
      "description": "False while queued; True once samm-radius applied it"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "applied_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Applied At"
     }
    },
    "type": "object",
    "required": [
     "id",
     "action",
     "target",
     "applied",
     "created_at",
     "applied_at"
    ],
    "title": "CommandItem"
   },
   "CustomFieldsUpdate": {
    "properties": {
     "values": {
      "type": "object",
      "title": "Values",
      "description": "key -> value, using samm.custom_field's own keys (GET /customers/{id} echoes them back as custom_fields). A key left out of this dict keeps its current value; sending null for a key clears it."
     }
    },
    "type": "object",
    "title": "CustomFieldsUpdate"
   },
   "CustomerCreate": {
    "properties": {
     "username": {
      "type": "string",
      "title": "Username",
      "description": "RADIUS login — unique across the install"
     },
     "password": {
      "type": "string",
      "title": "Password",
      "description": "RADIUS password (PAP/CHAP; stored as-is)"
     },
     "firstname": {
      "type": "string",
      "title": "Firstname"
     },
     "lastname": {
      "type": "string",
      "title": "Lastname"
     },
     "mobile": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mobile"
     },
     "address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Address"
     },
     "email": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Email",
      "description": "Used for portal password recovery and email notifications"
     },
     "plan_id": {
      "type": "integer",
      "title": "Plan Id",
      "description": "Plan to subscribe to (see GET /plans)"
     },
     "expiration_date": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Date",
      "description": "Override the first expiration; omit to start a full plan period from now"
     },
     "generate_invoice": {
      "type": "boolean",
      "title": "Generate Invoice",
      "description": "Create the initial plan invoice (plan price)",
      "default": true
     },
     "invoice_due_days": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Due Days",
      "description": "Days until the generated invoice is due; empty = the install's Accounting setting (0 = due on issue)"
     },
     "invoice_mode": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Mode",
      "description": "full | segmented | none — how the period between now and expiration_date is billed. Omit for the pre-4.1 behaviour: a single flat plan-price invoice regardless of expiration_date."
     },
     "invoice_paid": {
      "type": "boolean",
      "title": "Invoice Paid",
      "description": "Settle the generated invoice in full immediately (records a cash payment)",
      "default": false
     },
     "invoice_period_start": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Period Start",
      "description": "Instant the quoted estimate was computed from; ignored if it is not close to now"
     },
     "auto_renew": {
      "type": "boolean",
      "title": "Auto Renew",
      "description": "Renew automatically at expiration instead of expiring",
      "default": false
     },
     "ipoe_circuit_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ipoe Circuit Id",
      "description": "DHCP Option 82 circuit-id (the access port) to authenticate this user by"
     },
     "ipoe_remote_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ipoe Remote Id",
      "description": "DHCP Option 82 remote-id (access node), optional; disambiguates a reused circuit-id"
     },
     "mac_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mac Address",
      "description": "Device MAC for direct-connect IPoE (no Option 82)"
     },
     "framed_ip_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Framed Ip Address",
      "description": "Static IPv4 override (else assigned from the plan's Framed-Pool), e.g. 10.20.0.5"
     },
     "framed_ipv6_prefix": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Framed Ipv6 Prefix",
      "description": "Static IPv6 WAN prefix override (else assigned from the IPv6 pool)"
     },
     "delegated_ipv6_prefix": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Delegated Ipv6 Prefix",
      "description": "Static IPv6 delegated (DHCPv6-PD) prefix override, e.g. 2001:db8:abcd::/56"
     },
     "device_sn": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Device Sn",
      "description": "Admin-only device serial number (never shown to the user)"
     },
     "notes": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Notes",
      "description": "Admin-only free-text notes (never shown to the user)"
     },
     "allowed_nas_ids": {
      "anyOf": [
       {
        "items": {
         "type": "integer"
        },
        "type": "array"
       },
       {
        "type": "null"
       }
      ],
      "title": "Allowed Nas Ids"
     },
     "assigned_admin_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Assigned Admin Id",
      "description": "Admin who owns this user"
     },
     "created_by_admin_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Created By Admin Id"
     },
     "preferred_language": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Preferred Language",
      "description": "Language for this user's notifications (en, ar, tr, ...). Omit to inherit the creating admin's panel language, or the install default."
     }
    },
    "type": "object",
    "required": [
     "username",
     "password",
     "firstname",
     "lastname",
     "plan_id"
    ],
    "title": "CustomerCreate"
   },
   "CustomerListItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "firstname": {
      "type": "string",
      "title": "Firstname"
     },
     "lastname": {
      "type": "string",
      "title": "Lastname"
     },
     "mobile": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mobile"
     },
     "email": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Email"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "active | suspended | expired"
     },
     "plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Plan Id"
     },
     "plan_name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Plan Name"
     },
     "auto_renew": {
      "type": "boolean",
      "title": "Auto Renew",
      "default": false
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "expiration_date": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Date",
      "description": "Current expiry (override, else the expiration limit state)"
     },
     "assigned_admin_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Assigned Admin Id",
      "description": "Admin this user is assigned to"
     },
     "assigned_admin": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Assigned Admin",
      "description": "That admin's username (null if the admin was deleted)"
     },
     "disabled": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Disabled",
      "description": "Admin has disabled this account (blocks auth regardless of status)"
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "firstname",
     "lastname",
     "mobile",
     "email",
     "status",
     "plan_id",
     "plan_name",
     "created_at"
    ],
    "title": "CustomerListItem"
   },
   "CustomerRenewResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "status": {
      "type": "string",
      "title": "Status"
     },
     "new_expiration": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "New Expiration"
     },
     "invoice_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Id",
      "description": "Renewal invoice id, when one was generated"
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "status",
     "new_expiration",
     "invoice_id"
    ],
    "title": "CustomerRenewResponse"
   },
   "CustomerResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "firstname": {
      "type": "string",
      "title": "Firstname"
     },
     "lastname": {
      "type": "string",
      "title": "Lastname"
     },
     "mobile": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mobile"
     },
     "address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Address"
     },
     "email": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Email"
     },
     "status": {
      "type": "string",
      "title": "Status"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "expiration_date": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Date"
     },
     "uptime_budget": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Budget"
     },
     "uptime_used": {
      "type": "integer",
      "title": "Uptime Used"
     },
     "original_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Original Plan Id"
     },
     "upload_used": {
      "type": "integer",
      "title": "Upload Used"
     },
     "download_used": {
      "type": "integer",
      "title": "Download Used"
     },
     "auto_renew": {
      "type": "boolean",
      "title": "Auto Renew",
      "default": false
     },
     "assigned_admin_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Assigned Admin Id",
      "description": "Admin this user is assigned to"
     },
     "disabled": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Disabled",
      "description": "Admin has disabled this account (blocks auth regardless of status)"
     },
     "mac_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mac Address",
      "description": "Device MAC (IPoE identity)"
     },
     "sticky_mac": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Sticky Mac",
      "description": "MAC learned by MAC-sticky; a different dialing MAC is refused"
     },
     "framed_ip_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Framed Ip Address",
      "description": "Static IPv4 override"
     },
     "ipoe_circuit_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ipoe Circuit Id",
      "description": "Option 82 circuit-id"
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "firstname",
     "lastname",
     "mobile",
     "address",
     "status",
     "created_at",
     "expiration_date",
     "uptime_budget",
     "uptime_used",
     "original_plan_id",
     "upload_used",
     "download_used"
    ],
    "title": "CustomerResponse"
   },
   "CustomerStatus": {
    "type": "string",
    "enum": [
     "active",
     "expired",
     "suspended"
    ],
    "title": "CustomerStatus"
   },
   "CustomerUpdate": {
    "properties": {
     "firstname": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Firstname"
     },
     "lastname": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Lastname"
     },
     "mobile": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mobile"
     },
     "address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Address"
     },
     "email": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Email"
     },
     "password": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Password",
      "description": "Set a new RADIUS password"
     },
     "status": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/CustomerStatus"
       },
       {
        "type": "null"
       }
      ],
      "description": "active | suspended | expired"
     },
     "auto_renew": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Auto Renew"
     },
     "ipoe_circuit_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ipoe Circuit Id"
     },
     "ipoe_remote_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ipoe Remote Id"
     },
     "mac_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mac Address"
     },
     "framed_ip_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Framed Ip Address"
     },
     "framed_ipv6_prefix": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Framed Ipv6 Prefix"
     },
     "delegated_ipv6_prefix": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Delegated Ipv6 Prefix"
     },
     "device_sn": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Device Sn"
     },
     "notes": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Notes"
     },
     "allowed_nas_ids": {
      "anyOf": [
       {
        "items": {
         "type": "integer"
        },
        "type": "array"
       },
       {
        "type": "null"
       }
      ],
      "title": "Allowed Nas Ids"
     },
     "expiration_date": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Date",
      "description": "Set the user's expiry to an absolute date/time (ISO 8601, or 'YYYY-MM-DD HH:MM'). Empty string clears it. This is the only way to move an expiry BACKWARDS: /renew and /extend only ever push it forward."
     }
    },
    "type": "object",
    "title": "CustomerUpdate"
   },
   "CustomerUsageResponse": {
    "properties": {
     "customer_id": {
      "type": "integer",
      "title": "Customer Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "today": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/UsageTotals"
       },
       {
        "type": "null"
       }
      ]
     },
     "totals": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/UsageTotals"
       },
       {
        "type": "null"
       }
      ],
      "description": "Non-resettable lifetime totals"
     },
     "limit_state": {
      "items": {
       "$ref": "#/components/schemas/UserLimitState"
      },
      "type": "array",
      "title": "Limit State"
     },
     "sessions": {
      "items": {
       "$ref": "#/components/schemas/SessionHistoryItem"
      },
      "type": "array",
      "title": "Sessions"
     }
    },
    "type": "object",
    "required": [
     "customer_id",
     "username",
     "today",
     "totals",
     "limit_state",
     "sessions"
    ],
    "title": "CustomerUsageResponse"
   },
   "CustomerWithCustomFields": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "firstname": {
      "type": "string",
      "title": "Firstname"
     },
     "lastname": {
      "type": "string",
      "title": "Lastname"
     },
     "mobile": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mobile"
     },
     "address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Address"
     },
     "email": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Email"
     },
     "status": {
      "type": "string",
      "title": "Status"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "expiration_date": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expiration Date"
     },
     "uptime_budget": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Budget"
     },
     "uptime_used": {
      "type": "integer",
      "title": "Uptime Used"
     },
     "original_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Original Plan Id"
     },
     "upload_used": {
      "type": "integer",
      "title": "Upload Used"
     },
     "download_used": {
      "type": "integer",
      "title": "Download Used"
     },
     "auto_renew": {
      "type": "boolean",
      "title": "Auto Renew",
      "default": false
     },
     "assigned_admin_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Assigned Admin Id",
      "description": "Admin this user is assigned to"
     },
     "disabled": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Disabled",
      "description": "Admin has disabled this account (blocks auth regardless of status)"
     },
     "mac_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mac Address",
      "description": "Device MAC (IPoE identity)"
     },
     "sticky_mac": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Sticky Mac",
      "description": "MAC learned by MAC-sticky; a different dialing MAC is refused"
     },
     "framed_ip_address": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Framed Ip Address",
      "description": "Static IPv4 override"
     },
     "ipoe_circuit_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ipoe Circuit Id",
      "description": "Option 82 circuit-id"
     },
     "custom_fields": {
      "type": "object",
      "title": "Custom Fields"
     }
    },
    "type": "object",
    "required": [
     "id",
     "username",
     "firstname",
     "lastname",
     "mobile",
     "address",
     "status",
     "created_at",
     "expiration_date",
     "uptime_budget",
     "uptime_used",
     "original_plan_id",
     "upload_used",
     "download_used"
    ],
    "title": "CustomerWithCustomFields"
   },
   "Discount": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "percent | fixed"
     },
     "value": {
      "type": "string",
      "title": "Value",
      "description": "The percent, or the fixed amount, as given"
     },
     "amount": {
      "type": "string",
      "title": "Amount",
      "description": "Money taken off the invoice"
     },
     "reason": {
      "type": "string",
      "title": "Reason"
     },
     "created_at": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Created At"
     }
    },
    "type": "object",
    "required": [
     "id",
     "kind",
     "value",
     "amount",
     "reason"
    ],
    "title": "Discount"
   },
   "DiscountIn": {
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "percent",
       "fixed"
      ],
      "title": "Kind"
     },
     "value": {
      "type": "string",
      "title": "Value",
      "description": "percent: 0-100 of the invoice total; fixed: an amount",
      "examples": [
       "10"
      ]
     },
     "reason": {
      "type": "string",
      "maxLength": 120,
      "minLength": 1,
      "title": "Reason",
      "description": "Shown on the invoice and the books"
     }
    },
    "type": "object",
    "required": [
     "kind",
     "value",
     "reason"
    ],
    "title": "DiscountIn"
   },
   "DurationType": {
    "type": "string",
    "enum": [
     "calendar",
     "uptime"
    ],
    "title": "DurationType"
   },
   "DurationUnit": {
    "type": "string",
    "enum": [
     "minutes",
     "hours",
     "days",
     "months"
    ],
    "title": "DurationUnit"
   },
   "ExportKindsResponse": {
    "properties": {
     "kinds": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Kinds"
     }
    },
    "type": "object",
    "required": [
     "kinds"
    ],
    "title": "ExportKindsResponse"
   },
   "FeaturesIn": {
    "properties": {
     "parental_enabled": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Parental Enabled",
      "description": "Parental control for this user"
     },
     "vpn_enabled": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Vpn Enabled",
      "description": "VPN through SAMM for this user"
     }
    },
    "type": "object",
    "title": "FeaturesIn"
   },
   "GroupExtend": {
    "properties": {
     "valid_until": {
      "type": "string",
      "format": "date",
      "title": "Valid Until"
     }
    },
    "type": "object",
    "required": [
     "valid_until"
    ],
    "title": "GroupExtend"
   },
   "GuestHandoutItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "passcode": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Passcode",
      "description": "The card username the guest was sent; it is also its password (empty when the card is gone)"
     },
     "name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Name",
      "description": "As typed by the guest — untrusted text"
     },
     "contact": {
      "type": "string",
      "title": "Contact",
      "description": "Mobile in E.164, or email — whichever they registered with"
     },
     "contact_kind": {
      "type": "string",
      "title": "Contact Kind",
      "description": "mobile | email"
     },
     "channel": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Channel",
      "description": "Channel the passcode was handed to: sms | whatsapp | email | telegram"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "issued (queued for delivery) | sent | failed | void"
     },
     "delivery": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Delivery",
      "description": "The notification's own status (queued | sending | delivered | failed | …), null once its outbox row has been purged"
     },
     "card_status": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Card Status",
      "description": "unused | active | exhausted | disabled (empty when the card is gone)"
     },
     "valid_now": {
      "type": "boolean",
      "title": "Valid Now",
      "description": "True when the passcode can still be used to get online"
     },
     "issued_at": {
      "type": "string",
      "format": "date-time",
      "title": "Issued At"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time",
      "title": "Expires At"
     },
     "cooldown_until": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Cooldown Until",
      "description": "This contact may not register again before this moment"
     },
     "calling_station_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Calling Station Id",
      "description": "Guest MAC as reported by the router"
     },
     "nas_ip": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Nas Ip"
     },
     "locale": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Locale"
     },
     "detail": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Detail",
      "description": "Why a delivery failed, when it did"
     }
    },
    "type": "object",
    "required": [
     "id",
     "name",
     "contact",
     "contact_kind",
     "status",
     "delivery",
     "valid_now",
     "issued_at",
     "expires_at",
     "cooldown_until",
     "calling_station_id",
     "nas_ip",
     "locale",
     "detail"
    ],
    "title": "GuestHandoutItem"
   },
   "HTTPValidationError": {
    "properties": {
     "detail": {
      "items": {
       "$ref": "#/components/schemas/ValidationError"
      },
      "type": "array",
      "title": "Detail"
     }
    },
    "type": "object",
    "title": "HTTPValidationError"
   },
   "InvoiceCreate": {
    "properties": {
     "customer_id": {
      "type": "integer",
      "title": "Customer Id"
     },
     "plan_id": {
      "type": "integer",
      "title": "Plan Id",
      "description": "Plan the invoice line refers to"
     },
     "amount": {
      "type": "number",
      "title": "Amount",
      "description": "Invoice total; use the plan price for a standard plan invoice"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description",
      "description": "Free-text line description shown on the invoice/PDF"
     },
     "due_days": {
      "type": "integer",
      "minimum": 1.0,
      "title": "Due Days",
      "description": "Due date offset from today",
      "default": 7
     }
    },
    "type": "object",
    "required": [
     "customer_id",
     "plan_id",
     "amount"
    ],
    "title": "InvoiceCreate"
   },
   "InvoiceDetailResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "invoice_no": {
      "type": "string",
      "title": "Invoice No"
     },
     "user_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "User Id"
     },
     "reseller_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Reseller Id"
     },
     "plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Plan Id"
     },
     "card_group_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Card Group Id"
     },
     "party": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Party",
      "description": "Billed party display name"
     },
     "party_kind": {
      "type": "string",
      "title": "Party Kind",
      "description": "customer | reseller"
     },
     "subtotal": {
      "type": "number",
      "title": "Subtotal"
     },
     "tax_rate": {
      "type": "number",
      "title": "Tax Rate"
     },
     "tax_amount": {
      "type": "number",
      "title": "Tax Amount"
     },
     "total": {
      "type": "number",
      "title": "Total"
     },
     "status": {
      "type": "string",
      "title": "Status"
     },
     "issued_at": {
      "type": "string",
      "format": "date-time",
      "title": "Issued At"
     },
     "due_date": {
      "type": "string",
      "format": "date-time",
      "title": "Due Date"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     },
     "created_by": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Created By"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/InvoiceLineItem"
      },
      "type": "array",
      "title": "Items"
     },
     "payments": {
      "items": {
       "$ref": "#/components/schemas/InvoicePaymentItem"
      },
      "type": "array",
      "title": "Payments"
     },
     "paid": {
      "type": "number",
      "title": "Paid"
     },
     "outstanding": {
      "type": "number",
      "title": "Outstanding"
     },
     "off_ledger": {
      "type": "boolean",
      "title": "Off Ledger",
      "description": "True for an agent's retail invoice: the user owes the AGENT, not the company. It has no journal entry, so its balance comes from the agent's own collections and it must not be summed with ordinary invoices as company revenue.",
      "default": false
     },
     "discount_total": {
      "type": "number",
      "title": "Discount Total",
      "description": "Sum of live discounts on this invoice",
      "default": 0
     },
     "discounts": {
      "items": {
       "type": "object"
      },
      "type": "array",
      "title": "Discounts",
      "description": "Live discounts: id, kind, value, amount, reason"
     }
    },
    "type": "object",
    "required": [
     "id",
     "invoice_no",
     "user_id",
     "reseller_id",
     "plan_id",
     "card_group_id",
     "party",
     "party_kind",
     "subtotal",
     "tax_rate",
     "tax_amount",
     "total",
     "status",
     "issued_at",
     "due_date",
     "description",
     "created_by",
     "created_at",
     "items",
     "payments",
     "paid",
     "outstanding"
    ],
    "title": "InvoiceDetailResponse"
   },
   "InvoiceLineItem": {
    "properties": {
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     },
     "qty": {
      "type": "number",
      "title": "Qty"
     },
     "unit_price": {
      "type": "number",
      "title": "Unit Price"
     },
     "line_total": {
      "type": "number",
      "title": "Line Total"
     }
    },
    "type": "object",
    "required": [
     "description",
     "qty",
     "unit_price",
     "line_total"
    ],
    "title": "InvoiceLineItem"
   },
   "InvoiceListItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "invoice_no": {
      "type": "string",
      "title": "Invoice No"
     },
     "customer_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Customer Id"
     },
     "username": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Username"
     },
     "plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Plan Id"
     },
     "total": {
      "type": "number",
      "title": "Total"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "paid | unpaid | due"
     },
     "issued_at": {
      "type": "string",
      "format": "date-time",
      "title": "Issued At"
     },
     "due_date": {
      "type": "string",
      "format": "date-time",
      "title": "Due Date"
     },
     "paid_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Paid At"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     },
     "off_ledger": {
      "type": "boolean",
      "title": "Off Ledger",
      "description": "True for an agent's retail invoice: the user owes the AGENT, not the company. It carries no journal entry, so summing it with ordinary invoices double-counts revenue the company already recognised on the wholesale sale.",
      "default": false
     }
    },
    "type": "object",
    "required": [
     "id",
     "invoice_no",
     "customer_id",
     "username",
     "plan_id",
     "total",
     "status",
     "issued_at",
     "due_date",
     "paid_at",
     "description"
    ],
    "title": "InvoiceListItem"
   },
   "InvoiceMoney": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "invoice_no": {
      "type": "string",
      "title": "Invoice No"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "unpaid | due | partial | paid | discounted | written_off"
     },
     "total": {
      "type": "string",
      "title": "Total"
     },
     "paid": {
      "type": "string",
      "title": "Paid",
      "description": "Money received (cash, wallet, gateway)"
     },
     "discount": {
      "type": "string",
      "title": "Discount",
      "description": "Sum of live discounts"
     },
     "outstanding": {
      "type": "string",
      "title": "Outstanding",
      "description": "total - paid - discount"
     },
     "discounts": {
      "items": {
       "$ref": "#/components/schemas/Discount"
      },
      "type": "array",
      "title": "Discounts"
     }
    },
    "type": "object",
    "required": [
     "id",
     "invoice_no",
     "status",
     "total",
     "paid",
     "discount",
     "outstanding",
     "discounts"
    ],
    "title": "InvoiceMoney"
   },
   "InvoicePaidResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "status": {
      "type": "string",
      "title": "Status"
     },
     "paid_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Paid At"
     }
    },
    "type": "object",
    "required": [
     "id",
     "status",
     "paid_at"
    ],
    "title": "InvoicePaidResponse"
   },
   "InvoicePaymentItem": {
    "properties": {
     "entry_id": {
      "type": "integer",
      "title": "Entry Id"
     },
     "entry_no": {
      "type": "string",
      "title": "Entry No"
     },
     "entry_date": {
      "type": "string",
      "format": "date",
      "title": "Entry Date"
     },
     "amount": {
      "type": "number",
      "title": "Amount"
     },
     "cash_account": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Cash Account"
     },
     "gateway": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Gateway"
     },
     "method": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Method",
      "description": "Gateway label, cash/bank account, or wallet"
     },
     "voided": {
      "type": "boolean",
      "title": "Voided"
     },
     "created_by": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Created By"
     }
    },
    "type": "object",
    "required": [
     "entry_id",
     "entry_no",
     "entry_date",
     "amount",
     "cash_account",
     "gateway",
     "method",
     "voided",
     "created_by"
    ],
    "title": "InvoicePaymentItem"
   },
   "InvoiceStatusResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "status": {
      "type": "string",
      "title": "Status"
     }
    },
    "type": "object",
    "required": [
     "id",
     "status"
    ],
    "title": "InvoiceStatusResponse"
   },
   "JobStart": {
    "properties": {
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "One of GET /routers/jobs/kinds"
     },
     "nas_ids": {
      "items": {
       "type": "integer"
      },
      "type": "array",
      "minItems": 1,
      "title": "Nas Ids"
     },
     "params": {
      "type": "object",
      "title": "Params"
     }
    },
    "type": "object",
    "required": [
     "kind",
     "nas_ids"
    ],
    "title": "JobStart"
   },
   "L2tpCreate": {
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "title": "Name"
     },
     "notes": {
      "type": "string",
      "maxLength": 500,
      "title": "Notes",
      "default": ""
     },
     "add_as_router": {
      "anyOf": [
       {
        "type": "string",
        "pattern": "^(nas|monitor)$"
       },
       {
        "type": "null"
       }
      ],
      "title": "Add As Router",
      "description": "Also add this client as a managed router at its tunnel address, same as the panel's 'Managed Router (NAS)' radio on Add Client: 'nas' (RADIUS + API) or 'monitor' (API only, no RADIUS). Omit to add neither."
     }
    },
    "type": "object",
    "required": [
     "name"
    ],
    "title": "L2tpCreate"
   },
   "LimitationType": {
    "type": "string",
    "enum": [
     "expiration",
     "uptime",
     "quota",
     "daily"
    ],
    "title": "LimitationType"
   },
   "ListResponse_CardGroupListItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/CardGroupListItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[CardGroupListItem]"
   },
   "ListResponse_CardItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/CardItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[CardItem]"
   },
   "ListResponse_CoaOutboxItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/CoaOutboxItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[CoaOutboxItem]"
   },
   "ListResponse_CommandItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/CommandItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[CommandItem]"
   },
   "ListResponse_CustomerListItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/CustomerListItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[CustomerListItem]"
   },
   "ListResponse_GuestHandoutItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/GuestHandoutItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[GuestHandoutItem]"
   },
   "ListResponse_InvoiceListItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/InvoiceListItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[InvoiceListItem]"
   },
   "ListResponse_NetFindingItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/NetFindingItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[NetFindingItem]"
   },
   "ListResponse_NetHealthItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/NetHealthItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[NetHealthItem]"
   },
   "ListResponse_RouterItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/RouterItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[RouterItem]"
   },
   "ListResponse_SessionItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/SessionItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[SessionItem]"
   },
   "ListResponse_WebhookEndpointItem_": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/WebhookEndpointItem"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "total",
     "items"
    ],
    "title": "ListResponse[WebhookEndpointItem]"
   },
   "MeResponse": {
    "properties": {
     "token_id": {
      "type": "integer",
      "title": "Token Id"
     },
     "name": {
      "type": "string",
      "title": "Name"
     },
     "scopes": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Scopes",
      "description": "Effective scopes (write expands to read)"
     },
     "rate_limit_per_min": {
      "type": "integer",
      "title": "Rate Limit Per Min"
     },
     "server_version": {
      "type": "string",
      "title": "Server Version"
     }
    },
    "type": "object",
    "required": [
     "token_id",
     "name",
     "scopes",
     "rate_limit_per_min",
     "server_version"
    ],
    "title": "MeResponse"
   },
   "NetEdgeItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "a_node_id": {
      "type": "integer",
      "title": "A Node Id"
     },
     "b_node_id": {
      "type": "integer",
      "title": "B Node Id"
     },
     "a_iface": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "A Iface"
     },
     "b_iface": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "B Iface"
     },
     "source": {
      "type": "string",
      "title": "Source",
      "description": "How the link was seen — neighbour discovery, routing adjacency, or bridging"
     },
     "confidence": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Confidence",
      "description": "0-100. Two routers naming each other over neighbour discovery scores higher than one inferred from a shared subnet"
     },
     "status": {
      "type": "string",
      "title": "Status"
     },
     "first_seen": {
      "type": "string",
      "format": "date-time",
      "title": "First Seen"
     },
     "last_seen": {
      "type": "string",
      "format": "date-time",
      "title": "Last Seen"
     }
    },
    "type": "object",
    "required": [
     "id",
     "a_node_id",
     "b_node_id",
     "a_iface",
     "b_iface",
     "source",
     "confidence",
     "status",
     "first_seen",
     "last_seen"
    ],
    "title": "NetEdgeItem"
   },
   "NetFindingItem": {
    "properties": {
     "nas_id": {
      "type": "integer",
      "title": "Nas Id"
     },
     "label": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Label"
     },
     "finding_key": {
      "type": "string",
      "title": "Finding Key",
      "description": "Stable key — the same problem keeps the same key across passes"
     },
     "kind": {
      "type": "string",
      "title": "Kind"
     },
     "severity": {
      "type": "string",
      "title": "Severity",
      "description": "critical | important | minor"
     },
     "reason": {
      "type": "string",
      "title": "Reason"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "open | resolved"
     },
     "first_seen": {
      "type": "string",
      "format": "date-time",
      "title": "First Seen"
     },
     "last_seen": {
      "type": "string",
      "format": "date-time",
      "title": "Last Seen"
     },
     "resolved_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Resolved At"
     },
     "detail": {
      "anyOf": [
       {
        "type": "object"
       },
       {
        "type": "null"
       }
      ],
      "title": "Detail"
     }
    },
    "type": "object",
    "required": [
     "nas_id",
     "label",
     "finding_key",
     "kind",
     "severity",
     "reason",
     "status",
     "first_seen",
     "last_seen",
     "resolved_at",
     "detail"
    ],
    "title": "NetFindingItem"
   },
   "NetHealthItem": {
    "properties": {
     "nas_id": {
      "type": "integer",
      "title": "Nas Id"
     },
     "label": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Label"
     },
     "identity": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Identity"
     },
     "model": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Model"
     },
     "routeros_version": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Routeros Version"
     },
     "mgmt_host": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Mgmt Host"
     },
     "state": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "State",
      "description": "down (unreachable) | fault (answering but broken) | warn | ok | null (never checked)"
     },
     "score": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Score",
      "description": "0-100, worst finding weighted"
     },
     "reachable": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Reachable"
     },
     "checked_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Checked At"
     },
     "critical": {
      "type": "integer",
      "title": "Critical"
     },
     "important": {
      "type": "integer",
      "title": "Important"
     },
     "worst_reason": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Worst Reason"
     },
     "wan_ifaces": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Wan Ifaces",
      "description": "Every interface that reaches the internet, primary first"
     }
    },
    "type": "object",
    "required": [
     "nas_id",
     "label",
     "identity",
     "model",
     "routeros_version",
     "mgmt_host",
     "state",
     "score",
     "reachable",
     "checked_at",
     "critical",
     "important",
     "worst_reason",
     "wan_ifaces"
    ],
    "title": "NetHealthItem"
   },
   "NetNodeItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "node_key": {
      "type": "string",
      "title": "Node Key"
     },
     "nas_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Nas Id",
      "description": "Null for a discovered device SAMM does not manage"
     },
     "kind": {
      "type": "string",
      "title": "Kind"
     },
     "identity": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Identity"
     },
     "platform": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Platform"
     },
     "board": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Board"
     },
     "version": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Version"
     },
     "vendor": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Vendor"
     },
     "primary_mac": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Primary Mac"
     },
     "primary_ipv4": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Primary Ipv4"
     },
     "hidden": {
      "type": "boolean",
      "title": "Hidden"
     },
     "adopted": {
      "type": "boolean",
      "title": "Adopted",
      "description": "Discovered device since added to SAMM"
     },
     "first_seen": {
      "type": "string",
      "format": "date-time",
      "title": "First Seen"
     },
     "last_seen": {
      "type": "string",
      "format": "date-time",
      "title": "Last Seen"
     }
    },
    "type": "object",
    "required": [
     "id",
     "node_key",
     "nas_id",
     "kind",
     "identity",
     "platform",
     "board",
     "version",
     "vendor",
     "primary_mac",
     "primary_ipv4",
     "hidden",
     "adopted",
     "first_seen",
     "last_seen"
    ],
    "title": "NetNodeItem"
   },
   "NetTopologyResponse": {
    "properties": {
     "nodes": {
      "items": {
       "$ref": "#/components/schemas/NetNodeItem"
      },
      "type": "array",
      "title": "Nodes"
     },
     "edges": {
      "items": {
       "$ref": "#/components/schemas/NetEdgeItem"
      },
      "type": "array",
      "title": "Edges"
     }
    },
    "type": "object",
    "required": [
     "nodes",
     "edges"
    ],
    "title": "NetTopologyResponse"
   },
   "PaymentIn": {
    "properties": {
     "amount": {
      "type": "string",
      "title": "Amount",
      "description": "Decimal string, e.g. \"10.00\"",
      "examples": [
       "10.00"
      ]
     },
     "cash_account_id": {
      "type": "integer",
      "title": "Cash Account Id",
      "description": "Where the money landed: GET /cash-accounts"
     },
     "occurred_at": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Occurred At",
      "description": "YYYY-MM-DD; today when omitted"
     },
     "memo": {
      "anyOf": [
       {
        "type": "string",
        "maxLength": 200
       },
       {
        "type": "null"
       }
      ],
      "title": "Memo"
     },
     "overpay_to_wallet": {
      "type": "boolean",
      "title": "Overpay To Wallet",
      "description": "More than owed: false caps the payment at what is owed; true books the surplus as wallet credit",
      "default": false
     }
    },
    "type": "object",
    "required": [
     "amount",
     "cash_account_id"
    ],
    "title": "PaymentIn"
   },
   "PaymentOut": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "invoice_no": {
      "type": "string",
      "title": "Invoice No"
     },
     "status": {
      "type": "string",
      "title": "Status",
      "description": "unpaid | due | partial | paid | discounted | written_off"
     },
     "total": {
      "type": "string",
      "title": "Total"
     },
     "paid": {
      "type": "string",
      "title": "Paid",
      "description": "Money received (cash, wallet, gateway)"
     },
     "discount": {
      "type": "string",
      "title": "Discount",
      "description": "Sum of live discounts"
     },
     "outstanding": {
      "type": "string",
      "title": "Outstanding",
      "description": "total - paid - discount"
     },
     "discounts": {
      "items": {
       "$ref": "#/components/schemas/Discount"
      },
      "type": "array",
      "title": "Discounts"
     },
     "entry_id": {
      "type": "integer",
      "title": "Entry Id",
      "description": "The journal entry of this payment"
     }
    },
    "type": "object",
    "required": [
     "id",
     "invoice_no",
     "status",
     "total",
     "paid",
     "discount",
     "outstanding",
     "discounts",
     "entry_id"
    ],
    "title": "PaymentOut"
   },
   "PlanCreate": {
    "properties": {
     "name": {
      "type": "string",
      "title": "Name"
     },
     "download_speed": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Download Speed",
      "description": "MikroTik rate string: `8M`, `512k`"
     },
     "upload_speed": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Upload Speed",
      "description": "MikroTik rate string: `2M`, `256k`"
     },
     "duration_type": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/DurationType"
       },
       {
        "type": "null"
       }
      ]
     },
     "duration_value": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Duration Value"
     },
     "duration_unit": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/DurationUnit"
       },
       {
        "type": "null"
       }
      ]
     },
     "uptime_value": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Value"
     },
     "uptime_unit": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/DurationUnit"
       },
       {
        "type": "null"
       }
      ]
     },
     "unlimited_from": {
      "anyOf": [
       {
        "type": "string",
        "format": "time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited From"
     },
     "unlimited_to": {
      "anyOf": [
       {
        "type": "string",
        "format": "time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited To"
     },
     "unlimited_download": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited Download"
     },
     "unlimited_upload": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited Upload"
     },
     "daily_traffic_limit": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Traffic Limit"
     },
     "daily_limit_type": {
      "type": "string",
      "title": "Daily Limit Type",
      "default": "combined"
     },
     "max_transfer": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Max Transfer"
     },
     "max_transfer_type": {
      "type": "string",
      "title": "Max Transfer Type",
      "default": "combined"
     },
     "pool_name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Pool Name"
     },
     "next_expiry_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Expiry Plan Id"
     },
     "next_traffic_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Traffic Plan Id"
     },
     "next_uptime_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Uptime Plan Id"
     },
     "next_daily_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Daily Plan Id"
     },
     "daily_throttle_down": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Throttle Down"
     },
     "daily_throttle_up": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Throttle Up"
     },
     "price": {
      "type": "number",
      "minimum": 0.0,
      "title": "Price",
      "default": 0
     },
     "enabled": {
      "type": "boolean",
      "title": "Enabled",
      "default": true
     },
     "auto_renew": {
      "type": "boolean",
      "title": "Auto Renew",
      "default": false
     }
    },
    "type": "object",
    "required": [
     "name"
    ],
    "title": "PlanCreate"
   },
   "PlanResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "name": {
      "type": "string",
      "title": "Name"
     },
     "download_speed": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Download Speed"
     },
     "upload_speed": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Upload Speed"
     },
     "duration_type": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Duration Type"
     },
     "duration_value": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Duration Value"
     },
     "duration_unit": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Duration Unit"
     },
     "uptime_value": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Value"
     },
     "uptime_unit": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Unit"
     },
     "unlimited_from": {
      "anyOf": [
       {
        "type": "string",
        "format": "time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited From"
     },
     "unlimited_to": {
      "anyOf": [
       {
        "type": "string",
        "format": "time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited To"
     },
     "unlimited_download": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited Download"
     },
     "unlimited_upload": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited Upload"
     },
     "daily_traffic_limit": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Traffic Limit"
     },
     "daily_limit_type": {
      "type": "string",
      "title": "Daily Limit Type",
      "default": "combined"
     },
     "max_transfer": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Max Transfer"
     },
     "max_transfer_type": {
      "type": "string",
      "title": "Max Transfer Type",
      "default": "combined"
     },
     "pool_name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Pool Name"
     },
     "next_expiry_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Expiry Plan Id"
     },
     "next_traffic_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Traffic Plan Id"
     },
     "next_uptime_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Uptime Plan Id"
     },
     "next_daily_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Daily Plan Id"
     },
     "price": {
      "type": "number",
      "title": "Price",
      "default": 0
     },
     "enabled": {
      "type": "boolean",
      "title": "Enabled",
      "default": true
     },
     "auto_renew": {
      "type": "boolean",
      "title": "Auto Renew",
      "default": false
     },
     "max_sessions": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Max Sessions",
      "description": "Concurrent sessions allowed (0 = unlimited)"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     }
    },
    "type": "object",
    "required": [
     "id",
     "name",
     "created_at"
    ],
    "title": "PlanResponse"
   },
   "PlanUpdate": {
    "properties": {
     "name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Name"
     },
     "download_speed": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Download Speed"
     },
     "upload_speed": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Upload Speed"
     },
     "duration_type": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/DurationType"
       },
       {
        "type": "null"
       }
      ]
     },
     "duration_value": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Duration Value"
     },
     "duration_unit": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/DurationUnit"
       },
       {
        "type": "null"
       }
      ]
     },
     "clear_expiry": {
      "type": "boolean",
      "title": "Clear Expiry",
      "default": false
     },
     "uptime_value": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Uptime Value"
     },
     "uptime_unit": {
      "anyOf": [
       {
        "$ref": "#/components/schemas/DurationUnit"
       },
       {
        "type": "null"
       }
      ]
     },
     "clear_uptime": {
      "type": "boolean",
      "title": "Clear Uptime",
      "default": false
     },
     "unlimited_from": {
      "anyOf": [
       {
        "type": "string",
        "format": "time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited From"
     },
     "unlimited_to": {
      "anyOf": [
       {
        "type": "string",
        "format": "time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited To"
     },
     "unlimited_download": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited Download"
     },
     "unlimited_upload": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Unlimited Upload"
     },
     "clear_unlimited": {
      "type": "boolean",
      "title": "Clear Unlimited",
      "default": false
     },
     "daily_traffic_limit": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Traffic Limit"
     },
     "clear_daily_limit": {
      "type": "boolean",
      "title": "Clear Daily Limit",
      "default": false
     },
     "daily_limit_type": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Limit Type"
     },
     "max_transfer": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Max Transfer"
     },
     "max_transfer_type": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Max Transfer Type"
     },
     "clear_max_transfer": {
      "type": "boolean",
      "title": "Clear Max Transfer",
      "default": false
     },
     "pool_name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Pool Name"
     },
     "clear_pool": {
      "type": "boolean",
      "title": "Clear Pool",
      "default": false
     },
     "next_expiry_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Expiry Plan Id"
     },
     "next_traffic_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Traffic Plan Id"
     },
     "next_uptime_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Uptime Plan Id"
     },
     "next_daily_plan_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Next Daily Plan Id"
     },
     "daily_throttle_down": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Throttle Down"
     },
     "daily_throttle_up": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Throttle Up"
     },
     "price": {
      "anyOf": [
       {
        "type": "number",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Price"
     },
     "enabled": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Enabled"
     },
     "auto_renew": {
      "anyOf": [
       {
        "type": "boolean"
       },
       {
        "type": "null"
       }
      ],
      "title": "Auto Renew"
     }
    },
    "type": "object",
    "title": "PlanUpdate"
   },
   "ProbeBody": {
    "properties": {
     "survey": {
      "type": "boolean",
      "title": "Survey",
      "description": "Also run the site survey. Takes the radio OFF AIR for a few seconds (clients reconnect); needs `routers:write`.",
      "default": false
     }
    },
    "type": "object",
    "title": "ProbeBody"
   },
   "QueueBacklog": {
    "properties": {
     "coa_pending": {
      "type": "integer",
      "title": "Coa Pending"
     },
     "commands_pending": {
      "type": "integer",
      "title": "Commands Pending"
     },
     "webhooks_pending": {
      "type": "integer",
      "title": "Webhooks Pending"
     }
    },
    "type": "object",
    "required": [
     "coa_pending",
     "commands_pending",
     "webhooks_pending"
    ],
    "title": "QueueBacklog"
   },
   "QueuedActionResponse": {
    "properties": {
     "queued": {
      "type": "boolean",
      "title": "Queued"
     },
     "action": {
      "type": "string",
      "title": "Action"
     }
    },
    "type": "object",
    "required": [
     "queued",
     "action"
    ],
    "title": "QueuedActionResponse"
   },
   "QueuedCardActionResponse": {
    "properties": {
     "queued": {
      "type": "boolean",
      "title": "Queued"
     },
     "action": {
      "type": "string",
      "title": "Action"
     },
     "username": {
      "type": "string",
      "title": "Username"
     }
    },
    "type": "object",
    "required": [
     "queued",
     "action",
     "username"
    ],
    "title": "QueuedCardActionResponse"
   },
   "QueuedExtendResponse": {
    "properties": {
     "queued": {
      "type": "boolean",
      "title": "Queued"
     },
     "valid_until": {
      "type": "string",
      "title": "Valid Until"
     }
    },
    "type": "object",
    "required": [
     "queued",
     "valid_until"
    ],
    "title": "QueuedExtendResponse"
   },
   "QueuedNoteResponse": {
    "properties": {
     "queued": {
      "type": "boolean",
      "title": "Queued"
     },
     "note": {
      "type": "string",
      "title": "Note"
     }
    },
    "type": "object",
    "required": [
     "queued",
     "note"
    ],
    "title": "QueuedNoteResponse"
   },
   "QueuedResetResponse": {
    "properties": {
     "queued": {
      "type": "boolean",
      "title": "Queued"
     },
     "limitation_type": {
      "type": "string",
      "title": "Limitation Type"
     },
     "note": {
      "type": "string",
      "title": "Note"
     }
    },
    "type": "object",
    "required": [
     "queued",
     "limitation_type",
     "note"
    ],
    "title": "QueuedResetResponse"
   },
   "ReachIn": {
    "properties": {
     "network": {
      "type": "string",
      "title": "Network",
      "description": "The network behind the router, e.g. 192.168.88.0/24"
     },
     "note": {
      "type": "string",
      "maxLength": 200,
      "title": "Note",
      "default": ""
     }
    },
    "type": "object",
    "required": [
     "network"
    ],
    "title": "ReachIn"
   },
   "RenameBody": {
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "title": "Name"
     }
    },
    "type": "object",
    "required": [
     "name"
    ],
    "title": "RenameBody"
   },
   "RenewLimitationRequest": {
    "properties": {
     "limitation_type": {
      "$ref": "#/components/schemas/LimitationType",
      "description": "Which counter to reset: quota | daily | uptime | expiration"
     },
     "generate_invoice": {
      "type": "boolean",
      "title": "Generate Invoice",
      "description": "Create an invoice when resetting the expiration of a priced plan",
      "default": true
     },
     "invoice_due_days": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Invoice Due Days"
     }
    },
    "type": "object",
    "required": [
     "limitation_type"
    ],
    "title": "RenewLimitationRequest"
   },
   "RestoreBody": {
    "properties": {
     "confirm": {
      "type": "string",
      "title": "Confirm",
      "description": "Must be exactly \"RESTORE\""
     }
    },
    "type": "object",
    "required": [
     "confirm"
    ],
    "title": "RestoreBody"
   },
   "RosAction": {
    "properties": {
     "path": {
      "type": "string",
      "title": "Path",
      "description": "Menu, e.g. ppp/secret, ip/firewall/nat"
     },
     "action": {
      "type": "string",
      "enum": [
       "add",
       "set",
       "remove",
       "enable",
       "disable"
      ],
      "title": "Action"
     },
     "id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Id",
      "description": "The item's .id (like *1A); or use match"
     },
     "match": {
      "additionalProperties": {
       "type": "string"
      },
      "type": "object",
      "title": "Match",
      "description": "Pick the item by exact values instead of .id, e.g. {\"name\": \"A002\"}"
     },
     "values": {
      "type": "object",
      "title": "Values",
      "description": "Properties for add / set"
     },
     "reason": {
      "type": "string",
      "maxLength": 300,
      "minLength": 3,
      "title": "Reason",
      "description": "Why - kept in the Admin Log"
     },
     "dry_run": {
      "type": "boolean",
      "title": "Dry Run",
      "description": "Show what would change, change nothing",
      "default": false
     }
    },
    "type": "object",
    "required": [
     "path",
     "action",
     "reason"
    ],
    "title": "RosAction"
   },
   "RosScript": {
    "properties": {
     "source": {
      "type": "string",
      "maxLength": 20000,
      "minLength": 1,
      "title": "Source",
      "description": "RouterOS script, exactly as typed in the terminal"
     },
     "reason": {
      "type": "string",
      "maxLength": 300,
      "minLength": 3,
      "title": "Reason",
      "description": "Why - kept in the Admin Log"
     }
    },
    "type": "object",
    "required": [
     "source",
     "reason"
    ],
    "title": "RosScript"
   },
   "RouterDetail": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "nas | monitor"
     },
     "host": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Host"
     },
     "name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Name"
     },
     "type": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Type"
     },
     "identity": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Identity"
     },
     "model": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Model"
     },
     "routeros_version": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Routeros Version"
     },
     "coa_port": {
      "type": "integer",
      "title": "Coa Port"
     },
     "ping": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ping",
      "description": "ok | fail | null (never pinged)"
     },
     "last_ping_ms": {
      "anyOf": [
       {
        "type": "number"
       },
       {
        "type": "null"
       }
      ],
      "title": "Last Ping Ms"
     },
     "last_ping_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Last Ping At"
     },
     "state": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "State"
     },
     "score": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Score"
     },
     "checked_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Checked At"
     },
     "open_findings": {
      "type": "integer",
      "title": "Open Findings"
     },
     "uplinks": {
      "items": {
       "$ref": "#/components/schemas/UplinkItem"
      },
      "type": "array",
      "title": "Uplinks"
     }
    },
    "type": "object",
    "required": [
     "id",
     "kind",
     "host",
     "name",
     "type",
     "identity",
     "model",
     "routeros_version",
     "coa_port",
     "ping",
     "last_ping_ms",
     "last_ping_at",
     "state",
     "score",
     "checked_at",
     "open_findings",
     "uplinks"
    ],
    "title": "RouterDetail"
   },
   "RouterItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "nas | monitor"
     },
     "host": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Host"
     },
     "name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Name"
     },
     "type": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Type"
     },
     "identity": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Identity"
     },
     "model": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Model"
     },
     "routeros_version": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Routeros Version"
     },
     "coa_port": {
      "type": "integer",
      "title": "Coa Port"
     },
     "ping": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Ping",
      "description": "ok | fail | null (never pinged)"
     },
     "last_ping_ms": {
      "anyOf": [
       {
        "type": "number"
       },
       {
        "type": "null"
       }
      ],
      "title": "Last Ping Ms"
     },
     "last_ping_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Last Ping At"
     }
    },
    "type": "object",
    "required": [
     "id",
     "kind",
     "host",
     "name",
     "type",
     "identity",
     "model",
     "routeros_version",
     "coa_port",
     "ping",
     "last_ping_ms",
     "last_ping_at"
    ],
    "title": "RouterItem"
   },
   "RouterReachability": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "reachable": {
      "type": "integer",
      "title": "Reachable",
      "description": "Routers whose last ping succeeded"
     }
    },
    "type": "object",
    "required": [
     "total",
     "reachable"
    ],
    "title": "RouterReachability"
   },
   "ScheduleIn": {
    "properties": {
     "title": {
      "type": "string",
      "maxLength": 120,
      "title": "Title",
      "description": "Short name, e.g. 'Morning expiry report'"
     },
     "prompt": {
      "type": "string",
      "maxLength": 2000,
      "title": "Prompt",
      "description": "What SCOOP AI should do or report each time"
     },
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "once | daily | weekly | every"
     },
     "at_time": {
      "type": "string",
      "title": "At Time",
      "description": "HH:MM in the install's local time (daily, weekly)",
      "default": "08:00"
     },
     "weekday": {
      "anyOf": [
       {
        "type": "integer",
        "maximum": 6.0,
        "minimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Weekday",
      "description": "0 = Monday (weekly)"
     },
     "every_minutes": {
      "anyOf": [
       {
        "type": "integer",
        "minimum": 15.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Every Minutes",
      "description": "For kind=every, at least 15"
     },
     "run_at": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Run At",
      "description": "For kind=once: date and time, e.g. 2026-11-07T09:00"
     }
    },
    "type": "object",
    "required": [
     "title",
     "prompt",
     "kind"
    ],
    "title": "ScheduleIn"
   },
   "SelfServiceCounters": {
    "properties": {
     "live": {
      "type": "integer",
      "title": "Live",
      "description": "Passcodes valid right now"
     },
     "online": {
      "type": "integer",
      "title": "Online",
      "description": "Guests with a live session on one of them"
     },
     "failed": {
      "type": "integer",
      "title": "Failed",
      "description": "Handouts that reached nobody"
     },
     "people": {
      "type": "integer",
      "title": "People",
      "description": "Distinct contacts ever issued a passcode"
     },
     "total": {
      "type": "integer",
      "title": "Total",
      "description": "Handouts on record"
     }
    },
    "type": "object",
    "required": [
     "live",
     "online",
     "failed",
     "people",
     "total"
    ],
    "title": "SelfServiceCounters"
   },
   "SelfServiceLicence": {
    "properties": {
     "unlimited": {
      "type": "boolean",
      "title": "Unlimited",
      "description": "True on Self Service Max — `allowance` and `remaining` are then null"
     },
     "allowance": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Allowance",
      "description": "Passcodes this install may issue per day; null = unlimited"
     },
     "used": {
      "type": "integer",
      "title": "Used",
      "description": "Slots claimed in the current day (issued/sent handouts + registrations still in flight)"
     },
     "remaining": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Remaining",
      "description": "allowance - used, floored at 0; null = unlimited"
     },
     "at_cap": {
      "type": "boolean",
      "title": "At Cap",
      "description": "True while further registrations are being refused on rate"
     },
     "day_start": {
      "type": "string",
      "format": "date-time",
      "title": "Day Start",
      "description": "Start of the install's own counting day (server_timezone + daily_reset_time)"
     },
     "base": {
      "type": "integer",
      "title": "Base",
      "description": "Passcodes per day without the add-on — what the rate falls back to"
     },
     "addon": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Addon",
      "description": "Add-on plan id from the license, e.g. ss_heavy; empty when none"
     },
     "addon_label": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Addon Label",
      "description": "That tier's product name, English in every locale"
     },
     "addon_until": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Addon Until",
      "description": "The add-on's own expiry; null = none recorded"
     },
     "lapsed": {
      "type": "boolean",
      "title": "Lapsed",
      "description": "An add-on was bought and has expired — the rate has dropped to `base`"
     }
    },
    "type": "object",
    "required": [
     "unlimited",
     "allowance",
     "used",
     "remaining",
     "at_cap",
     "day_start",
     "base",
     "addon",
     "addon_label",
     "addon_until",
     "lapsed"
    ],
    "title": "SelfServiceLicence"
   },
   "SelfServiceSummaryResponse": {
    "properties": {
     "enabled": {
      "type": "boolean",
      "title": "Enabled",
      "description": "The Self Service master switch (Self Service → Settings)"
     },
     "license": {
      "$ref": "#/components/schemas/SelfServiceLicence"
     },
     "counters": {
      "$ref": "#/components/schemas/SelfServiceCounters"
     }
    },
    "type": "object",
    "required": [
     "enabled",
     "license",
     "counters"
    ],
    "title": "SelfServiceSummaryResponse"
   },
   "SessionHistoryItem": {
    "properties": {
     "acctsessionid": {
      "type": "string",
      "title": "Acctsessionid"
     },
     "nas_ip": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Nas Ip"
     },
     "acctstarttime": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Acctstarttime"
     },
     "acctstoptime": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Acctstoptime",
      "description": "Null while the session is still live"
     },
     "acctinputoctets": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Acctinputoctets"
     },
     "acctoutputoctets": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Acctoutputoctets"
     },
     "acctsessiontime": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Acctsessiontime"
     },
     "acctterminatecause": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Acctterminatecause"
     }
    },
    "type": "object",
    "required": [
     "acctsessionid",
     "nas_ip",
     "acctstarttime",
     "acctstoptime",
     "acctinputoctets",
     "acctoutputoctets",
     "acctsessiontime",
     "acctterminatecause"
    ],
    "title": "SessionHistoryItem"
   },
   "SessionItem": {
    "properties": {
     "acctuniqueid": {
      "type": "string",
      "title": "Acctuniqueid"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "user_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "User Id"
     },
     "nas_ip": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Nas Ip"
     },
     "nas_name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Nas Name"
     },
     "framed_ip": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Framed Ip"
     },
     "plan_name": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Plan Name"
     },
     "current_speed_down": {
      "anyOf": [
       {
        "type": "number"
       },
       {
        "type": "null"
       }
      ],
      "title": "Current Speed Down",
      "description": "Currently applied download speed (Mbps)"
     },
     "current_speed_up": {
      "anyOf": [
       {
        "type": "number"
       },
       {
        "type": "null"
       }
      ],
      "title": "Current Speed Up",
      "description": "Currently applied upload speed (Mbps)"
     },
     "throttled": {
      "type": "boolean",
      "title": "Throttled"
     },
     "last_input_octets": {
      "type": "integer",
      "title": "Last Input Octets"
     },
     "last_output_octets": {
      "type": "integer",
      "title": "Last Output Octets"
     },
     "last_session_time": {
      "type": "integer",
      "title": "Last Session Time"
     },
     "started_at": {
      "type": "string",
      "format": "date-time",
      "title": "Started At"
     },
     "last_interim_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Last Interim At"
     },
     "calling_station_id": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Calling Station Id",
      "description": "MAC/identifier the session dialed from"
     }
    },
    "type": "object",
    "required": [
     "acctuniqueid",
     "username",
     "user_id",
     "nas_ip",
     "nas_name",
     "framed_ip",
     "plan_name",
     "current_speed_down",
     "current_speed_up",
     "throttled",
     "last_input_octets",
     "last_output_octets",
     "last_session_time",
     "started_at",
     "last_interim_at"
    ],
    "title": "SessionItem"
   },
   "SstpCreate": {
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "title": "Name"
     },
     "notes": {
      "type": "string",
      "maxLength": 500,
      "title": "Notes",
      "default": ""
     },
     "add_as_router": {
      "anyOf": [
       {
        "type": "string",
        "pattern": "^(nas|monitor)$"
       },
       {
        "type": "null"
       }
      ],
      "title": "Add As Router",
      "description": "Also add this client as a managed router at its tunnel address, same as the panel's 'Managed Router (NAS)' radio on Add Client: 'nas' (RADIUS + API) or 'monitor' (API only, no RADIUS). Omit to add neither."
     }
    },
    "type": "object",
    "required": [
     "name"
    ],
    "title": "SstpCreate"
   },
   "StatsOverviewResponse": {
    "properties": {
     "users": {
      "$ref": "#/components/schemas/UserStats"
     },
     "subscribers": {
      "$ref": "#/components/schemas/UserStats",
      "description": "Deprecated alias of `users`, kept for API clients written before 5.0.5."
     },
     "online_sessions": {
      "type": "integer",
      "title": "Online Sessions"
     },
     "today": {
      "$ref": "#/components/schemas/TodayTraffic"
     },
     "routers": {
      "$ref": "#/components/schemas/RouterReachability"
     },
     "cards": {
      "$ref": "#/components/schemas/CardCounts"
     },
     "queues": {
      "$ref": "#/components/schemas/QueueBacklog"
     }
    },
    "type": "object",
    "required": [
     "users",
     "subscribers",
     "online_sessions",
     "today",
     "routers",
     "cards",
     "queues"
    ],
    "title": "StatsOverviewResponse"
   },
   "TodayTraffic": {
    "properties": {
     "down_bytes": {
      "type": "integer",
      "title": "Down Bytes"
     },
     "up_bytes": {
      "type": "integer",
      "title": "Up Bytes"
     },
     "session_seconds": {
      "type": "integer",
      "title": "Session Seconds"
     }
    },
    "type": "object",
    "required": [
     "down_bytes",
     "up_bytes",
     "session_seconds"
    ],
    "title": "TodayTraffic"
   },
   "TopUpIn": {
    "properties": {
     "amount": {
      "type": "string",
      "title": "Amount",
      "examples": [
       "25.00"
      ]
     },
     "cash_account_id": {
      "type": "integer",
      "title": "Cash Account Id"
     },
     "memo": {
      "anyOf": [
       {
        "type": "string",
        "maxLength": 200
       },
       {
        "type": "null"
       }
      ],
      "title": "Memo"
     },
     "settle": {
      "type": "boolean",
      "title": "Settle",
      "description": "Pay open invoices from the new balance, oldest first (and restore a user suspended for not paying)",
      "default": true
     }
    },
    "type": "object",
    "required": [
     "amount",
     "cash_account_id"
    ],
    "title": "TopUpIn"
   },
   "UplinkItem": {
    "properties": {
     "iface": {
      "type": "string",
      "title": "Iface"
     },
     "role": {
      "type": "string",
      "title": "Role",
      "description": "wan | lan | access | uplink | unknown"
     },
     "gateway": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Gateway"
     },
     "public_ip": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Public Ip",
      "description": "The address configured on that interface, with prefix. Named for the common case; behind carrier NAT, or in a lab, it is a private one"
     },
     "distance": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Distance"
     },
     "active": {
      "type": "boolean",
      "title": "Active"
     },
     "is_primary": {
      "type": "boolean",
      "title": "Is Primary"
     },
     "confidence": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Confidence",
      "description": "0-100"
     },
     "manual_override": {
      "type": "boolean",
      "title": "Manual Override",
      "description": "True when an operator pinned the role by hand — detection will not overwrite it"
     },
     "detected_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Detected At"
     },
     "evidence": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Evidence",
      "description": "Every signal that agreed on this role, e.g. [\"default_route\", \"dhcp_client\", \"gateway_subnet\"]. This is the WHY: it is what lets an operator disagree with the detection on evidence rather than on a hunch"
     }
    },
    "type": "object",
    "required": [
     "iface",
     "role",
     "gateway",
     "public_ip",
     "distance",
     "active",
     "is_primary",
     "confidence",
     "manual_override",
     "detected_at"
    ],
    "title": "UplinkItem"
   },
   "UsageTotals": {
    "properties": {
     "up": {
      "type": "integer",
      "title": "Up",
      "description": "Upload bytes"
     },
     "down": {
      "type": "integer",
      "title": "Down",
      "description": "Download bytes"
     },
     "secs": {
      "type": "integer",
      "title": "Secs",
      "description": "Session seconds"
     }
    },
    "type": "object",
    "required": [
     "up",
     "down",
     "secs"
    ],
    "title": "UsageTotals"
   },
   "UserLimitState": {
    "properties": {
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "expiration | uptime | quota | daily"
     },
     "expires_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Expires At"
     },
     "uptime_used_seconds": {
      "type": "integer",
      "title": "Uptime Used Seconds"
     },
     "quota_used_down_bytes": {
      "type": "integer",
      "title": "Quota Used Down Bytes"
     },
     "quota_used_up_bytes": {
      "type": "integer",
      "title": "Quota Used Up Bytes"
     },
     "daily_used_down_bytes": {
      "type": "integer",
      "title": "Daily Used Down Bytes"
     },
     "daily_used_up_bytes": {
      "type": "integer",
      "title": "Daily Used Up Bytes"
     },
     "daily_reset_date": {
      "anyOf": [
       {
        "type": "string",
        "format": "date"
       },
       {
        "type": "null"
       }
      ],
      "title": "Daily Reset Date"
     },
     "exhausted": {
      "type": "boolean",
      "title": "Exhausted"
     },
     "exhausted_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Exhausted At"
     }
    },
    "type": "object",
    "required": [
     "kind",
     "expires_at",
     "uptime_used_seconds",
     "quota_used_down_bytes",
     "quota_used_up_bytes",
     "daily_used_down_bytes",
     "daily_used_up_bytes",
     "daily_reset_date",
     "exhausted",
     "exhausted_at"
    ],
    "title": "UserLimitState"
   },
   "UserStats": {
    "properties": {
     "total": {
      "type": "integer",
      "title": "Total"
     },
     "active": {
      "type": "integer",
      "title": "Active"
     },
     "suspended": {
      "type": "integer",
      "title": "Suspended"
     },
     "expired": {
      "type": "integer",
      "title": "Expired"
     }
    },
    "type": "object",
    "required": [
     "total",
     "active",
     "suspended",
     "expired"
    ],
    "title": "UserStats"
   },
   "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"
   },
   "Wallet": {
    "properties": {
     "customer_id": {
      "type": "integer",
      "title": "Customer Id"
     },
     "username": {
      "type": "string",
      "title": "Username"
     },
     "balance": {
      "type": "string",
      "title": "Balance"
     },
     "items": {
      "items": {
       "$ref": "#/components/schemas/WalletMove"
      },
      "type": "array",
      "title": "Items"
     }
    },
    "type": "object",
    "required": [
     "customer_id",
     "username",
     "balance",
     "items"
    ],
    "title": "Wallet"
   },
   "WalletMove": {
    "properties": {
     "entry_date": {
      "type": "string",
      "title": "Entry Date"
     },
     "kind": {
      "type": "string",
      "title": "Kind",
      "description": "top-up | withdrawal | invoice payment | refund | ..."
     },
     "memo": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Memo"
     },
     "amount": {
      "type": "string",
      "title": "Amount",
      "description": "+ into the wallet, - out of it"
     },
     "balance": {
      "type": "string",
      "title": "Balance",
      "description": "Balance after this movement"
     }
    },
    "type": "object",
    "required": [
     "entry_date",
     "kind",
     "memo",
     "amount",
     "balance"
    ],
    "title": "WalletMove"
   },
   "WalletPayIn": {
    "properties": {
     "invoice_id": {
      "type": "integer",
      "title": "Invoice Id"
     },
     "amount": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Amount",
      "description": "Omit to pay as much as the balance allows"
     }
    },
    "type": "object",
    "required": [
     "invoice_id"
    ],
    "title": "WalletPayIn"
   },
   "WalletResult": {
    "properties": {
     "customer_id": {
      "type": "integer",
      "title": "Customer Id"
     },
     "balance": {
      "type": "string",
      "title": "Balance"
     },
     "entry_id": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Entry Id"
     },
     "settled_invoices": {
      "items": {
       "type": "integer"
      },
      "type": "array",
      "title": "Settled Invoices",
      "default": []
     }
    },
    "type": "object",
    "required": [
     "customer_id",
     "balance"
    ],
    "title": "WalletResult"
   },
   "WebhookCreate": {
    "properties": {
     "url": {
      "type": "string",
      "pattern": "^https?://",
      "title": "Url",
      "description": "Receiver URL; SAMM POSTs JSON event payloads here"
     },
     "events": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Events",
      "description": "Events to subscribe to: names (invoice.paid), groups (invoice.*) or \"*\" for everything. GET /webhooks/events lists them."
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description",
      "description": "Free-text label shown in the admin page"
     }
    },
    "type": "object",
    "required": [
     "url",
     "events"
    ],
    "title": "WebhookCreate"
   },
   "WebhookCreatedResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "secret": {
      "type": "string",
      "title": "Secret",
      "description": "HMAC signing secret — shown ONCE, store it now"
     },
     "events": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Events"
     }
    },
    "type": "object",
    "required": [
     "id",
     "secret",
     "events"
    ],
    "title": "WebhookCreatedResponse"
   },
   "WebhookEndpointItem": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "url": {
      "type": "string",
      "title": "Url"
     },
     "events": {
      "items": {
       "type": "string"
      },
      "type": "array",
      "title": "Events"
     },
     "enabled": {
      "type": "boolean",
      "title": "Enabled"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
     },
     "fail_streak": {
      "type": "integer",
      "title": "Fail Streak",
      "description": "Consecutive failed deliveries; auto-disables when it grows"
     },
     "last_ok_at": {
      "anyOf": [
       {
        "type": "string",
        "format": "date-time"
       },
       {
        "type": "null"
       }
      ],
      "title": "Last Ok At"
     },
     "last_error": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Last Error"
     }
    },
    "type": "object",
    "required": [
     "id",
     "url",
     "events",
     "enabled",
     "description",
     "created_at",
     "fail_streak",
     "last_ok_at",
     "last_error"
    ],
    "title": "WebhookEndpointItem"
   },
   "WebhookToggleResponse": {
    "properties": {
     "id": {
      "type": "integer",
      "title": "Id"
     },
     "enabled": {
      "type": "boolean",
      "title": "Enabled"
     }
    },
    "type": "object",
    "required": [
     "id",
     "enabled"
    ],
    "title": "WebhookToggleResponse"
   },
   "WebhookUpdate": {
    "properties": {
     "url": {
      "anyOf": [
       {
        "type": "string",
        "pattern": "^https?://"
       },
       {
        "type": "null"
       }
      ],
      "title": "Url"
     },
     "events": {
      "anyOf": [
       {
        "items": {
         "type": "string"
        },
        "type": "array"
       },
       {
        "type": "null"
       }
      ],
      "title": "Events"
     },
     "description": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Description"
     }
    },
    "type": "object",
    "title": "WebhookUpdate"
   },
   "WgCreate": {
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "title": "Name"
     },
     "add_as_router": {
      "anyOf": [
       {
        "type": "string",
        "pattern": "^(nas|monitor)$"
       },
       {
        "type": "null"
       }
      ],
      "title": "Add As Router",
      "description": "Also add this client as a managed router at its tunnel address, same as the panel's 'Managed Router (NAS)' radio on Add Client: 'nas' (RADIUS + API) or 'monitor' (API only, no RADIUS). Omit to add neither."
     }
    },
    "type": "object",
    "required": [
     "name"
    ],
    "title": "WgCreate"
   },
   "WithdrawIn": {
    "properties": {
     "amount": {
      "type": "string",
      "title": "Amount"
     },
     "cash_account_id": {
      "type": "integer",
      "title": "Cash Account Id"
     },
     "memo": {
      "anyOf": [
       {
        "type": "string",
        "maxLength": 200
       },
       {
        "type": "null"
       }
      ],
      "title": "Memo"
     }
    },
    "type": "object",
    "required": [
     "amount",
     "cash_account_id"
    ],
    "title": "WithdrawIn"
   },
   "_LookupBody": {
    "properties": {
     "address": {
      "type": "string",
      "title": "Address",
      "description": "The public (CGNAT) or user address, e.g. 203.0.113.7"
     },
     "at": {
      "type": "string",
      "title": "At",
      "description": "When, ISO time with zone, e.g. 2026-11-05T21:14:00+02:00"
     },
     "port": {
      "anyOf": [
       {
        "type": "integer",
        "maximum": 65535.0,
        "minimum": 1.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Port",
      "description": "The port, for a shared CGNAT address"
     },
     "minutes": {
      "type": "integer",
      "maximum": 120.0,
      "minimum": 0.0,
      "title": "Minutes",
      "description": "Look this many minutes around the time",
      "default": 0
     },
     "reference": {
      "type": "string",
      "maxLength": 120,
      "minLength": 2,
      "title": "Reference",
      "description": "Case reference kept in the lookup log"
     }
    },
    "type": "object",
    "required": [
     "address",
     "at",
     "reference"
    ],
    "title": "_LookupBody"
   },
   "app__api__routers__backups__ScheduleUpdate": {
    "properties": {
     "enabled": {
      "type": "boolean",
      "title": "Enabled",
      "default": true
     },
     "time": {
      "type": "string",
      "title": "Time",
      "description": "HH:MM, server_timezone",
      "default": "04:00"
     },
     "keep": {
      "type": "integer",
      "maximum": 365.0,
      "minimum": 0.0,
      "title": "Keep",
      "description": "0 keeps every auto backup",
      "default": 3
     },
     "skip_usage": {
      "type": "boolean",
      "title": "Skip Usage",
      "default": true
     }
    },
    "type": "object",
    "title": "ScheduleUpdate"
   },
   "app__api__routers__history__ScheduleUpdate": {
    "properties": {
     "enabled": {
      "type": "boolean",
      "title": "Enabled",
      "default": false
     },
     "time": {
      "type": "string",
      "title": "Time",
      "description": "HH:MM, or \"\" to follow the backup time minus 1h",
      "default": ""
     },
     "keep": {
      "type": "string",
      "title": "Keep",
      "description": "one of: 1m, 3m, 6m, 12m",
      "default": "3m"
     }
    },
    "type": "object",
    "title": "ScheduleUpdate"
   }
  },
  "securitySchemes": {
   "APIToken": {
    "type": "http",
    "scheme": "bearer",
    "description": "Token from **System → API** (starts with `samm_`). Paste it without the `Bearer ` prefix."
   }
  }
 },
 "tags": [
  {
   "name": "auth",
   "description": "Token introspection and the queued-command tracker."
  },
  {
   "name": "stats",
   "description": "Install-wide aggregates for dashboards (requires `stats:read`)."
  },
  {
   "name": "customers",
   "description": "User accounts and their lifecycle. Scopes: `customers:read` / `customers:write`; renew, plan change and expiry need `customers:renew` (disconnect needs `coa:write`)."
  },
  {
   "name": "plans",
   "description": "Service plans (speed, duration, limits, price). Scopes: `plans:read` / `plans:write`."
  },
  {
   "name": "billing",
   "description": "Invoices: read, create, mark paid/unpaid, PDF. Scopes: `billing:read` / `billing:write`."
  },
  {
   "name": "sessions",
   "description": "Live RADIUS sessions and the CoA outbox. Scopes: `sessions:read`; disconnect/reconnect need `coa:write`."
  },
  {
   "name": "routers",
   "description": "NAS and monitor-only router inventory (read-only). Scope: `routers:read`."
  },
  {
   "name": "cards",
   "description": "Hotspot voucher cards and card groups, including voucher-PDF export. Scopes: `cards:read` / `cards:write`."
  },
  {
   "name": "self-service",
   "description": "Guest self-registration (read-only): the register of who signed themselves up at the hotspot and the licensed passcodes-per-day position. Scope: `guests:read`."
  },
  {
   "name": "accounting",
   "description": "Read-only export of the double-entry books (journal, chart of accounts, trial balance, P&L, balance sheet) for QuickBooks / Xero / BI. Scope: `accounting:read`."
  },
  {
   "name": "support",
   "description": "Remote investigation without a shell. With `diagnostics:read`: the live tunables, an active self-test, a reachability probe of the services SAMM depends on, host and unit facts, notification-channel and queue health, licence and update state, PostgreSQL and connection-pool health, and the backup position. With `errors:read`: captured incidents and their tracebacks. With `logs:read`: a capped, redacted log tail. Everything is read-only except `service-restart`, which carries its own `services:write` scope."
  },
  {
   "name": "network",
   "description": "The Network Map and Network Health board, as data: the discovered topology, every router's health state, and the open findings behind it. Read-only — applying a remedy writes to a router and stays a deliberate click in the panel. Scope: `routers:read`."
  },
  {
   "name": "webhooks",
   "description": "Outgoing webhook endpoints: register, toggle, test, delete. Scope: `webhooks:manage`."
  },
  {
   "name": "backups",
   "description": "Database backups: list, create, download, delete, restore and the automatic schedule. Scopes: `backups:read` / `backups:write`."
  },
  {
   "name": "history",
   "description": "The History cleaner: disk usage, running a clean, and its automatic schedule. Scopes: `history:read` / `history:write`."
  },
  {
   "name": "vpn",
   "description": "System -> VPN: WireGuard and L2TP/IPsec clients used to reach MikroTik routers behind NAT or to manage this SAMM host remotely. Scopes: `vpn:read` / `vpn:write`."
  },
  {
   "name": "branches",
   "description": "The admin/branch hierarchy and moving a user between branches. Scopes: `customers:read` / `admins:write`."
  },
  {
   "name": "addons",
   "description": "The add-on catalogue, granting/cancelling a user's add-ons, and per-branch plan/add-on pricing. Scopes: `addons:read` / `addons:write`."
  },
  {
   "name": "imports",
   "description": "Bulk user import from CSV/XLSX/MikroTik .rsc. Scope: `imports:write`."
  },
  {
   "name": "files",
   "description": "Files kept on a user (ID copies, contracts, photos) — the same rows the panel's Files page lists. Scopes: `customers:read` (list, download) / `customers:write` (upload, delete)."
  },
  {
   "name": "money",
   "description": "Cash accounts, partial payments, invoice discounts and the prepaid wallet, through the same ledger as the panel. Amounts are decimal strings. Scopes: `billing:read` / `billing:write`."
  },
  {
   "name": "collect",
   "description": "For payment apps (Wish Money, Sham Cash, a shop's cash app): look a user up by username, record a payment idempotently, check it. Scopes: `collect:read` / `collect:write`."
  }
 ],
 "security": [
  {
   "APIToken": []
  }
 ],
 "servers": [
  {
   "url": "https://YOUR-SAMM/api/v1",
   "description": "Your SAMM install"
  }
 ]
}