{"openapi":"3.1.0","info":{"title":"Entropy Management API","version":"1.0.0","description":"Programmatic control-plane CRUD API for managing zero-PII accounts, enrolment codes, seats, hardware bans, apps, releases, builds, sealed log inventories, and scoped API tokens."},"servers":[{"url":"https://api.getentropy.dev","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"System","description":"Health check and OpenAPI specification."},{"name":"Accounts","description":"Zero-PII customer accounts and 28-day deletion holds."},{"name":"Enrolment Codes","description":"Single-use device enrolment codes."},{"name":"Seats","description":"Enrolled hardware seats and live WebSocket revocation."},{"name":"Bans","description":"Decoupled hardware component and TPM EK bans (1-3 year TTL)."},{"name":"Apps","description":"Protected application catalog and epoch settings."},{"name":"Releases","description":"Release lifecycle (draft, staged, active, retired)."},{"name":"Builds","description":"Build inventory, instant kill switch, and cleanup."},{"name":"Logs","description":"HPKE-sealed log batch inventory in R2."},{"name":"API Tokens","description":"Scoped tenant Bearer token management."}],"paths":{"/healthz":{"get":{"tags":["System"],"operationId":"getHealth","summary":"Health check","security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","required":["ok","service"],"properties":{"ok":{"type":"boolean","const":true},"service":{"type":"string","example":"entropydrm-api"}}}}}}}}},"/openapi.json":{"get":{"tags":["System"],"operationId":"getOpenApiSpec","summary":"OpenAPI 3.1.0 specification","security":[],"responses":{"200":{"description":"OpenAPI 3.1.0 JSON document","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/accounts":{"get":{"tags":["Accounts"],"operationId":"listAccounts","summary":"List accounts","description":"Requires scope `accounts:read`.","x-required-scope":"accounts:read","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["active","suspended","pending_deletion","banned"]}},{"name":"search","in":"query","schema":{"type":"string"},"description":"Case-insensitive substring match against `account_guid`."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated list of accounts","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Account"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Accounts"],"operationId":"createAccount","summary":"Create an account","description":"Creates a zero-PII GUID account. Set `create_enrolment_code: true` to atomically mint the first single-use enrolment code in the same transaction. Requires scope `accounts:write`.","x-required-scope":"accounts:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"account_guid":{"type":"string","format":"uuid","description":"Optional canonical UUID. Auto-generated if omitted."},"seat_limit":{"type":"integer","minimum":0,"maximum":100000,"default":1},"entitlements":{"type":"array","items":{"type":"string"},"default":[]},"status":{"type":"string","enum":["active","suspended"],"default":"active"},"create_enrolment_code":{"type":"boolean","default":false},"product_id":{"type":"string","default":"default","description":"App/product ID attached to the enrolment code when `create_enrolment_code` is true."},"code_ttl_minutes":{"type":"integer","minimum":1,"maximum":1440,"default":10,"description":"TTL in minutes for the initial enrolment code (1-1440)."},"code_ttl_seconds":{"type":"integer","minimum":60,"maximum":86400,"description":"Optional alternative TTL in seconds (60-86400) if `code_ttl_minutes` is omitted."}}}}}},"responses":{"201":{"description":"Account created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCreated"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/accounts/{guid}":{"get":{"tags":["Accounts"],"operationId":"getAccount","summary":"Get account details","description":"Returns account metadata, enrolled seats, and active (unused, unexpired) enrolment codes. Requires scope `accounts:read`.","x-required-scope":"accounts:read","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Account details with seats and active enrolment codes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountDetail"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Accounts"],"operationId":"updateAccount","summary":"Update account","description":"Updates `seat_limit`, `status` (`active` or `suspended`), or `entitlements`. Suspending an account immediately terminates active WebSocket sessions for its seats. Requires scope `accounts:write`.","x-required-scope":"accounts:write","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"properties":{"seat_limit":{"type":"integer","minimum":0,"maximum":100000},"status":{"type":"string","enum":["active","suspended"]},"entitlements":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Updated account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountUpdateResponse"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Accounts"],"operationId":"deleteAccount","summary":"Schedule account deletion","description":"Places the account in `pending_deletion` with a 1-28 day hold window and pushes an immediate WebSocket kill to every active seat via HeartbeatDO. Requires scope `accounts:write`.","x-required-scope":"accounts:write","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hold_days","in":"query","schema":{"type":"integer","minimum":1,"maximum":28,"default":28}}],"responses":{"202":{"description":"Deletion scheduled and active sessions killed","content":{"application/json":{"schema":{"type":"object","required":["account_guid","status","delete_after","purge_at","killed_installs"],"properties":{"account_guid":{"type":"string","format":"uuid"},"status":{"type":"string","const":"pending_deletion"},"delete_after":{"type":"string","format":"date-time"},"purge_at":{"type":"string","format":"date-time"},"killed_installs":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/accounts/{guid}/restore":{"post":{"tags":["Accounts"],"operationId":"restoreAccount","summary":"Restore account","description":"Restores a `pending_deletion` or `suspended` account back to `active` and clears `delete_after` / `purge_at`. Requires scope `accounts:write`.","x-required-scope":"accounts:write","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Account restored to active status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/accounts/{guid}/enrolment-codes":{"get":{"tags":["Enrolment Codes"],"operationId":"listEnrolmentCodes","summary":"List enrolment codes for an account","description":"Lists enrolment code metadata (never returns plaintext codes or hashes). Requires scope `accounts:read`.","x-required-scope":"accounts:read","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include_inactive","in":"query","schema":{"type":"boolean","default":false},"description":"Include consumed and expired codes."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated enrolment codes","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EnrolmentCode"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Enrolment Codes"],"operationId":"createEnrolmentCode","summary":"Create a single-use enrolment code","description":"Generates a single-use `enr_...` enrolment code for an active account. The plaintext code is returned once in this response. Requires scope `accounts:write`.","x-required-scope":"accounts:write","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string","default":"default"},"ttl_minutes":{"type":"integer","minimum":1,"maximum":1440},"ttl_seconds":{"type":"integer","minimum":60,"maximum":86400,"default":600}}}}}},"responses":{"201":{"description":"Enrolment code created","content":{"application/json":{"schema":{"type":"object","required":["id","enrolment_code","account_guid","product_id","expires_at","ttl_seconds","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"enrolment_code":{"type":"string","example":"enr_0123456789abcdef0123456789abcdef"},"account_guid":{"type":"string","format":"uuid"},"product_id":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"ttl_seconds":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/accounts/{guid}/enrolment-codes/{code_id}":{"delete":{"tags":["Enrolment Codes"],"operationId":"deleteEnrolmentCode","summary":"Revoke an unused enrolment code","description":"Deletes an unconsumed enrolment code. Requires scope `accounts:write`.","x-required-scope":"accounts:write","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"code_id","in":"path","required":true,"schema":{"type":"string"},"description":"Enrolment code UUID."}],"responses":{"200":{"description":"Enrolment code deleted","content":{"application/json":{"schema":{"type":"object","required":["deleted","id","account_guid"],"properties":{"deleted":{"type":"boolean","const":true},"id":{"type":"string","format":"uuid"},"account_guid":{"type":"string","format":"uuid"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/accounts/{guid}/seats":{"get":{"tags":["Seats"],"operationId":"listAccountSeats","summary":"List seats for an account","description":"Requires scope `seats:read`.","x-required-scope":"seats:read","parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["active","degraded","revoked"]}},{"name":"product_id","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated account seats","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Seat"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/seats":{"get":{"tags":["Seats"],"operationId":"listSeats","summary":"List seats across the tenant","description":"Filterable tenant-wide seat listing. Requires scope `seats:read`.","x-required-scope":"seats:read","parameters":[{"name":"account_guid","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"product_id","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["active","degraded","revoked"]}},{"name":"trust_tier","in":"query","schema":{"type":"integer","enum":[1,2,3]}},{"name":"active","in":"query","schema":{"type":"boolean"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated tenant seats","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Seat"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/seats/{install_id}":{"get":{"tags":["Seats"],"operationId":"getSeat","summary":"Get seat by install_id","description":"Requires scope `seats:read`.","x-required-scope":"seats:read","parameters":[{"name":"install_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Seat record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seat"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Seats"],"operationId":"updateSeat","summary":"Update seat","description":"Updates `status` (`active`, `degraded`, `revoked`), `trust_tier` (`1`, `2`, `3`), or `entitlements`. Setting `status: \"revoked\"` marks the seat inactive and pushes an instant WebSocket kill via HeartbeatDO. Requires scope `seats:write`.","x-required-scope":"seats:write","parameters":[{"name":"install_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"properties":{"status":{"type":"string","enum":["active","degraded","revoked"]},"trust_tier":{"type":"integer","enum":[1,2,3]},"entitlements":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Updated seat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeatUpdateResponse"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Seats"],"operationId":"deleteSeat","summary":"Revoke and release seat","description":"Deletes the seat record (releasing its seat slot immediately) and pushes an instant WebSocket kill via HeartbeatDO. Requires scope `seats:write`.","x-required-scope":"seats:write","parameters":[{"name":"install_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Seat deleted and session killed","content":{"application/json":{"schema":{"type":"object","required":["deleted","seat_id","install_id","account_guid","ws_killed"],"properties":{"deleted":{"type":"boolean","const":true},"seat_id":{"type":"string","format":"uuid"},"install_id":{"type":"string","format":"uuid"},"account_guid":{"type":"string","format":"uuid"},"ws_killed":{"type":"boolean"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/seats/{install_id}/kick":{"post":{"tags":["Seats"],"operationId":"kickSeat","summary":"Kick active WebSocket session","description":"Terminates the live HeartbeatDO WebSocket session for `install_id` without deleting or revoking the seat. Requires scope `seats:write`.","x-required-scope":"seats:write","parameters":[{"name":"install_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","default":"admin_kick","maxLength":128}}}}}},"responses":{"200":{"description":"Kill push sent to HeartbeatDO","content":{"application/json":{"schema":{"type":"object","required":["kicked","install_id","account_guid","reason"],"properties":{"kicked":{"type":"boolean"},"install_id":{"type":"string","format":"uuid"},"account_guid":{"type":"string","format":"uuid"},"reason":{"type":"string"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/bans":{"get":{"tags":["Bans"],"operationId":"listBans","summary":"List hardware bans","description":"Requires scope `bans:read`.","x-required-scope":"bans:read","parameters":[{"name":"product_id","in":"query","schema":{"type":"string"}},{"name":"component_type","in":"query","schema":{"type":"string","enum":["smbios","boot_disk","os_id","vol_serial","nic","tpm_ek"]}},{"name":"include_expired","in":"query","schema":{"type":"boolean","default":false}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated hardware bans","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Ban"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Bans"],"operationId":"createBan","summary":"Create hardware ban","description":"Bans one or more hardware components or a TPM Endorsement Key with a 1-3 year TTL (365-1095 days). Raw component values are hashed via per-tenant HMAC in `entropydrm-signer` after placeholder filtering and prevalence checks. Requires scope `bans:write`.","x-required-scope":"bans:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["components"],"properties":{"product_id":{"type":"string","default":"default"},"reason_code":{"type":"string","default":"tamper","maxLength":128},"ttl_days":{"type":"integer","minimum":365,"maximum":1095,"default":365},"components":{"type":"array","minItems":1,"items":{"type":"object","required":["component_type"],"properties":{"component_type":{"type":"string","enum":["smbios","boot_disk","os_id","vol_serial","nic","tpm_ek"]},"component_hash_hex":{"type":"string","pattern":"^[0-9a-fA-F]{64}$","description":"Pre-computed 32-byte per-tenant HMAC-SHA256 hex digest."},"raw_value":{"type":"string","description":"Raw hardware value to hash via per-tenant HMAC."}}}}}}}}},"responses":{"201":{"description":"Hardware ban entries created","content":{"application/json":{"schema":{"type":"object","required":["ban_id","enforcement","bans","skipped"],"properties":{"ban_id":{"type":"string"},"enforcement":{"type":"string","enum":["hard","degraded_review"]},"bans":{"type":"array","items":{"$ref":"#/components/schemas/Ban"}},"skipped":{"type":"array","items":{"type":"object","properties":{"component_type":{"type":"string"},"component_hash_hex":{"type":"string"},"reason":{"type":"string"},"clean_account_count":{"type":"integer"}}}}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Dependent storage or service binding unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/bans/{ban_id}":{"delete":{"tags":["Bans"],"operationId":"deleteBan","summary":"Remove hardware ban","description":"Requires scope `bans:write`.","x-required-scope":"bans:write","parameters":[{"name":"ban_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Ban removed","content":{"application/json":{"schema":{"type":"object","required":["deleted","ban_id"],"properties":{"deleted":{"type":"boolean","const":true},"ban_id":{"type":"string","format":"uuid"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/apps":{"get":{"tags":["Apps"],"operationId":"listApps","summary":"List apps","description":"Requires scope `apps:read`.","x-required-scope":"apps:read","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated list of apps","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/App"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Apps"],"operationId":"createApp","summary":"Create an app","description":"Requires scope `apps:write`.","x-required-scope":"apps:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["slug"],"properties":{"id":{"type":"string","description":"Optional app/product ID. Defaults to `slug`."},"slug":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,63}$"},"name":{"type":"string"},"display_label":{"type":"string"},"go_module_path":{"type":"string","default":""},"relay_origin":{"type":"string","default":""},"relay_cname":{"type":"string","default":""},"active_epoch_id":{"type":"integer","minimum":0,"default":1},"tier_policy_json":{"type":"object","additionalProperties":true,"default":{}},"tier1_fallback_active":{"type":"boolean","default":false}}}}}},"responses":{"201":{"description":"App created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/App"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/apps/{id}":{"get":{"tags":["Apps"],"operationId":"getApp","summary":"Get app by ID or slug","description":"Requires scope `apps:read`.","x-required-scope":"apps:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"App record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/App"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Apps"],"operationId":"updateApp","summary":"Update app settings","description":"Requires scope `apps:write`.","x-required-scope":"apps:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"properties":{"name":{"type":"string"},"display_label":{"type":"string"},"go_module_path":{"type":"string"},"relay_origin":{"type":"string"},"relay_cname":{"type":"string"},"active_epoch_id":{"type":["integer","null"],"minimum":0},"tier_policy_json":{"type":"object","additionalProperties":true},"tier1_fallback_active":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated app","content":{"application/json":{"schema":{"$ref":"#/components/schemas/App"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/releases":{"get":{"tags":["Releases"],"operationId":"listReleases","summary":"List releases","description":"Requires scope `releases:read`.","x-required-scope":"releases:read","parameters":[{"name":"product_id","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","staged","active","retired"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated releases","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Release"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Releases"],"operationId":"createRelease","summary":"Create a release","description":"Requires scope `releases:write`.","x-required-scope":"releases:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["product_id","version"],"properties":{"product_id":{"type":"string"},"version":{"type":"string"},"epoch_id":{"type":"integer","minimum":0,"default":1},"status":{"type":"string","enum":["draft","staged"],"default":"draft"},"launcher_sha256_json":{"type":"object","additionalProperties":{"type":"string"}},"tuf_targets_r2_key":{"type":"string"},"route_manifest_r2_key":{"type":"string"}}}}}},"responses":{"201":{"description":"Release created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Release"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/releases/{id}":{"get":{"tags":["Releases"],"operationId":"getRelease","summary":"Get release details","description":"Returns release metadata and associated builds. Requires scope `releases:read`.","x-required-scope":"releases:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Release with associated builds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseDetail"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Releases"],"operationId":"updateRelease","summary":"Update, promote, or retire a release","description":"Updates release metadata or transitions status. Setting `status: \"active\"` promotes a `staged` release and updates `apps.active_epoch_id`; setting `status: \"retired\"` retires the release and its non-killed builds. Requires scope `releases:write`.","x-required-scope":"releases:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"properties":{"status":{"type":"string","enum":["draft","staged","active","retired"]},"launcher_sha256_json":{"type":"object","additionalProperties":{"type":"string"}},"tuf_targets_r2_key":{"type":"string"},"route_manifest_r2_key":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated release","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Release"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Releases"],"operationId":"deleteRelease","summary":"Delete a release","description":"Permanently deletes a `draft`, `staged`, or `retired` release. Pass `?force=true` to destroy an `active` release. Requires scope `releases:write`.","x-required-scope":"releases:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"force","in":"query","schema":{"type":"boolean","default":false},"description":"Required to permanently delete an active release."}],"responses":{"200":{"description":"Release permanently deleted","content":{"application/json":{"schema":{"type":"object","required":["deleted","id","product_id","version","previous_status"],"properties":{"deleted":{"type":"boolean","const":true},"id":{"type":"string","format":"uuid"},"product_id":{"type":"string"},"version":{"type":"string"},"previous_status":{"type":"string"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/builds":{"get":{"tags":["Builds"],"operationId":"listBuilds","summary":"List builds","description":"Requires scope `builds:read`.","x-required-scope":"builds:read","parameters":[{"name":"product_id","in":"query","schema":{"type":"string"}},{"name":"release_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["staged","active","deprecated","retired","revoked","killed"]}},{"name":"os","in":"query","schema":{"type":"string"}},{"name":"arch","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated builds","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Build"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/builds/{build_id}":{"get":{"tags":["Builds"],"operationId":"getBuild","summary":"Get build metadata","description":"Requires scope `builds:read`.","x-required-scope":"builds:read","parameters":[{"name":"build_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Build record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Build"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Builds"],"operationId":"deleteBuild","summary":"Delete a killed or retired build","description":"Permanently removes a `killed` or `retired` build record. Pass `?force=true` to kill and delete an active/staged build. Requires scope `builds:write`.","x-required-scope":"builds:write","parameters":[{"name":"build_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"force","in":"query","schema":{"type":"boolean","default":false},"description":"Required to delete a build that is not already killed or retired."}],"responses":{"200":{"description":"Build deleted","content":{"application/json":{"schema":{"type":"object","required":["deleted","build_id","previous_status"],"properties":{"deleted":{"type":"boolean","const":true},"build_id":{"type":"string","format":"uuid"},"previous_status":{"type":"string"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict with existing resource or current resource state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/builds/{build_id}/kill":{"post":{"tags":["Builds"],"operationId":"killBuild","summary":"Kill a build and disconnect active seats","description":"Marks the build as `killed` and pushes an immediate WebSocket kill to active seats running this product via HeartbeatDO. Requires scope `builds:write`.","x-required-scope":"builds:write","parameters":[{"name":"build_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","default":"build_killed","maxLength":128},"install_ids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Optional additional install IDs to disconnect."}}}}}},"responses":{"200":{"description":"Build killed and active sessions terminated","content":{"application/json":{"schema":{"type":"object","required":["build_id","status","reason","killed_installs"],"properties":{"build_id":{"type":"string","format":"uuid"},"status":{"type":"string","const":"killed"},"reason":{"type":"string"},"killed_installs":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/logs":{"get":{"tags":["Logs"],"operationId":"listSealedLogs","summary":"List sealed HPKE log batches","description":"Lists encrypted log batch objects stored in R2 for the authenticated tenant. Payloads remain HPKE-sealed. Requires scope `logs:read`.","x-required-scope":"logs:read","parameters":[{"name":"product_id","in":"query","schema":{"type":"string"}},{"name":"build_id","in":"query","schema":{"type":"string"}},{"name":"install_id","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Pagination cursor returned by a previous call."}],"responses":{"200":{"description":"Sealed log batch listing","content":{"application/json":{"schema":{"type":"object","required":["data","cursor","truncated"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SealedLogEntry"}},"cursor":{"type":["string","null"]},"truncated":{"type":"boolean"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Dependent storage or service binding unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/tokens":{"get":{"tags":["API Tokens"],"operationId":"listApiTokens","summary":"List API tokens","description":"Returns token metadata only (never plaintext or hashes). Requires scope `tokens:read`.","x-required-scope":"tokens:read","parameters":[{"name":"include_revoked","in":"query","schema":{"type":"boolean","default":true}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Maximum number of items to return (1-200)."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of items to skip."}],"responses":{"200":{"description":"Paginated API tokens","content":{"application/json":{"schema":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiToken"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["API Tokens"],"operationId":"createApiToken","summary":"Create a scoped API token","description":"Mints a new `ent_live_...` Bearer token. The plaintext token is returned once. Scoped tokens cannot mint tokens with scopes they do not hold. Requires scope `tokens:write`.","x-required-scope":"tokens:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","scopes"],"properties":{"name":{"type":"string","minLength":1,"maxLength":128},"scopes":{"type":"array","minItems":1,"items":{"type":"string","enum":["accounts:read","accounts:write","seats:read","seats:write","bans:read","bans:write","apps:read","apps:write","releases:read","releases:write","builds:read","builds:write","logs:read","tokens:read","tokens:write","*"]}},"expires_in_days":{"type":"integer","minimum":1,"maximum":3650,"description":"Optional expiry in days from now. Omit for no expiration."},"expires_at":{"type":"string","format":"date-time","description":"Optional future ISO-8601 expiration timestamp."}}}}}},"responses":{"201":{"description":"API token created (plaintext returned once)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTokenCreated"}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/tokens/{id}":{"delete":{"tags":["API Tokens"],"operationId":"revokeApiToken","summary":"Revoke an API token","description":"Immediately revokes an API token by setting `revoked_at`. Requires scope `tokens:write`.","x-required-scope":"tokens:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Token revoked","content":{"application/json":{"schema":{"type":"object","required":["revoked","id","token_prefix","revoked_at"],"properties":{"revoked":{"type":"boolean","const":true},"id":{"type":"string","format":"uuid"},"token_prefix":{"type":"string"},"revoked_at":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid request parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing, invalid, expired, or revoked Bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Token lacks the required scope or tenant mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Requested resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"ent_live_<base64url>","description":"Scoped tenant API token (`Authorization: Bearer ent_live_...`) created in https://app.getentropy.dev or via POST /v1/tokens."}},"schemas":{"ErrorResponse":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":true}}},"Account":{"type":"object","required":["account_guid","tenant_id","seat_limit","entitlements","status","delete_after","created_at","updated_at"],"properties":{"account_guid":{"type":"string","format":"uuid"},"tenant_id":{"type":"string","format":"uuid"},"seat_limit":{"type":"integer","minimum":0},"active_seats":{"type":"integer","minimum":0},"entitlements":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","suspended","pending_deletion","banned"]},"delete_after":{"type":["string","null"],"format":"date-time"},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}}},"AccountCreated":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","properties":{"enrolment_code":{"type":["object","null"],"required":["id","code","product_id","expires_at","ttl_seconds","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"product_id":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"ttl_seconds":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}]},"AccountDetail":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","required":["seats","enrolment_codes"],"properties":{"seats":{"type":"array","items":{"$ref":"#/components/schemas/Seat"}},"enrolment_codes":{"type":"array","items":{"$ref":"#/components/schemas/EnrolmentCode"}}}}]},"AccountUpdateResponse":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","properties":{"killed_installs":{"type":"array","items":{"type":"string","format":"uuid"}}}}]},"EnrolmentCode":{"type":"object","required":["id","account_guid","product_id","status","expires_at","consumed_at","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"account_guid":{"type":"string","format":"uuid"},"product_id":{"type":"string"},"status":{"type":"string","enum":["active","consumed","expired"]},"expires_at":{"type":"string","format":"date-time"},"consumed_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":["string","null"],"format":"date-time"}}},"SeatComponent":{"type":"object","required":["component_type","component_hash_hex","weight","portable"],"properties":{"component_type":{"type":"string","enum":["smbios","boot_disk","os_id","vol_serial","nic","tpm_ek"]},"component_hash_hex":{"type":"string"},"weight":{"type":"integer"},"portable":{"type":"boolean"}}},"Seat":{"type":"object","required":["seat_id","tenant_id","account_guid","install_id","product_id","trust_tier","boot_verified","hwid_score","heal_count_30d","active","status","entitlements","components"],"properties":{"seat_id":{"type":"string","format":"uuid"},"tenant_id":{"type":"string","format":"uuid"},"account_guid":{"type":"string","format":"uuid"},"install_id":{"type":"string","format":"uuid"},"product_id":{"type":"string"},"trust_tier":{"type":"integer","enum":[1,2,3]},"ek_hash_hex":{"type":["string","null"]},"tpm_firmware_rev":{"type":["string","null"]},"boot_verified":{"type":"boolean"},"hwid_score":{"type":"integer","minimum":0,"maximum":100},"heal_count_30d":{"type":"integer","minimum":0},"last_heal_at":{"type":["string","null"],"format":"date-time"},"active":{"type":"boolean"},"status":{"type":"string","enum":["active","degraded","revoked"]},"entitlements":{"type":"array","items":{"type":"string"}},"last_seen_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":["string","null"],"format":"date-time"},"components":{"type":"array","items":{"$ref":"#/components/schemas/SeatComponent"}}}},"SeatUpdateResponse":{"allOf":[{"$ref":"#/components/schemas/Seat"},{"type":"object","properties":{"ws_killed":{"type":"boolean"}}}]},"Ban":{"type":"object","required":["ban_id","tenant_id","product_id","component_type","component_hash_hex","reason_code","created_at","expires_at"],"properties":{"ban_id":{"type":"string","format":"uuid"},"tenant_id":{"type":"string","format":"uuid"},"product_id":{"type":"string"},"component_type":{"type":"string","enum":["smbios","boot_disk","os_id","vol_serial","nic","tpm_ek"]},"component_hash_hex":{"type":"string"},"reason_code":{"type":"string"},"created_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"}}},"App":{"type":"object","required":["id","tenant_id","slug","name","display_label","go_module_path","relay_origin","relay_cname","active_epoch_id","tier_policy_json","tier1_fallback_active","created_at"],"properties":{"id":{"type":"string"},"tenant_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"display_label":{"type":"string"},"go_module_path":{"type":"string"},"relay_origin":{"type":"string"},"relay_cname":{"type":"string"},"active_epoch_id":{"type":["integer","null"]},"tier_policy_json":{"type":"object","additionalProperties":true},"tier1_fallback_active":{"type":"boolean"},"created_at":{"type":["string","null"],"format":"date-time"}}},"Release":{"type":"object","required":["id","tenant_id","product_id","epoch_id","version","status","launcher_sha256_json","tuf_targets_r2_key","route_manifest_r2_key","promoted_at","retired_at","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"tenant_id":{"type":"string","format":"uuid"},"product_id":{"type":"string"},"epoch_id":{"type":"integer"},"version":{"type":"string"},"status":{"type":"string","enum":["draft","staged","active","retired"]},"launcher_sha256_json":{"type":"object","additionalProperties":{"type":"string"}},"tuf_targets_r2_key":{"type":"string"},"route_manifest_r2_key":{"type":"string"},"promoted_at":{"type":["string","null"],"format":"date-time"},"retired_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":["string","null"],"format":"date-time"},"activated_builds":{"type":"array","items":{"type":"string","format":"uuid"}},"retired_builds":{"type":"array","items":{"type":"string","format":"uuid"}}}},"ReleaseDetail":{"allOf":[{"$ref":"#/components/schemas/Release"},{"type":"object","required":["builds"],"properties":{"builds":{"type":"array","items":{"$ref":"#/components/schemas/Build"}}}}]},"Build":{"type":"object","required":["build_id","tenant_id","product_id","epoch_id","release_id","os","arch","watermark_id","core_r2_key","guard_challenge_count","status","created_at","retired_at"],"properties":{"build_id":{"type":"string","format":"uuid"},"tenant_id":{"type":"string","format":"uuid"},"product_id":{"type":"string"},"epoch_id":{"type":"integer"},"release_id":{"type":["string","null"],"format":"uuid"},"os":{"type":"string"},"arch":{"type":"string"},"watermark_id":{"type":"string"},"core_r2_key":{"type":"string"},"guard_challenge_count":{"type":"integer","minimum":0},"status":{"type":"string","enum":["staged","active","deprecated","retired","revoked","killed"]},"created_at":{"type":["string","null"],"format":"date-time"},"retired_at":{"type":["string","null"],"format":"date-time"}}},"SealedLogEntry":{"type":"object","required":["key","size","etag","uploaded","product_id","build_id","install_id","encrypted"],"properties":{"key":{"type":"string"},"size":{"type":"integer","minimum":0},"etag":{"type":"string"},"uploaded":{"type":["string","null"],"format":"date-time"},"product_id":{"type":"string"},"build_id":{"type":"string"},"install_id":{"type":"string"},"expires_at":{"type":["string","null"],"format":"date-time"},"encrypted":{"type":"string","example":"hpke-sealed"}}},"ApiToken":{"type":"object","required":["id","tenant_id","name","token_prefix","scopes","status","expires_at","last_used_at","revoked_at","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"tenant_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"token_prefix":{"type":"string","example":"ent_live_Ab3xY9z"},"scopes":{"type":"array","items":{"type":"string","enum":["accounts:read","accounts:write","seats:read","seats:write","bans:read","bans:write","apps:read","apps:write","releases:read","releases:write","builds:read","builds:write","logs:read","tokens:read","tokens:write","*"]}},"status":{"type":"string","enum":["active","expired","revoked"]},"expires_at":{"type":["string","null"],"format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"},"revoked_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":["string","null"],"format":"date-time"}}},"ApiTokenCreated":{"allOf":[{"$ref":"#/components/schemas/ApiToken"},{"type":"object","required":["token"],"properties":{"token":{"type":"string","example":"ent_live_..."}}}]}}}}