{"openapi":"3.1.0","info":{"title":"LockerNote API","version":"0.1.0","description":"Temporary note and attachment locker API. Content expires automatically and uses 6-character locker codes."},"servers":[{"url":"/"}],"tags":[{"name":"notes","description":"Create, open, and clear temporary notes."},{"name":"agent","description":"Bearer-token Agent API for CLI and MCP clients."},{"name":"attachments","description":"Upload, download, and discard temporary attachments."},{"name":"system","description":"Health, metrics, QR codes, and API metadata."}],"paths":{"/livez":{"get":{"tags":["system"],"summary":"Check whether the LockerNote process is alive.","responses":{"200":{"description":"Process is accepting requests."},"503":{"$ref":"#/components/responses/Error"}}}},"/readyz":{"get":{"tags":["system"],"summary":"Check whether storage dependencies are ready.","responses":{"200":{"description":"Storage dependencies and audit writes are ready.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessResponse"}}}},"503":{"description":"A storage dependency or the audit writer is degraded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessResponse"}}}}}}},"/api/runtime-config":{"get":{"tags":["system"],"summary":"Read public browser runtime configuration.","responses":{"200":{"description":"Public browser runtime configuration.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeConfigResponse"}}}}}}},"/api/notes":{"post":{"tags":["notes"],"summary":"Create or update a temporary note.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteCreateRequest"}}}},"responses":{"200":{"description":"Existing note updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteCreateResponse"}}}},"201":{"description":"Note created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteCreateResponse"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"tags":["notes"],"summary":"Open a note with a locker code.","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"},"description":"Six-character locker code. Case-insensitive."},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{8,128}$"},"description":"Required for burn-after-reading lockers. Reuse the same value when retrying an uncertain open."},{"name":"X-Locker-Viewer-Token","in":"header","required":false,"schema":{"type":"string","minLength":16,"maxLength":128},"description":"Anonymous per-browser token used to estimate unique viewers."},{"name":"X-Locker-Creator-Token","in":"header","required":false,"schema":{"type":"string"},"description":"When valid, the creator's own open is excluded from receipt statistics."}],"responses":{"200":{"description":"Unlocked note.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteReadResponse"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"404":{"$ref":"#/components/responses/Error"},"428":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/notes/{id}":{"get":{"tags":["notes"],"summary":"Open a note by note ID and locker code.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{8,128}$"},"description":"Required for burn-after-reading lockers. Reuse the same value when retrying an uncertain open."}],"responses":{"200":{"description":"Unlocked note.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteReadResponse"}}}},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"404":{"$ref":"#/components/responses/Error"},"428":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["notes"],"summary":"Clear a browser-created note before expiry.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Locker-Creator-Token","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"description":"Per-note creator capability returned only when the browser note is created."}],"responses":{"200":{"description":"Note cleared.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/notes/{id}/status":{"get":{"tags":["notes"],"summary":"Check whether an already-open note still exists.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Locker-Read-Token","in":"header","required":false,"schema":{"type":"string"}},{"name":"X-Locker-Creator-Token","in":"header","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"The note is still active."},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/notes/{id}/receipts":{"get":{"tags":["notes"],"summary":"Read creator-only delivery and view statistics.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Locker-Creator-Token","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Receipt status."},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/notes/{id}/comments":{"get":{"tags":["notes"],"summary":"List comments for a comments-enabled note and record returned messages as viewed.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"}},{"name":"X-Locker-Read-Token","in":"header","required":false,"schema":{"type":"string"}},{"name":"X-Locker-Viewer-Token","in":"header","required":false,"schema":{"type":"string","minLength":16,"maxLength":128},"description":"Anonymous per-browser token used to keep a stable discussion color and de-duplicate message views inside this locker."}],"responses":{"200":{"description":"Comment list."},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["notes"],"summary":"Post a comment with optional pending attachment IDs.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Locker-Read-Token","in":"header","required":false,"schema":{"type":"string"}},{"name":"X-Locker-Viewer-Token","in":"header","required":false,"schema":{"type":"string","minLength":16,"maxLength":128},"description":"Anonymous per-browser token used to keep a stable discussion color inside this locker."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"},"content":{"type":"string","maxLength":32000},"encryption":{"$ref":"#/components/schemas/ClientEncryption"},"attachmentIds":{"type":"array","maxItems":8,"items":{"type":"string","pattern":"^[a-f0-9]{32}$"}},"replyToId":{"type":"string","pattern":"^comment_[a-f0-9]{24}$"}}}}}},"responses":{"201":{"description":"Comment created."},"400":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/lockers":{"post":{"tags":["agent"],"summary":"Create a locker through the Agent API.","security":[{"agentToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentLockerCreateRequest"},"examples":{"text":{"value":{"text":"hello","ttl":10}},"markdown":{"value":{"markdown":"# Deployment note\nShip after tests pass.","ttlMinutes":60}},"json":{"value":{"json":{"status":"ready","count":2},"ttl":10}}}}}},"responses":{"201":{"description":"Locker created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentLockerCreateResponse"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"tags":["agent"],"summary":"Open a locker through the Agent API.","security":[{"agentToken":[]}],"parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"},"example":"AB12CD"},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{8,128}$"},"description":"Required for burn-after-reading lockers. Reuse the same value when retrying an uncertain open."}],"responses":{"200":{"description":"Unlocked locker.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentLockerReadResponse"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"428":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/lockers/{id}":{"delete":{"tags":["agent"],"summary":"Clear a locker through the Agent API.","security":[{"agentToken":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"}}},"examples":{"clear":{"value":{"code":"AB12CD"}}}}}},"responses":{"200":{"description":"Locker cleared.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentClearResponse"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/status":{"get":{"tags":["agent"],"summary":"Check Agent API connectivity and capabilities.","security":[{"agentToken":[]}],"responses":{"200":{"description":"Agent API status and capability metadata.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentStatusResponse"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/attachments":{"post":{"tags":["attachments"],"summary":"Upload one temporary attachment.","description":"Send the raw file bytes as the request body. Browser clients must pass same-site checks; Agent, CLI, and MCP clients should send Authorization: Bearer <AGENT_API_TOKEN>. Use X-File-Name to preserve a filename.","parameters":[{"name":"X-File-Name","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"201":{"description":"Attachment uploaded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentResponse"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"507":{"$ref":"#/components/responses/Error"}}}},"/api/attachments/{id}":{"get":{"tags":["attachments"],"summary":"Download or preview an attachment.","servers":[{"url":"https://attachments.lockernote.com"}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-f0-9]{32}$"}},{"name":"readToken","in":"query","required":false,"schema":{"type":"string"},"description":"Temporary signed token returned when a note is opened. Required for isolated-origin delivery; same-origin delivery can also use the HttpOnly read cookie."},{"name":"code","in":"query","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"},"description":"Compatibility fallback for direct downloads. Prefer readToken/cookie."},{"name":"download","in":"query","required":false,"schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"Attachment bytes."},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"head":{"tags":["attachments"],"summary":"Read attachment headers without downloading the body.","servers":[{"url":"https://attachments.lockernote.com"}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-f0-9]{32}$"}},{"name":"readToken","in":"query","required":false,"schema":{"type":"string"},"description":"Temporary signed token returned when a note is opened. Required for isolated-origin delivery; same-origin delivery can also use the HttpOnly read cookie."},{"name":"code","in":"query","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{6}$"},"description":"Compatibility fallback for direct downloads. Prefer readToken/cookie."},{"name":"download","in":"query","required":false,"schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"Attachment headers."},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["attachments"],"summary":"Discard an uploaded attachment before it is claimed by a note.","description":"Browser clients must pass same-site checks; Agent, CLI, and MCP clients should send Authorization: Bearer <AGENT_API_TOKEN>.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-f0-9]{32}$"}}],"responses":{"200":{"description":"Attachment discarded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/CrossSiteRequest"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/qr":{"get":{"tags":["system"],"summary":"Generate a QR code image.","parameters":[{"name":"text","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"paperColor","in":"query","required":false,"schema":{"type":"string","enum":["sun","mint","sky","rose","lilac","peach"]}}],"responses":{"200":{"description":"PNG QR code image."},"400":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/health":{"get":{"tags":["system"],"summary":"Runtime health check.","responses":{"200":{"description":"Runtime health data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/metrics":{"get":{"tags":["system"],"summary":"Prometheus metrics.","responses":{"200":{"description":"Prometheus text exposition format."}}}},"/openapi.json":{"get":{"tags":["system"],"summary":"OpenAPI document.","responses":{"200":{"description":"OpenAPI 3.1 JSON."}}}},"/api/admin/stats":{"get":{"tags":["system"],"summary":"Protected runtime statistics and metadata audit log.","security":[{"adminToken":[]}],"responses":{"200":{"description":"Admin stats.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminStatsResponse"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/api/admin/audit":{"get":{"tags":["system"],"summary":"Export the metadata-only audit log.","description":"Requires ADMIN_TOKEN. The export never includes note content, locker codes, read tokens, or API credentials.","security":[{"adminToken":[]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":100}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"event","in":"query","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]+$","maxLength":128}},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","jsonl"],"default":"json"}}],"responses":{"200":{"description":"Filtered and paginated audit entries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditPage"}},"application/x-ndjson":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/AuditQueryInvalid"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/AuditUnavailable"}}}}},"components":{"securitySchemes":{"agentToken":{"type":"http","scheme":"bearer","description":"Set AGENT_API_TOKEN and pass it as Authorization: Bearer <token>."},"adminToken":{"type":"http","scheme":"bearer","description":"Set ADMIN_TOKEN and pass it as Authorization: Bearer <token>."}},"responses":{"Error":{"description":"JSON error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"CrossSiteRequest":{"description":"Cross-site browser request was rejected before content access.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"RateLimited":{"description":"Request was rate limited.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"AuditQueryInvalid":{"description":"Audit export query parameters are invalid (AUDIT_QUERY_INVALID).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditQueryInvalidError"}}}},"AuditUnavailable":{"description":"The audit backend cannot be read (AUDIT_UNAVAILABLE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditUnavailableError"}}}}},"schemas":{"AttachmentPublicOrigin":{"description":"Absolute HTTP(S) origin used for attachment delivery, or an empty string when same-origin delivery is active.","oneOf":[{"type":"string","format":"uri","pattern":"^https?://"},{"type":"string","const":""}]},"RuntimeConfigResponse":{"type":"object","required":["attachmentPublicOrigin"],"properties":{"attachmentPublicOrigin":{"$ref":"#/components/schemas/AttachmentPublicOrigin"}},"additionalProperties":false},"NoteCreateRequest":{"type":"object","required":["content"],"properties":{"id":{"type":"string","description":"Existing note ID when updating."},"code":{"type":"string","pattern":"^[A-Za-z0-9]{6}$","description":"Optional custom locker code."},"content":{"type":"string","description":"Markdown note content, including attachment markdown references."},"encryption":{"$ref":"#/components/schemas/ClientEncryption"},"attachmentIds":{"type":"array","items":{"type":"string","pattern":"^[a-f0-9]{32}$"},"description":"Required when content is client-encrypted and contains attachment references."},"ttlMinutes":{"type":"integer","enum":[10,60,1440],"default":10},"deleteAfterOpen":{"type":"boolean","default":false},"burnAfterReads":{"type":"integer","minimum":1,"maximum":20,"default":1},"commentsEnabled":{"type":"boolean","default":false},"paperColor":{"type":"string","enum":["sun","mint","sky","rose","lilac","peach"]}}},"NoteCreateResponse":{"type":"object","required":["note","code"],"properties":{"note":{"$ref":"#/components/schemas/PublicNote"},"code":{"type":"string","pattern":"^[A-Z0-9]{6}$"},"creatorToken":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$","description":"Returned only for a newly created browser note. Store it only in the creator browser."}}},"NoteReadResponse":{"type":"object","required":["note"],"properties":{"note":{"allOf":[{"$ref":"#/components/schemas/PublicNote"},{"type":"object","required":["content"]}]}}},"AgentLockerCreateRequest":{"type":"object","oneOf":[{"required":["text"]},{"required":["markdown"]},{"required":["json"]},{"required":["content"]}],"properties":{"text":{"type":"string","description":"Plain text content."},"markdown":{"type":"string","description":"Markdown content."},"json":{"description":"JSON value to store as pretty-printed JSON text."},"content":{"type":"string","description":"Raw note content. May include locker-attachment markers after uploading files to /api/attachments."},"attachmentIds":{"type":"array","items":{"type":"string","pattern":"^[a-f0-9]{32}$"},"description":"Optional attachment IDs referenced by locker-attachment markers."},"code":{"type":"string","pattern":"^[A-Za-z0-9]{6}$","description":"Optional custom locker code."},"ttl":{"type":"integer","enum":[10,60,1440],"description":"Alias for ttlMinutes."},"ttlMinutes":{"type":"integer","enum":[10,60,1440],"default":10},"deleteAfterOpen":{"type":"boolean","default":false},"burnAfterReads":{"type":"integer","minimum":1,"maximum":20,"default":1},"paperColor":{"type":"string","enum":["sun","mint","sky","rose","lilac","peach"]},"metadata":{"type":"object","additionalProperties":true,"description":"Optional small agent metadata persisted with the locker."}}},"AgentLockerCreateResponse":{"type":"object","required":["id","code","url","locker","attachmentPublicOrigin"],"properties":{"id":{"type":"string"},"code":{"type":"string","pattern":"^[A-Z0-9]{6}$"},"url":{"type":"string","format":"uri","description":"Share URL using ?code=XXXXXX."},"locker":{"$ref":"#/components/schemas/PublicNote"},"attachmentPublicOrigin":{"$ref":"#/components/schemas/AttachmentPublicOrigin"},"readSession":{"type":"object","additionalProperties":true}}},"AgentLockerReadResponse":{"type":"object","required":["id","locker","attachmentPublicOrigin"],"properties":{"id":{"type":"string"},"locker":{"allOf":[{"$ref":"#/components/schemas/PublicNote"},{"type":"object","required":["content"]}]},"attachmentPublicOrigin":{"$ref":"#/components/schemas/AttachmentPublicOrigin"},"readSession":{"type":"object","additionalProperties":true}}},"AgentClearResponse":{"type":"object","required":["ok","id"],"properties":{"ok":{"type":"boolean"},"id":{"type":"string"}}},"AgentStatusResponse":{"type":"object","required":["ok","service","apiVersion","baseUrl","attachmentPublicOrigin","capabilities","limits"],"properties":{"ok":{"type":"boolean"},"service":{"type":"string","example":"LockerNote Agent API"},"apiVersion":{"type":"string","example":"v1"},"generatedAt":{"type":"string","format":"date-time"},"baseUrl":{"type":"string","format":"uri"},"attachmentPublicOrigin":{"$ref":"#/components/schemas/AttachmentPublicOrigin"},"docs":{"type":"object","additionalProperties":true},"capabilities":{"type":"object","additionalProperties":true},"limits":{"type":"object","additionalProperties":true},"storage":{"type":"object","additionalProperties":true}}},"PublicNote":{"type":"object","properties":{"id":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"ttlMinutes":{"type":"integer"},"deleteAfterOpen":{"type":"boolean"},"burnAfterReads":{"type":"integer"},"remainingReads":{"type":"integer"},"readCount":{"type":"integer"},"commentsEnabled":{"type":"boolean"},"attachmentIds":{"type":"array","items":{"type":"string"}},"attachmentBytes":{"type":"integer"},"attachmentCount":{"type":"integer"},"size":{"type":"integer"},"paperColor":{"type":"string","enum":["sun","mint","sky","rose","lilac","peach"]}}},"AttachmentResponse":{"type":"object","required":["attachment"],"properties":{"attachment":{"$ref":"#/components/schemas/PublicAttachment"}}},"PublicAttachment":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"kind":{"type":"string","enum":["image","video","audio","file"]},"size":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"}}},"HealthResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"storageMode":{"type":"string","enum":["memory","redis"]},"attachmentStorageMode":{"type":"string","enum":["memory","disk","s3"]},"redisConfigured":{"type":"boolean"},"redisConnected":{"type":"boolean"},"redisHealthy":{"type":"boolean"},"audit":{"$ref":"#/components/schemas/AuditHealth"},"activeNotes":{"type":"integer"},"activeAttachments":{"type":"integer"},"pendingAttachmentDeletions":{"type":"integer"},"totalAttachmentBytes":{"type":"integer"},"attachmentTempDir":{"type":"string"},"attachmentObjectBucket":{"type":"string"},"attachmentObjectPrefix":{"type":"string"},"attachmentDiskBytes":{"type":"integer"},"orphanAttachmentFiles":{"type":"integer"},"lastAttachmentCleanupAt":{"type":"string","format":"date-time"},"lastAttachmentCleanupRemovedBytes":{"type":"integer"},"lastAttachmentCleanupRemovedFiles":{"type":"integer"},"totalAttachmentCleanupRemovedBytes":{"type":"integer"},"totalAttachmentCleanupRemovedFiles":{"type":"integer"},"lastAttachmentCleanupFailureAt":{"type":"string","format":"date-time"},"lastAttachmentCleanupFailureCode":{"type":"string"},"attachmentCleanupFailuresTotal":{"type":"integer"},"encryption":{"type":"string","example":"AES-256-GCM"}}},"ReadinessResponse":{"type":"object","required":["ok","redisReady","attachmentStorageReady","auditReady"],"properties":{"ok":{"type":"boolean"},"redisReady":{"type":"boolean"},"attachmentStorageReady":{"type":"boolean"},"auditReady":{"type":"boolean"}},"additionalProperties":false},"OkResponse":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"}}},"ErrorResponse":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string"},"code":{"type":"string"},"details":{"type":"object","additionalProperties":true}}},"AuditQueryInvalidError":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string"},"code":{"type":"string","const":"AUDIT_QUERY_INVALID"}},"additionalProperties":false},"AuditUnavailableError":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string"},"code":{"type":"string","const":"AUDIT_UNAVAILABLE"}},"additionalProperties":false},"AuditEntry":{"type":"object","required":["id","at","event"],"properties":{"id":{"type":"string"},"at":{"type":"string","format":"date-time"},"event":{"type":"string"},"ipHash":{"type":"string"},"noteId":{"type":"string"},"attachmentId":{"type":"string"},"size":{"type":"number"},"attachmentCount":{"type":"integer"},"ttlMinutes":{"type":"number"},"deleteAfterOpen":{"type":"boolean"},"kind":{"type":"string"},"storage":{"type":"string"}},"additionalProperties":false},"AuditPage":{"type":"object","required":["enabled","backend","maxEntries","page","limit","total","totalPages","from","to","event","entries"],"properties":{"enabled":{"type":"boolean"},"backend":{"type":"string"},"maxEntries":{"type":"integer","minimum":0},"page":{"type":"integer","minimum":1},"limit":{"type":"integer","minimum":1,"maximum":200},"total":{"type":"integer","minimum":0},"totalPages":{"type":"integer","minimum":0},"from":{"oneOf":[{"type":"string","format":"date-time"},{"type":"string","const":""}]},"to":{"oneOf":[{"type":"string","format":"date-time"},{"type":"string","const":""}]},"event":{"type":"string"},"entries":{"type":"array","items":{"$ref":"#/components/schemas/AuditEntry"}}}},"AuditHealth":{"type":"object","required":["enabled","backend","maxEntries","healthy","lastErrorAt","lastErrorCode","failuresTotal"],"properties":{"enabled":{"type":"boolean"},"backend":{"type":"string"},"maxEntries":{"type":"integer","minimum":0},"healthy":{"type":"boolean"},"lastErrorAt":{"oneOf":[{"type":"string","format":"date-time"},{"type":"string","const":""}]},"lastErrorCode":{"type":"string"},"failuresTotal":{"type":"integer","minimum":0}}},"AdminAuditStatus":{"allOf":[{"$ref":"#/components/schemas/AuditPage"},{"$ref":"#/components/schemas/AuditHealth"},{"type":"object","required":["unavailable"],"properties":{"unavailable":{"type":"boolean"}}}]},"ClientEncryption":{"type":"object","properties":{"mode":{"type":"string","enum":["client"]},"algorithm":{"type":"string","enum":["AES-GCM"]},"iv":{"type":"string"},"salt":{"type":"string"},"iterations":{"type":"integer","minimum":100000,"maximum":1000000},"keySource":{"type":"string","enum":["locker-code"]}}},"AdminStatsResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"generatedAt":{"type":"string","format":"date-time"},"storageMode":{"type":"string","enum":["memory","redis"]},"attachmentStorageMode":{"type":"string","enum":["memory","disk","s3"]},"runtime":{"type":"object","additionalProperties":true},"metrics":{"type":"object","additionalProperties":true},"audit":{"$ref":"#/components/schemas/AdminAuditStatus"}}}}}}