{"openapi":"3.0.3","info":{"title":"iRadic platform API","version":"0.3.0"},"components":{"securitySchemes":{"technicianSession":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"Better Auth session. HTTPS deployments use the __Secure- prefix."},"deviceToken":{"type":"http","scheme":"bearer","description":"Expiring device credential. Pending replacement credentials can only confirm rotation."}},"schemas":{"DeviceVitals":{"type":"object","nullable":true,"properties":{"cpuPercent":{"type":"number","minimum":0,"maximum":100},"memoryTotalBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"memoryUsedBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"swapTotalBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"swapUsedBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"uptimeSeconds":{"type":"integer","nullable":true,"minimum":0,"maximum":9007199254740991},"bootTimeUnixSeconds":{"type":"integer","nullable":true,"minimum":0,"maximum":9007199254740991},"disks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","maxLength":512},"mount":{"type":"string","maxLength":512},"fileSystem":{"type":"string","maxLength":512},"totalBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"availableBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","mount","fileSystem","totalBytes","availableBytes"],"additionalProperties":false},"maxItems":64},"networks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","maxLength":512},"receivedBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"transmittedBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","receivedBytes","transmittedBytes"],"additionalProperties":false},"maxItems":64}},"required":["cpuPercent","memoryTotalBytes","memoryUsedBytes","swapTotalBytes","swapUsedBytes","uptimeSeconds","bootTimeUnixSeconds","disks","networks"],"additionalProperties":false},"IssuedEnrollment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deviceId":{"type":"string","format":"uuid"},"enrollmentToken":{"type":"string","pattern":"^[a-f0-9]{64}$"},"expiresAt":{"type":"string"}},"required":["id","deviceId","enrollmentToken","expiresAt"]},"IssuedDeviceCredential":{"type":"object","properties":{"credentialId":{"type":"string","format":"uuid"},"deviceId":{"type":"string","format":"uuid"},"token":{"type":"string","pattern":"^[a-f0-9]{64}$"},"expiresAt":{"type":"string"}},"required":["credentialId","deviceId","token","expiresAt"]},"Heartbeat":{"type":"object","properties":{"hostname":{"type":"string","minLength":1,"maxLength":120},"os":{"type":"string","minLength":1,"maxLength":120},"agentVersion":{"type":"string","minLength":1,"maxLength":40},"sampleId":{"type":"string","format":"uuid"},"collectedAt":{"type":"string","format":"date-time"},"vitals":{"$ref":"#/components/schemas/DeviceVitals"}},"required":["hostname","os","agentVersion"],"additionalProperties":false},"InventorySnapshot":{"type":"object","properties":{"schemaVersion":{"type":"number","enum":[1]},"sampleId":{"type":"string","format":"uuid"},"collectedAt":{"type":"string","format":"date-time"},"hardware":{"$ref":"#/components/schemas/HardwareInventory"},"software":{"type":"array","items":{"$ref":"#/components/schemas/SoftwareInventoryItem"},"maxItems":2500},"coverage":{"type":"object","properties":{"softwareSource":{"type":"string","maxLength":512},"softwareComplete":{"type":"boolean"},"truncated":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"string","maxLength":512},"maxItems":32}},"required":["softwareSource","softwareComplete","truncated","warnings"],"additionalProperties":false}},"required":["schemaVersion","sampleId","collectedAt","hardware","software","coverage"],"additionalProperties":false},"HardwareInventory":{"type":"object","properties":{"manufacturer":{"type":"string","nullable":true,"maxLength":512},"model":{"type":"string","nullable":true,"maxLength":512},"biosVersion":{"type":"string","nullable":true,"maxLength":512},"osName":{"type":"string","maxLength":512},"osVersion":{"type":"string","maxLength":512},"architecture":{"type":"string","maxLength":512},"cpuName":{"type":"string","maxLength":512},"logicalCores":{"type":"integer","minimum":1,"maximum":4096},"totalMemoryBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"disks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","maxLength":512},"mount":{"type":"string","maxLength":512},"fileSystem":{"type":"string","maxLength":512},"totalBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"availableBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","mount","fileSystem","totalBytes","availableBytes"],"additionalProperties":false},"maxItems":64}},"required":["manufacturer","model","biosVersion","osName","osVersion","architecture","cpuName","logicalCores","totalMemoryBytes","disks"],"additionalProperties":false},"SoftwareInventoryItem":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":512},"version":{"type":"string","maxLength":512},"publisher":{"type":"string","maxLength":512},"installedOn":{"type":"string","maxLength":512},"scope":{"type":"string","enum":["machine","user"]},"architecture":{"type":"string","enum":["x64","x86","unknown"]}},"required":["name","version","publisher","installedOn","scope","architecture"],"additionalProperties":false}},"parameters":{}},"paths":{"/api/v1/health":{"get":{"tags":["Platform"],"responses":{"200":{"description":"Database readiness","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"database":{"type":"string","enum":["connected"]}},"required":["status","database"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations":{"get":{"tags":["Organizations"],"security":[{"technicianSession":[]}],"responses":{"200":{"description":"Current memberships","content":{"application/json":{"schema":{"type":"object","properties":{"organizations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","admin","technician","viewer"]},"permissions":{"type":"array","items":{"type":"string"}}},"required":["id","name","role","permissions"]}}},"required":["organizations"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Organizations"],"security":[{"technicianSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Organization with creator as owner","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/members":{"get":{"tags":["Memberships"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Organization technicians","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","technician","viewer"]}},"required":["userId","role"]}}},"required":["members"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Memberships"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","minLength":1,"maxLength":128},"role":{"type":"string","enum":["owner","admin","technician","viewer"]}},"required":["userId","role"],"additionalProperties":false}}}},"responses":{"201":{"description":"Added existing registered user","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/members/{userId}/role":{"post":{"tags":["Memberships"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","technician","viewer"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Updated membership; last owner preserved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/members/{userId}/remove":{"post":{"tags":["Memberships"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","technician","viewer"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Updated membership; last owner preserved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices":{"get":{"tags":["Devices"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Organization devices","content":{"application/json":{"schema":{"type":"object","properties":{"devices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["pending","active","revoked"]},"lastSeenAt":{"type":"string","nullable":true},"availability":{"type":"string","enum":["online","offline","never_seen","pending","revoked"]},"hostname":{"type":"string","nullable":true},"os":{"type":"string","nullable":true},"agentVersion":{"type":"string","nullable":true},"vitals":{"$ref":"#/components/schemas/DeviceVitals"},"collectedAt":{"type":"string","nullable":true}},"required":["id","organizationId","name","status","lastSeenAt","availability","hostname","os","agentVersion","vitals","collectedAt"]}}},"required":["devices"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/enrollments":{"post":{"tags":["Enrollment"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Single-use enrollment token, valid for ten minutes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedEnrollment"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/enrollments":{"post":{"tags":["Enrollment"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"}],"responses":{"201":{"description":"Administrative recovery: retire credentials and issue fresh enrollment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedEnrollment"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/enrollments/{enrollmentId}/revoke":{"post":{"tags":["Enrollment"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"enrollmentId","in":"path"}],"responses":{"200":{"description":"Revoke unused enrollment","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/enrollment/exchange":{"post":{"tags":["Enrollment"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enrollmentToken":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["enrollmentToken"],"additionalProperties":false}}}},"responses":{"201":{"description":"Exchange single-use enrollment for a thirty-day device credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedDeviceCredential"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/revoke":{"post":{"tags":["Devices"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"}],"responses":{"200":{"description":"Revoke device, credentials, unused enrollments, and pending commands","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/credentials":{"get":{"tags":["Credentials"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"}],"responses":{"200":{"description":"Credential metadata; never tokens or hashes","content":{"application/json":{"schema":{"type":"object","properties":{"credentials":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"state":{"type":"string","enum":["pending","active","revoked"]},"createdAt":{"type":"string"},"expiresAt":{"type":"string"},"revokedAt":{"type":"string","nullable":true}},"required":["id","state","createdAt","expiresAt","revokedAt"]}}},"required":["credentials"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/credentials/{credentialId}/revoke":{"post":{"tags":["Credentials"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"credentialId","in":"path"}],"responses":{"200":{"description":"Revoke one credential; device revocation is required to retire all credentials","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/credentials/rotate":{"post":{"tags":["Credentials"],"security":[{"deviceToken":[]}],"responses":{"201":{"description":"Pending replacement credential; confirm within five minutes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedDeviceCredential"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/credentials/confirm":{"post":{"tags":["Credentials"],"security":[{"deviceToken":[]}],"responses":{"200":{"description":"Activate replacement and immediately retire old credential; safe to retry","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active"]},"expiresAt":{"type":"string"}},"required":["status","expiresAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/commands":{"post":{"tags":["Commands"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["ping"]}},"required":["kind"],"additionalProperties":false}}}},"responses":{"202":{"description":"Authorized ping queued","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued"]}},"required":["id","status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/commands/{commandId}":{"get":{"tags":["Commands"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"commandId","in":"path"}],"responses":{"200":{"description":"Command status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","delivered","succeeded","expired"]},"completedAt":{"type":"string","nullable":true}},"required":["id","status","completedAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/heartbeats":{"post":{"tags":["Agent"],"security":[{"deviceToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Heartbeat"}}}},"responses":{"201":{"description":"Persisted device heartbeat","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deviceId":{"type":"string","format":"uuid"},"receivedAt":{"type":"string"}},"required":["id","deviceId","receivedAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/inventory":{"post":{"tags":["Agent"],"security":[{"deviceToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InventorySnapshot"}}}},"responses":{"200":{"description":"Latest inventory persisted; older snapshots do not overwrite newer data","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/remote-access/config":{"get":{"tags":["Remote access"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Public self-hosted client settings for endpoint setup","content":{"application/json":{"schema":{"type":"object","properties":{"idServer":{"type":"string"},"relayServer":{"type":"string"},"publicKey":{"type":"string"}},"required":["idServer","relayServer","publicKey"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/remote-access":{"post":{"tags":["Remote access"],"security":[{"deviceToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"state":{"type":"string","enum":["available","unavailable"]},"managed":{"type":"boolean","default":false},"peerId":{"type":"string","nullable":true,"pattern":"^[0-9]{6,16}$"},"idServer":{"type":"string","maxLength":255,"pattern":"^[a-zA-Z0-9.-]+(?::[0-9]{1,5})?$"},"publicKey":{"type":"string","pattern":"^[A-Za-z0-9+/]{43}=$"}},"required":["state","peerId","idServer","publicKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"iRadic remote discovery report saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/remote-access":{"get":{"tags":["Remote access"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"}],"responses":{"200":{"description":"Discovery freshness; readiness does not prove relay connectivity","content":{"application/json":{"schema":{"type":"object","properties":{"state":{"type":"string","enum":["not_configured","awaiting_agent","unavailable","server_mismatch","offline","ready"]},"reportedAt":{"type":"string","nullable":true},"managed":{"type":"boolean"}},"required":["state","reportedAt","managed"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/remote-access/launch":{"post":{"tags":["Remote access"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Audited launch; managed clients receive a single-use unattended session grant","content":{"application/json":{"schema":{"type":"object","properties":{"uri":{"type":"string"},"peerId":{"type":"string"},"expiresAt":{"type":"string","nullable":true},"managed":{"type":"boolean"}},"required":["uri","peerId","expiresAt","managed"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/remote-access/authorize":{"post":{"tags":["Remote access"],"security":[{"deviceToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","pattern":"^[a-f0-9]{64}$"},"peerId":{"type":"string","pattern":"^[0-9]{6,16}$"},"controllerId":{"type":"string","maxLength":255}},"required":["token","peerId","controllerId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Single-use remote-desktop grant consumed by its managed device","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/devices/{deviceId}/telemetry":{"get":{"tags":["Devices"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deviceId","in":"path"}],"responses":{"200":{"description":"Latest sixty heartbeat samples and inventory","content":{"application/json":{"schema":{"type":"object","properties":{"samples":{"type":"array","items":{"type":"object","properties":{"receivedAt":{"type":"string"},"collectedAt":{"type":"string","nullable":true},"vitals":{"$ref":"#/components/schemas/DeviceVitals"}},"required":["receivedAt","collectedAt","vitals"]}},"inventory":{"type":"object","nullable":true,"properties":{"collectedAt":{"type":"string"},"receivedAt":{"type":"string"},"hardware":{"$ref":"#/components/schemas/HardwareInventory"},"software":{"type":"array","items":{"$ref":"#/components/schemas/SoftwareInventoryItem"}},"coverage":{"type":"object","properties":{"softwareSource":{"type":"string","maxLength":512},"softwareComplete":{"type":"boolean"},"truncated":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"string","maxLength":512},"maxItems":32}},"required":["softwareSource","softwareComplete","truncated","warnings"],"additionalProperties":false}},"required":["collectedAt","receivedAt","hardware","software","coverage"]}},"required":["samples","inventory"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/commands/poll":{"post":{"tags":["Agent"],"security":[{"deviceToken":[]}],"responses":{"200":{"description":"Thirty-second delivery leases","content":{"application/json":{"schema":{"type":"object","properties":{"commands":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["ping"]},"nonce":{"type":"string","format":"uuid"},"expiresAt":{"type":"string"}},"required":["id","kind","nonce","expiresAt"]}}},"required":["commands"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/agent/commands/{commandId}/result":{"post":{"tags":["Agent"],"security":[{"deviceToken":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"commandId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string","format":"uuid"}},"required":["nonce"],"additionalProperties":false}}}},"responses":{"200":{"description":"Idempotent ping result","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["succeeded"]}},"required":["status"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/console/organizations/{organizationId}/audit":{"get":{"tags":["Audit"],"security":[{"technicianSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Latest one hundred audit events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"actorId":{"type":"string"},"action":{"type":"string"},"resourceId":{"type":"string","format":"uuid"},"createdAt":{"type":"string"}},"required":["id","actorId","action","resourceId","createdAt"]}}},"required":["events"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Lifecycle conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"413":{"description":"Request too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}}}}