openapi: 3.1.0 info: title: Api version: 0.1.0 description: SSH Commander API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication - name: users description: User management - name: routers description: Router management - name: groups description: Router group management - name: snippets description: Code snippet management - name: jobs description: Batch job management - name: schedules description: Job schedule management - name: credentials description: Credential profile management - name: views description: Saved views management paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/login: post: operationId: login tags: [auth] summary: Login with username and password requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: "200": description: Login successful content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logout tags: [auth] summary: Logout current user responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Get current authenticated user responses: "200": description: Current user info content: application/json: schema: $ref: "#/components/schemas/User" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /users: get: operationId: listUsers tags: [users] summary: List all users (admin only) responses: "200": description: List of users content: application/json: schema: type: array items: $ref: "#/components/schemas/User" post: operationId: createUser tags: [users] summary: Create a new user (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateUserRequest" responses: "201": description: User created content: application/json: schema: $ref: "#/components/schemas/User" /users/{id}: get: operationId: getUser tags: [users] summary: Get user by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: User found content: application/json: schema: $ref: "#/components/schemas/User" "404": description: User not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: updateUser tags: [users] summary: Update a user parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateUserRequest" responses: "200": description: User updated content: application/json: schema: $ref: "#/components/schemas/User" delete: operationId: deleteUser tags: [users] summary: Delete a user parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /routers: get: operationId: listRouters tags: [routers] summary: List all routers responses: "200": description: List of routers content: application/json: schema: type: array items: $ref: "#/components/schemas/Router" post: operationId: createRouter tags: [routers] summary: Create a new router requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateRouterRequest" responses: "201": description: Router created content: application/json: schema: $ref: "#/components/schemas/Router" /routers/{id}: get: operationId: getRouter tags: [routers] summary: Get router by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Router found content: application/json: schema: $ref: "#/components/schemas/Router" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: updateRouter tags: [routers] summary: Update a router parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateRouterRequest" responses: "200": description: Router updated content: application/json: schema: $ref: "#/components/schemas/Router" delete: operationId: deleteRouter tags: [routers] summary: Delete a router parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /routers/import: post: operationId: importRouters tags: [routers] summary: Mass import routers from parsed file data requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ImportRoutersRequest" responses: "200": description: Import results content: application/json: schema: $ref: "#/components/schemas/ImportRoutersResponse" /groups: get: operationId: listGroups tags: [groups] summary: List all groups (tree structure) responses: "200": description: List of groups content: application/json: schema: type: array items: $ref: "#/components/schemas/RouterGroup" post: operationId: createGroup tags: [groups] summary: Create a new router group requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateGroupRequest" responses: "201": description: Group created content: application/json: schema: $ref: "#/components/schemas/RouterGroup" /groups-counts: get: operationId: getGroupsCounts tags: [groups] summary: Get sub-group and device counts for all groups responses: "200": description: Map of group ID to counts content: application/json: schema: type: object additionalProperties: type: object properties: subgroups: type: integer devices: type: integer required: - subgroups - devices /groups/{id}: get: operationId: getGroup tags: [groups] summary: Get group by ID with members parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Group found content: application/json: schema: $ref: "#/components/schemas/RouterGroupWithMembers" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: updateGroup tags: [groups] summary: Update a group parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateGroupRequest" responses: "200": description: Group updated content: application/json: schema: $ref: "#/components/schemas/RouterGroup" delete: operationId: deleteGroup tags: [groups] summary: Delete a group parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /groups/{id}/members: post: operationId: addGroupMember tags: [groups] summary: Add a router or sub-group to a group parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddGroupMemberRequest" responses: "200": description: Member added content: application/json: schema: $ref: "#/components/schemas/MessageResponse" delete: operationId: removeGroupMember tags: [groups] summary: Remove a router or sub-group from a group parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RemoveGroupMemberRequest" responses: "200": description: Member removed content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /snippets: get: operationId: listSnippets tags: [snippets] summary: List all snippets parameters: - name: tag in: query required: false schema: type: string responses: "200": description: List of snippets content: application/json: schema: type: array items: $ref: "#/components/schemas/Snippet" post: operationId: createSnippet tags: [snippets] summary: Create a new snippet requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSnippetRequest" responses: "201": description: Snippet created content: application/json: schema: $ref: "#/components/schemas/Snippet" /snippets/{id}: get: operationId: getSnippet tags: [snippets] summary: Get snippet by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Snippet found content: application/json: schema: $ref: "#/components/schemas/Snippet" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: updateSnippet tags: [snippets] summary: Update a snippet parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateSnippetRequest" responses: "200": description: Snippet updated content: application/json: schema: $ref: "#/components/schemas/Snippet" delete: operationId: deleteSnippet tags: [snippets] summary: Delete a snippet parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /jobs: get: operationId: listJobs tags: [jobs] summary: List all batch jobs responses: "200": description: List of jobs content: application/json: schema: type: array items: $ref: "#/components/schemas/BatchJob" post: operationId: createJob tags: [jobs] summary: Create and start a batch job requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateJobRequest" responses: "201": description: Job created content: application/json: schema: $ref: "#/components/schemas/BatchJob" /jobs/{id}: get: operationId: getJob tags: [jobs] summary: Get job by ID with task results parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Job found content: application/json: schema: $ref: "#/components/schemas/BatchJobWithTasks" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: updateJob tags: [jobs] summary: Update a scheduled job parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateJobRequest" responses: "200": description: Job updated content: application/json: schema: $ref: "#/components/schemas/BatchJob" "400": description: Job cannot be edited content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: deleteJob tags: [jobs] summary: Delete a job and its tasks parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Job deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /jobs/{id}/cancel: post: operationId: cancelJob tags: [jobs] summary: Cancel a running job parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Job cancelled content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /jobs/{id}/rerun: post: operationId: rerunJob tags: [jobs] summary: Re-run a job by cloning it and executing immediately parameters: - name: id in: path required: true schema: type: integer responses: "201": description: New job created and started content: application/json: schema: $ref: "#/components/schemas/BatchJob" /schedules: get: operationId: listSchedules tags: [schedules] summary: List all schedules responses: "200": description: List of schedules content: application/json: schema: type: array items: $ref: "#/components/schemas/Schedule" post: operationId: createSchedule tags: [schedules] summary: Create a new schedule requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateScheduleRequest" responses: "201": description: Schedule created content: application/json: schema: $ref: "#/components/schemas/Schedule" /schedules/{id}: get: operationId: getSchedule tags: [schedules] summary: Get a schedule by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Schedule details content: application/json: schema: $ref: "#/components/schemas/Schedule" put: operationId: updateSchedule tags: [schedules] summary: Update a schedule parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateScheduleRequest" responses: "200": description: Schedule updated content: application/json: schema: $ref: "#/components/schemas/Schedule" delete: operationId: deleteSchedule tags: [schedules] summary: Delete a schedule parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Schedule deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /schedules/calendar: get: operationId: getScheduleCalendar tags: [schedules] summary: Get all scheduled runs in a given month parameters: - name: year in: query required: true schema: { type: integer } - name: month in: query required: true schema: { type: integer, minimum: 1, maximum: 12 } responses: "200": description: List of upcoming runs content: application/json: schema: type: array items: $ref: "#/components/schemas/ScheduleCalendarEntry" /credentials: get: operationId: listCredentialProfiles tags: [credentials] summary: List all credential profiles responses: "200": description: List content: application/json: schema: type: array items: $ref: "#/components/schemas/CredentialProfile" post: operationId: createCredentialProfile tags: [credentials] summary: Create a credential profile (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CredentialProfileRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/CredentialProfile" /credentials/{id}: put: operationId: updateCredentialProfile tags: [credentials] summary: Update a credential profile (admin only) parameters: - name: id in: path required: true schema: { type: integer } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CredentialProfileRequest" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/CredentialProfile" delete: operationId: deleteCredentialProfile tags: [credentials] summary: Delete a credential profile (admin only) parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /saved-views: get: operationId: listSavedViews tags: [views] summary: List saved views for the current user parameters: - name: pageKey in: query required: false schema: { type: string } responses: "200": description: List content: application/json: schema: type: array items: $ref: "#/components/schemas/SavedView" post: operationId: createSavedView tags: [views] summary: Create a saved view requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SavedViewRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/SavedView" /saved-views/{id}: delete: operationId: deleteSavedView tags: [views] summary: Delete a saved view parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /routers/{id}/uptime: get: operationId: getRouterUptime tags: [routers] summary: Get daily uptime history for a router parameters: - name: id in: path required: true schema: { type: integer } - name: days in: query required: false schema: { type: integer, minimum: 1, maximum: 365 } responses: "200": description: Daily uptime data content: application/json: schema: $ref: "#/components/schemas/RouterUptime" /routers/uptime: get: operationId: getRoutersUptime tags: [routers] summary: Get current uptime % for all routers (last 30 days) responses: "200": description: Map of router id to uptime aggregate (with daily series) content: application/json: schema: type: object additionalProperties: type: object properties: uptimePercent: { type: number } totalChecks: { type: integer } successCount: { type: integer } days: type: array items: type: object properties: day: { type: string } totalChecks: { type: integer } successCount: { type: integer } required: [day, totalChecks, successCount] required: [uptimePercent, totalChecks, successCount, days] /routers/{id}/fingerprint: post: operationId: fingerprintRouter tags: [routers] summary: Detect vendor and OS version via SSH parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Detection result content: application/json: schema: $ref: "#/components/schemas/FingerprintResult" /routers/fingerprint-all: post: operationId: fingerprintAllRouters tags: [routers] summary: Detect vendor/OS for all routers in parallel responses: "200": description: Result summary content: application/json: schema: type: object properties: successCount: { type: integer } failedCount: { type: integer } required: [successCount, failedCount] /jobs/dry-run: post: operationId: dryRunJob tags: [jobs] summary: Preview a job without executing it requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateJobRequest" responses: "200": description: Resolved scripts per device content: application/json: schema: type: array items: $ref: "#/components/schemas/DryRunEntry" /jobs/{id}/export: get: operationId: exportJob tags: [jobs] summary: Export job task results in csv, txt, or zip format parameters: - name: id in: path required: true schema: { type: integer } - name: format in: query required: true schema: type: string enum: [csv, txt, zip] responses: "200": description: File download (content type varies by format) # ─── Config Backups (2.0.0) ────────────────────────────────────────── /backups: get: tags: [backups] summary: List config backups (newest first) operationId: listBackups parameters: - name: routerId in: query required: false schema: { type: integer } - name: kind in: query required: false schema: { type: string, enum: [manual, scheduled, pre_upgrade] } - name: limit in: query required: false schema: { type: integer } - name: offset in: query required: false schema: { type: integer } responses: "200": description: Page of backups (metadata only, no content) content: application/json: schema: $ref: "#/components/schemas/BackupPage" /backups/run: post: tags: [backups] summary: Run config backups now for selected routers/groups operationId: runBackups requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BackupRunInput" responses: "202": description: Backup run started in the background content: application/json: schema: $ref: "#/components/schemas/BackupRunResult" /backups/diff: get: tags: [backups] summary: Normalized unified diff between two backups operationId: diffBackups parameters: - name: fromId in: query required: true schema: { type: integer } - name: toId in: query required: true schema: { type: integer } responses: "200": description: Diff result content: application/json: schema: $ref: "#/components/schemas/BackupDiff" "404": description: One of the backups was not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /backups/settings: get: tags: [backups] summary: Get automatic backup settings operationId: getBackupSettings responses: "200": description: Current settings content: application/json: schema: $ref: "#/components/schemas/BackupSettings" put: tags: [backups] summary: Update automatic backup settings (admin) operationId: updateBackupSettings requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BackupSettings" responses: "200": description: Updated settings content: application/json: schema: $ref: "#/components/schemas/BackupSettings" /backups/{id}: get: tags: [backups] summary: Get one backup including full content operationId: getBackup parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Backup with content content: application/json: schema: $ref: "#/components/schemas/ConfigBackup" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: tags: [backups] summary: Delete a backup (admin) operationId: deleteBackup parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" # ─── Config Drift (2.0.0) ──────────────────────────────────────────── /golden-configs: get: tags: [drift] summary: List golden configs with drift summaries operationId: listGoldenConfigs responses: "200": description: Golden configs content: application/json: schema: type: array items: $ref: "#/components/schemas/GoldenConfig" post: tags: [drift] summary: Create a golden config for a group (admin) operationId: createGoldenConfig requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GoldenConfigInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/GoldenConfig" /golden-configs/{id}: put: tags: [drift] summary: Update a golden config (admin) operationId: updateGoldenConfig parameters: - name: id in: path required: true schema: { type: integer } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GoldenConfigUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/GoldenConfig" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: tags: [drift] summary: Delete a golden config (admin) operationId: deleteGoldenConfig parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /golden-configs/{id}/check: post: tags: [drift] summary: Compare member routers' latest backups against the golden config operationId: checkGoldenConfig parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Drift check results content: application/json: schema: $ref: "#/components/schemas/DriftCheckResponse" /golden-configs/{id}/results: get: tags: [drift] summary: Latest drift results for a golden config operationId: getGoldenConfigResults parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Latest per-router drift results content: application/json: schema: type: array items: $ref: "#/components/schemas/DriftResult" # ─── RouterOS Upgrades (2.0.0) ─────────────────────────────────────── /upgrades/overview: get: tags: [upgrades] summary: Fleet firmware overview grouped by detected OS version operationId: getUpgradeOverview responses: "200": description: Version groups content: application/json: schema: type: array items: $ref: "#/components/schemas/UpgradeOverviewGroup" /upgrades: get: tags: [upgrades] summary: List upgrade runs (newest first) operationId: listUpgradeRuns responses: "200": description: Upgrade runs content: application/json: schema: type: array items: $ref: "#/components/schemas/UpgradeRun" post: tags: [upgrades] summary: Start an upgrade run (admin) operationId: createUpgradeRun requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpgradeRunInput" responses: "201": description: Run created and started content: application/json: schema: $ref: "#/components/schemas/UpgradeRun" /upgrades/{id}: get: tags: [upgrades] summary: Get an upgrade run with its per-device tasks operationId: getUpgradeRun parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Run with tasks content: application/json: schema: $ref: "#/components/schemas/UpgradeRunWithTasks" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: tags: [upgrades] summary: Delete a finished upgrade run (admin) operationId: deleteUpgradeRun parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /upgrades/{id}/cancel: post: tags: [upgrades] summary: Cancel pending tasks of a running upgrade (admin) operationId: cancelUpgradeRun parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Updated run content: application/json: schema: $ref: "#/components/schemas/UpgradeRun" # ─── Alerts & Notifications (2.0.0) ────────────────────────────────── /alert-channels: get: tags: [alerts] summary: List notification channels (secrets masked) operationId: listAlertChannels responses: "200": description: Channels content: application/json: schema: type: array items: $ref: "#/components/schemas/NotificationChannel" post: tags: [alerts] summary: Create a notification channel (admin) operationId: createAlertChannel requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AlertChannelInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/NotificationChannel" /alert-channels/{id}: put: tags: [alerts] summary: Update a notification channel (admin; omitted secrets are kept) operationId: updateAlertChannel parameters: - name: id in: path required: true schema: { type: integer } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AlertChannelUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/NotificationChannel" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: tags: [alerts] summary: Delete a notification channel (admin) operationId: deleteAlertChannel parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /alert-channels/{id}/test: post: tags: [alerts] summary: Send a test message through a channel (admin) operationId: testAlertChannel parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Delivery attempt result content: application/json: schema: $ref: "#/components/schemas/AlertTestResult" /alert-rules: get: tags: [alerts] summary: List alert rules operationId: listAlertRules responses: "200": description: Rules content: application/json: schema: type: array items: $ref: "#/components/schemas/AlertRule" post: tags: [alerts] summary: Create an alert rule (admin) operationId: createAlertRule requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AlertRuleInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/AlertRule" /alert-rules/{id}: put: tags: [alerts] summary: Update an alert rule (admin) operationId: updateAlertRule parameters: - name: id in: path required: true schema: { type: integer } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AlertRuleUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/AlertRule" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: tags: [alerts] summary: Delete an alert rule (admin) operationId: deleteAlertRule parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /alert-events: get: tags: [alerts] summary: Alert delivery history (newest first) operationId: listAlertEvents parameters: - name: limit in: query required: false schema: { type: integer } - name: offset in: query required: false schema: { type: integer } responses: "200": description: Page of alert events content: application/json: schema: $ref: "#/components/schemas/AlertEventPage" # ─── Audit Log (2.0.0) ─────────────────────────────────────────────── /audit: get: tags: [audit] summary: Query the audit log (admin) operationId: listAuditLog parameters: - name: userId in: query required: false schema: { type: integer } - name: action in: query required: false schema: { type: string } - name: resourceType in: query required: false schema: { type: string } - name: q in: query required: false schema: { type: string } - name: from in: query required: false schema: { type: string, format: date-time } - name: to in: query required: false schema: { type: string, format: date-time } - name: limit in: query required: false schema: { type: integer } - name: offset in: query required: false schema: { type: integer } responses: "200": description: Page of audit entries content: application/json: schema: $ref: "#/components/schemas/AuditPage" /audit/actions: get: tags: [audit] summary: Distinct audit action names (admin, for filters) operationId: listAuditActions responses: "200": description: Action names content: application/json: schema: type: array items: { type: string } # ─── TOTP Two-Factor Auth (2.0.0) ──────────────────────────────────── /auth/totp/setup: post: tags: [auth] summary: Begin TOTP enrollment for the current user operationId: setupTotp responses: "200": description: Pending secret and QR code content: application/json: schema: $ref: "#/components/schemas/TotpSetup" /auth/totp/confirm: post: tags: [auth] summary: Confirm TOTP enrollment with a valid code operationId: confirmTotp requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TotpCodeInput" responses: "200": description: 2FA enabled; one-time recovery codes content: application/json: schema: $ref: "#/components/schemas/TotpConfirmResult" /auth/totp/verify: post: tags: [auth] summary: Complete a pending 2FA login with a TOTP or recovery code operationId: verifyTotp requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TotpCodeInput" responses: "200": description: Login completed content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "401": description: Invalid code or no pending login content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/totp/disable: post: tags: [auth] summary: Disable TOTP for the current user (requires password + code) operationId: disableTotp requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TotpDisableInput" responses: "200": description: Disabled content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /users/{id}/reset-totp: post: tags: [users] summary: Admin reset of a user's TOTP enrollment operationId: resetUserTotp parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: TOTP cleared for the user content: application/json: schema: $ref: "#/components/schemas/MessageResponse" # ─── API Tokens (2.0.0) ────────────────────────────────────────────── /tokens: get: tags: [tokens] summary: List own API tokens (admins may pass all=true for everyone's) operationId: listApiTokens parameters: - name: all in: query required: false schema: { type: boolean } responses: "200": description: Tokens (hashes never returned) content: application/json: schema: type: array items: $ref: "#/components/schemas/ApiToken" post: tags: [tokens] summary: Create an API token (plaintext shown exactly once) operationId: createApiToken requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ApiTokenInput" responses: "201": description: Created token content: application/json: schema: $ref: "#/components/schemas/ApiTokenCreated" /tokens/{id}: delete: tags: [tokens] summary: Revoke an API token (owner or admin) operationId: revokeApiToken parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Revoked content: application/json: schema: $ref: "#/components/schemas/MessageResponse" # ─── Job Output Analytics (2.0.0) ──────────────────────────────────── /jobs/output-search: get: tags: [jobs] summary: Full-text search across historical job task outputs operationId: searchJobOutputs parameters: - name: q in: query required: true schema: { type: string } - name: limit in: query required: false schema: { type: integer } - name: offset in: query required: false schema: { type: integer } responses: "200": description: Matching tasks with context snippets content: application/json: schema: $ref: "#/components/schemas/OutputSearchPage" /jobs/{id}/output-groups: get: tags: [jobs] summary: Group a job's device outputs by identical content operationId: getJobOutputGroups parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Output groups, largest first content: application/json: schema: type: array items: $ref: "#/components/schemas/OutputGroup" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object properties: error: type: string required: - error MessageResponse: type: object properties: message: type: string required: - message LoginRequest: type: object properties: username: type: string password: type: string required: - username - password AuthResponse: type: object properties: user: $ref: "#/components/schemas/User" message: type: string totpRequired: type: boolean description: When true, the password was accepted but a TOTP code must be verified via /auth/totp/verify to complete login required: - message User: type: object properties: id: type: integer username: type: string email: type: string role: type: string enum: [admin, operator] canTerminal: type: boolean description: Whether this user has access to the per-device terminal. Admins always have access. totpEnabled: type: boolean createdAt: type: string format: date-time required: - id - username - role - createdAt CreateUserRequest: type: object properties: username: type: string email: type: string password: type: string role: type: string enum: [admin, operator] canTerminal: type: boolean required: - username - password - role UpdateUserRequest: type: object properties: username: type: string email: type: string password: type: string role: type: string enum: [admin, operator] canTerminal: type: boolean Router: type: object properties: id: { type: integer } name: { type: string } ipAddress: { type: string } sshPort: { type: integer } sshUsername: { type: string } description: { type: string } credentialProfileId: { type: integer, nullable: true } vendor: { type: string, nullable: true } osVersion: { type: string, nullable: true } lastFingerprintAt: { type: string, format: date-time, nullable: true } hasEnablePassword: { type: boolean } createdAt: { type: string, format: date-time } required: - id - name - ipAddress - sshPort - sshUsername - hasEnablePassword - createdAt CreateRouterRequest: type: object properties: name: { type: string } ipAddress: { type: string } sshPort: { type: integer } sshUsername: { type: string } sshPassword: { type: string } enablePassword: { type: string } description: { type: string } credentialProfileId: { type: integer, nullable: true } required: - name - ipAddress - sshPort - sshUsername UpdateRouterRequest: type: object properties: name: { type: string } ipAddress: { type: string } sshPort: { type: integer } sshUsername: { type: string } sshPassword: { type: string } enablePassword: { type: string } description: { type: string } credentialProfileId: { type: integer, nullable: true } ImportRoutersRequest: type: object properties: routers: type: array items: type: object properties: name: type: string ipAddress: type: string sshPort: type: integer sshUsername: type: string sshPassword: type: string description: type: string required: - name - ipAddress required: - routers ImportRouterResult: type: object properties: index: type: integer name: type: string status: type: string enum: [created, error] error: type: string required: - index - name - status ImportRoutersResponse: type: object properties: created: type: integer failed: type: integer total: type: integer results: type: array items: $ref: "#/components/schemas/ImportRouterResult" required: - created - failed - total - results RouterGroup: type: object properties: id: type: integer name: type: string description: type: string parentId: type: integer nullable: true createdAt: type: string format: date-time required: - id - name - createdAt RouterGroupWithMembers: type: object properties: id: type: integer name: type: string description: type: string parentId: type: integer nullable: true createdAt: type: string format: date-time routers: type: array items: $ref: "#/components/schemas/Router" subGroups: type: array items: $ref: "#/components/schemas/RouterGroup" required: - id - name - createdAt - routers - subGroups CreateGroupRequest: type: object properties: name: type: string description: type: string parentId: type: integer nullable: true required: - name UpdateGroupRequest: type: object properties: name: type: string description: type: string parentId: type: integer nullable: true AddGroupMemberRequest: type: object properties: type: type: string enum: [router, group] memberId: type: integer required: - type - memberId RemoveGroupMemberRequest: type: object properties: type: type: string enum: [router, group] memberId: type: integer required: - type - memberId Snippet: type: object properties: id: type: integer name: type: string tags: type: array items: type: string code: type: string description: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - name - tags - code - createdAt - updatedAt CreateSnippetRequest: type: object properties: name: type: string tags: type: array items: type: string code: type: string description: type: string required: - name - tags - code UpdateSnippetRequest: type: object properties: name: type: string tags: type: array items: type: string code: type: string description: type: string BatchJob: type: object properties: id: type: integer name: type: string scriptCode: type: string status: type: string enum: [pending, running, completed, failed, cancelled, scheduled] targetRouterIds: type: array items: type: integer targetGroupIds: type: array items: type: integer autoConfirm: type: boolean timeoutSeconds: { type: integer } retryCount: { type: integer } retryBackoffSeconds: { type: integer } totalTasks: type: integer completedTasks: type: integer failedTasks: type: integer createdBy: type: integer createdAt: type: string format: date-time completedAt: type: string format: date-time nullable: true required: - id - name - scriptCode - status - targetRouterIds - targetGroupIds - autoConfirm - timeoutSeconds - retryCount - retryBackoffSeconds - totalTasks - completedTasks - failedTasks - createdBy - createdAt BatchJobWithTasks: type: object properties: id: type: integer name: type: string scriptCode: type: string status: type: string enum: [pending, running, completed, failed, cancelled, scheduled] targetRouterIds: type: array items: type: integer targetGroupIds: type: array items: type: integer excelData: type: array items: type: object additionalProperties: type: string nullable: true autoConfirm: type: boolean timeoutSeconds: { type: integer } retryCount: { type: integer } retryBackoffSeconds: { type: integer } totalTasks: type: integer completedTasks: type: integer failedTasks: type: integer createdBy: type: integer createdAt: type: string format: date-time completedAt: type: string format: date-time nullable: true tasks: type: array items: $ref: "#/components/schemas/JobTask" required: - id - name - scriptCode - status - targetRouterIds - targetGroupIds - autoConfirm - timeoutSeconds - retryCount - retryBackoffSeconds - totalTasks - completedTasks - failedTasks - createdBy - createdAt - tasks JobTask: type: object properties: id: type: integer jobId: type: integer routerId: type: integer routerName: type: string routerIp: type: string status: type: string enum: [pending, running, success, failed, waiting_input, needs_attention] output: type: string nullable: true errorMessage: type: string nullable: true connectionLog: type: string nullable: true resolvedScript: type: string nullable: true promptText: type: string nullable: true failureReason: type: string nullable: true description: | Set when status="needs_attention" — the failure signal word(s) detected in the device output and the line(s) containing them. The SSH session itself succeeded; this flags suspicious output. attemptCount: type: integer startedAt: type: string format: date-time nullable: true completedAt: type: string format: date-time nullable: true required: - id - jobId - routerId - routerName - routerIp - status CreateJobRequest: type: object properties: name: type: string scriptCode: type: string targetRouterIds: type: array items: type: integer targetGroupIds: type: array items: type: integer excelData: type: array items: type: object additionalProperties: type: string description: Rows from Excel file for tag substitution, each row is applied per router mode: type: string enum: [run, schedule] description: Run executes immediately (default), schedule saves as template for scheduling autoConfirm: type: boolean description: Automatically answer yes to SSH confirmation prompts (default true) timeoutSeconds: type: integer description: Per-device SSH timeout in seconds (1-3600, default 30) retryCount: type: integer description: Number of retries on connection failure (0-10, default 0) retryBackoffSeconds: type: integer description: Seconds to wait between retries (default 5) required: - name - scriptCode - targetRouterIds - targetGroupIds Schedule: type: object properties: id: type: integer name: type: string jobId: type: integer type: type: string enum: [once, interval, weekly, daily, monthly] scheduledAt: type: string format: date-time nullable: true intervalMinutes: type: integer nullable: true daysOfWeek: type: array items: type: integer nullable: true timeOfDay: type: string nullable: true dayOfMonth: type: integer nullable: true monthlyMode: type: string nullable: true nthWeek: type: integer nullable: true nthWeekday: type: integer nullable: true nextRunAt: type: string format: date-time nullable: true lastRunAt: type: string format: date-time nullable: true enabled: type: boolean runCount: type: integer createdBy: type: integer createdAt: type: string format: date-time required: - id - name - jobId - type - enabled - runCount - createdBy - createdAt CreateScheduleRequest: type: object properties: name: type: string jobId: type: integer type: type: string enum: [once, interval, weekly, daily, monthly] scheduledAt: type: string format: date-time intervalMinutes: type: integer daysOfWeek: type: array items: type: integer timeOfDay: type: string dayOfMonth: type: integer monthlyMode: type: string nthWeek: type: integer nthWeekday: type: integer required: - name - jobId - type UpdateScheduleRequest: type: object properties: name: type: string enabled: type: boolean jobId: type: integer type: type: string enum: [once, interval, weekly, daily, monthly] scheduledAt: type: string format: date-time nullable: true intervalMinutes: type: integer nullable: true daysOfWeek: type: array items: type: integer nullable: true timeOfDay: type: string nullable: true dayOfMonth: type: integer nullable: true monthlyMode: type: string nullable: true nthWeek: type: integer nullable: true nthWeekday: type: integer nullable: true CredentialProfile: type: object properties: id: { type: integer } name: { type: string } sshUsername: { type: string } hasPassword: { type: boolean } hasEnablePassword: { type: boolean } jumpHostId: { type: integer, nullable: true } jumpHost: { type: string, nullable: true } jumpPort: { type: integer, nullable: true } description: { type: string, nullable: true } createdAt: { type: string, format: date-time } required: [id, name, sshUsername, hasPassword, hasEnablePassword, createdAt] CredentialProfileRequest: type: object properties: name: { type: string } sshUsername: { type: string } sshPassword: { type: string } enablePassword: { type: string } jumpHostId: { type: integer, nullable: true } jumpHost: { type: string, nullable: true } jumpPort: { type: integer, nullable: true } description: { type: string } required: [name, sshUsername] SavedView: type: object properties: id: { type: integer } userId: { type: integer } pageKey: { type: string } name: { type: string } viewState: type: object additionalProperties: true createdAt: { type: string, format: date-time } required: [id, userId, pageKey, name, viewState, createdAt] SavedViewRequest: type: object properties: pageKey: { type: string } name: { type: string } viewState: type: object additionalProperties: true required: [pageKey, name, viewState] RouterUptime: type: object properties: routerId: { type: integer } uptimePercent: { type: number } days: type: array items: type: object properties: day: { type: string } totalChecks: { type: integer } successCount: { type: integer } required: [day, totalChecks, successCount] required: [routerId, uptimePercent, days] FingerprintResult: type: object properties: success: { type: boolean } vendor: { type: string, nullable: true } osVersion: { type: string, nullable: true } errorMessage: { type: string, nullable: true } required: [success] DryRunEntry: type: object properties: routerId: { type: integer } routerName: { type: string } routerIp: { type: string } resolvedScript: { type: string } missingTags: type: array items: { type: string } required: [routerId, routerName, routerIp, resolvedScript, missingTags] ScheduleCalendarEntry: type: object properties: scheduleId: { type: integer } scheduleName: { type: string } jobName: { type: string } datetime: { type: string, format: date-time } required: [scheduleId, scheduleName, jobName, datetime] # ─── Config Backups (2.0.0) ───────────────────────────────────────── ConfigBackupMeta: type: object properties: id: { type: integer } routerId: { type: ["integer", "null"] } routerName: { type: string } routerIp: { type: string } kind: { type: string, enum: [manual, scheduled, pre_upgrade] } status: { type: string, enum: [success, failed] } sizeBytes: { type: integer } contentHash: { type: string } errorMessage: { type: ["string", "null"] } createdBy: { type: ["integer", "null"] } createdAt: { type: string, format: date-time } lastSeenAt: { type: ["string", "null"], format: date-time } required: [id, routerName, routerIp, kind, status, sizeBytes, contentHash, createdAt] ConfigBackup: type: object properties: id: { type: integer } routerId: { type: ["integer", "null"] } routerName: { type: string } routerIp: { type: string } kind: { type: string, enum: [manual, scheduled, pre_upgrade] } status: { type: string, enum: [success, failed] } sizeBytes: { type: integer } contentHash: { type: string } errorMessage: { type: ["string", "null"] } createdBy: { type: ["integer", "null"] } createdAt: { type: string, format: date-time } lastSeenAt: { type: ["string", "null"], format: date-time } content: { type: string } required: [id, routerName, routerIp, kind, status, sizeBytes, contentHash, createdAt, content] BackupPage: type: object properties: items: type: array items: $ref: "#/components/schemas/ConfigBackupMeta" total: { type: integer } required: [items, total] BackupRunInput: type: object properties: routerIds: type: array items: { type: integer } groupIds: type: array items: { type: integer } BackupRunResult: type: object properties: message: { type: string } targeted: { type: integer } required: [message, targeted] BackupDiff: type: object properties: fromId: { type: integer } toId: { type: integer } routerName: { type: ["string", "null"] } addedLines: { type: integer } removedLines: { type: integer } identical: { type: boolean } diff: { type: string } required: [fromId, toId, addedLines, removedLines, identical, diff] BackupSettings: type: object properties: enabled: { type: boolean } timeOfDay: type: string description: "HH:MM 24h server-local time for the daily automatic backup" retentionPerRouter: type: integer description: Distinct backup versions kept per router (older pruned) required: [enabled, timeOfDay, retentionPerRouter] # ─── Config Drift (2.0.0) ─────────────────────────────────────────── GoldenConfig: type: object properties: id: { type: integer } groupId: { type: integer } groupName: { type: string } name: { type: string } content: { type: string } ignorePatterns: type: array items: { type: string } routerCount: { type: integer } driftedCount: { type: integer } lastCheckedAt: { type: ["string", "null"], format: date-time } createdAt: { type: string, format: date-time } updatedAt: { type: string, format: date-time } required: [id, groupId, groupName, name, content, ignorePatterns, routerCount, driftedCount, createdAt, updatedAt] GoldenConfigInput: type: object properties: groupId: { type: integer } name: { type: string, minLength: 1 } content: { type: string, minLength: 1 } ignorePatterns: type: array items: { type: string } required: [groupId, name, content] GoldenConfigUpdate: type: object properties: name: { type: string, minLength: 1 } content: { type: string, minLength: 1 } ignorePatterns: type: array items: { type: string } DriftResult: type: object properties: id: { type: integer } goldenConfigId: { type: integer } routerId: { type: integer } routerName: { type: string } routerIp: { type: ["string", "null"] } backupId: { type: ["integer", "null"] } inSync: { type: boolean } addedLines: { type: integer } removedLines: { type: integer } diff: { type: ["string", "null"] } checkedAt: { type: string, format: date-time } required: [id, goldenConfigId, routerId, routerName, inSync, addedLines, removedLines, checkedAt] DriftCheckResponse: type: object properties: results: type: array items: $ref: "#/components/schemas/DriftResult" checked: { type: integer } drifted: { type: integer } skipped: type: integer description: Member routers without any successful backup to compare required: [results, checked, drifted, skipped] # ─── RouterOS Upgrades (2.0.0) ────────────────────────────────────── UpgradeOverviewRouter: type: object properties: id: { type: integer } name: { type: string } ipAddress: { type: string } model: { type: ["string", "null"] } lastFingerprintAt: { type: ["string", "null"], format: date-time } required: [id, name, ipAddress] UpgradeOverviewGroup: type: object properties: osVersion: { type: ["string", "null"] } vendor: { type: ["string", "null"] } count: { type: integer } routers: type: array items: $ref: "#/components/schemas/UpgradeOverviewRouter" required: [count, routers] UpgradeRun: type: object properties: id: { type: integer } name: { type: string } status: { type: string, enum: [running, completed, failed, cancelled] } preBackup: { type: boolean } totalTasks: { type: integer } completedTasks: { type: integer } failedTasks: { type: integer } createdBy: { type: ["integer", "null"] } createdAt: { type: string, format: date-time } completedAt: { type: ["string", "null"], format: date-time } required: [id, name, status, preBackup, totalTasks, completedTasks, failedTasks, createdAt] UpgradeTask: type: object properties: id: { type: integer } runId: { type: integer } routerId: { type: ["integer", "null"] } routerName: { type: string } routerIp: { type: string } status: { type: string, enum: [pending, backing_up, upgrading, rebooting, verifying, success, failed, skipped] } oldVersion: { type: ["string", "null"] } newVersion: { type: ["string", "null"] } log: { type: ["string", "null"] } errorMessage: { type: ["string", "null"] } startedAt: { type: ["string", "null"], format: date-time } completedAt: { type: ["string", "null"], format: date-time } required: [id, runId, routerName, routerIp, status] UpgradeRunWithTasks: type: object properties: id: { type: integer } name: { type: string } status: { type: string, enum: [running, completed, failed, cancelled] } preBackup: { type: boolean } totalTasks: { type: integer } completedTasks: { type: integer } failedTasks: { type: integer } createdBy: { type: ["integer", "null"] } createdAt: { type: string, format: date-time } completedAt: { type: ["string", "null"], format: date-time } tasks: type: array items: $ref: "#/components/schemas/UpgradeTask" required: [id, name, status, preBackup, totalTasks, completedTasks, failedTasks, createdAt, tasks] UpgradeRunInput: type: object properties: name: { type: string } routerIds: type: array items: { type: integer } groupIds: type: array items: { type: integer } preBackup: type: boolean description: Snapshot each device's config before upgrading (default true) # ─── Alerts & Notifications (2.0.0) ───────────────────────────────── NotificationChannel: type: object properties: id: { type: integer } name: { type: string } type: { type: string, enum: [telegram, email, webhook] } enabled: { type: boolean } config: type: object additionalProperties: true description: Sanitized per-type config; secrets are replaced by *Set booleans lastUsedAt: { type: ["string", "null"], format: date-time } lastError: { type: ["string", "null"] } createdAt: { type: string, format: date-time } required: [id, name, type, enabled, config, createdAt] AlertChannelInput: type: object properties: name: { type: string, minLength: 1 } type: { type: string, enum: [telegram, email, webhook] } enabled: { type: boolean } config: type: object additionalProperties: true description: "telegram: {botToken, chatId}; email: {host, port, secure, username, password, from, to}; webhook: {url, secret}" required: [name, type, config] AlertChannelUpdate: type: object properties: name: { type: string, minLength: 1 } enabled: { type: boolean } config: type: object additionalProperties: true description: Omitted or empty secret fields keep their stored values AlertRule: type: object properties: id: { type: integer } name: { type: string } eventTypes: type: array items: type: string enum: [device_down, device_up, job_failed, job_completed, schedule_failed, backup_failed, drift_detected, upgrade_completed, upgrade_failed] routerIds: type: array items: { type: integer } groupIds: type: array items: { type: integer } channelIds: type: array items: { type: integer } cooldownMinutes: { type: integer } enabled: { type: boolean } createdAt: { type: string, format: date-time } required: [id, name, eventTypes, routerIds, groupIds, channelIds, cooldownMinutes, enabled, createdAt] AlertRuleInput: type: object properties: name: { type: string, minLength: 1 } eventTypes: type: array items: type: string enum: [device_down, device_up, job_failed, job_completed, schedule_failed, backup_failed, drift_detected, upgrade_completed, upgrade_failed] routerIds: type: array items: { type: integer } groupIds: type: array items: { type: integer } channelIds: type: array items: { type: integer } cooldownMinutes: { type: integer } enabled: { type: boolean } required: [name, eventTypes, channelIds] AlertRuleUpdate: type: object properties: name: { type: string, minLength: 1 } eventTypes: type: array items: type: string enum: [device_down, device_up, job_failed, job_completed, schedule_failed, backup_failed, drift_detected, upgrade_completed, upgrade_failed] routerIds: type: array items: { type: integer } groupIds: type: array items: { type: integer } channelIds: type: array items: { type: integer } cooldownMinutes: { type: integer } enabled: { type: boolean } AlertEvent: type: object properties: id: { type: integer } ruleId: { type: ["integer", "null"] } ruleName: { type: string } eventType: { type: string } subject: { type: string } message: { type: string } status: { type: string, enum: [sent, failed, suppressed] } error: { type: ["string", "null"] } createdAt: { type: string, format: date-time } required: [id, ruleName, eventType, subject, message, status, createdAt] AlertEventPage: type: object properties: items: type: array items: $ref: "#/components/schemas/AlertEvent" total: { type: integer } required: [items, total] AlertTestResult: type: object properties: success: { type: boolean } error: { type: ["string", "null"] } required: [success] # ─── Audit Log (2.0.0) ────────────────────────────────────────────── AuditEntry: type: object properties: id: { type: integer } userId: { type: ["integer", "null"] } username: { type: string } action: { type: string } resourceType: { type: ["string", "null"] } resourceId: { type: ["string", "null"] } resourceName: { type: ["string", "null"] } details: type: ["object", "null"] additionalProperties: true ip: { type: ["string", "null"] } createdAt: { type: string, format: date-time } required: [id, username, action, createdAt] AuditPage: type: object properties: items: type: array items: $ref: "#/components/schemas/AuditEntry" total: { type: integer } required: [items, total] # ─── TOTP 2FA (2.0.0) ─────────────────────────────────────────────── TotpSetup: type: object properties: secret: { type: string } otpauthUrl: { type: string } qrDataUrl: type: string description: PNG data URL of the enrollment QR code required: [secret, otpauthUrl, qrDataUrl] TotpCodeInput: type: object properties: code: { type: string, minLength: 1 } required: [code] TotpConfirmResult: type: object properties: message: { type: string } recoveryCodes: type: array items: { type: string } description: One-time recovery codes, shown exactly once required: [message, recoveryCodes] TotpDisableInput: type: object properties: password: { type: string, minLength: 1 } code: { type: string } required: [password] # ─── API Tokens (2.0.0) ───────────────────────────────────────────── ApiToken: type: object properties: id: { type: integer } userId: { type: integer } username: { type: ["string", "null"] } name: { type: string } prefix: { type: string } scope: { type: string, enum: [read, write] } lastUsedAt: { type: ["string", "null"], format: date-time } expiresAt: { type: ["string", "null"], format: date-time } revokedAt: { type: ["string", "null"], format: date-time } createdAt: { type: string, format: date-time } required: [id, userId, name, prefix, scope, createdAt] ApiTokenInput: type: object properties: name: { type: string, minLength: 1 } scope: { type: string, enum: [read, write] } expiresDays: type: integer description: Days until expiry; omit for a non-expiring token required: [name, scope] ApiTokenCreated: type: object properties: token: type: string description: Full plaintext token — displayed exactly once at creation apiToken: $ref: "#/components/schemas/ApiToken" required: [token, apiToken] # ─── Job Output Analytics (2.0.0) ─────────────────────────────────── OutputGroup: type: object properties: outputHash: { type: string } count: { type: integer } routerNames: type: array items: { type: string } taskIds: type: array items: { type: integer } statuses: type: array items: { type: string } sampleOutput: { type: string } required: [outputHash, count, routerNames, taskIds, statuses, sampleOutput] OutputSearchHit: type: object properties: jobId: { type: integer } jobName: { type: string } taskId: { type: integer } routerName: { type: string } routerIp: { type: ["string", "null"] } status: { type: string } snippet: { type: string } createdAt: { type: ["string", "null"], format: date-time } required: [jobId, jobName, taskId, routerName, status, snippet] OutputSearchPage: type: object properties: items: type: array items: $ref: "#/components/schemas/OutputSearchHit" total: { type: integer } required: [items, total]